Typos in the Warren paper on Logic Programmign and Compiler Writing
- p 112, in the encodesubexpr rule, there should be a comma after the
apply(...) term, not a period.
- p 114, in encodetest rule, the horozontal line in the expr() term
is a minus sign -, not a underscore _.
-
the syntax rules on p 120-121 give +|- higher precedence than *|/
which is non-standard. this means 1+2*3 and 3*2+1 are both parenthesized
as (1+2)*3. to fix this in the grammar we can do the following:
-- p 119, in bnf rule for Expr, Op2 should be Op1.
-- p 120, in bnf rule for Expr1, Op1 should be Op2.
-- p 121, the clauses for the operators should be:
- op(1,*).
- op(1,/).
- op(2,+).
- op(2,-).
-
p 121 in line 3 of the rule for restexpr(), there is a term
"expr(Op,X1,X2)" which should not be interpreted as a term of the
prolog program, but rather as a constructor of the code term to be
generated for this expression.