ppgen does not take rules that are only present in “context-free priorities” section in account; however such rules are included in the generated parse table. To resolve this inconsistency of the toolkit, I would recommend patching ppgen appropriately.

E.g. both of these sets of rules parse correctly:

context-free start-symbols
  Expr

context-free syntax
  INT -> Expr { cons("Int") }
  Expr "*" Expr -> MulOp { cons("Mul") }
  Expr "+" Expr -> AddOp { cons("Add") } 

context-free priorities
    Expr "*" Expr -> MulOp { cons("Mul") }
  > Expr "+" Expr -> AddOp { cons("Add") } 

and

context-free start-symbols
  Expr

context-free syntax
  INT -> Expr { cons("Int") }

context-free priorities
    Expr "*" Expr -> MulOp { cons("Mul") }
  > Expr "+" Expr -> AddOp { cons("Add") } 

however, the generated pretty printing tables are - respectively

[
   Int -- _1
]

and

[
 Int -- _1,
 Mul -- _1 KW["*"] _2,
 Add -- _1 KW["+"] _2
]
Submitted by Barnabás Králik on 11 March 2013 at 13:30

On 18 March 2013 at 01:37 Guido Wachsmuth tagged generator

On 18 March 2013 at 01:38 Guido Wachsmuth tagged sdf

Log in to post comments