(* * The wish has come true! This file now parses correctly. *) module TermFactorAttributeGrammar; (* * Attribute definitions. *) define obj attribute type:Type; define obj attribute valu:Value; (* * Attribute type definitions. *) obj Type = string; obj Value = number; (* * Grammar and semantic action definitions. *) obj E ::= e:E '+' t:T actions: this.:type == (if e.:type = t.:type then e.:type else "ERROR"); this.:valu == e.:valu + t.:valu; end E; obj E' ::= t:T actions: this.:type == t.:type; this.:valu == t.:valu; end E'; obj T ::= t:T '*' f:F; obj T' ::= f:F; obj F ::= 'x'; end TermFactorAttributeGrammar;