compiler construction - AntlrWorks & language grammar errors -
working on game project involves scripting language want interpret virtual machine code can executed directly. i've included grammar below. lexer rules displaying in syntax diagram, when click on bodies of of parser rules, "cannot display rule "x" because start state not found" given parser rule x.
i'm not sure why antlr complaining not having start state. grammar should plainly start codeline, isn't referenced other parser rule. also, box in upper right green, indicating there no syntax errors.
i combed through of other message board posts, many of grammars provided in antlrv3 sample grammar download, none of them have special code indicates antlr 1 of parser rules start state. feel simple broken, i'm @ impasse is.
any advice or assistance appreciated! if it's along lines of "go read this".
grammar robotwarsgrammar; equal options { paraphrase = "="; } : '=' ;
assuming you're using antlr 3.x.
all that:
options { paraphrase = ...; } stuff (afaik) old antlr 2 syntax -- try removing it.
also, ! in comment rule:
comment : !(digit | letter | space)* ; is tree-rewrite-operator (see cheat sheet). works when have:
options { output=ast; } in grammar (which don't). so, remove ! comment rule well. unless want match literal !, in case need wrap single quotes around it:
comment : '!' (digit | letter | space)* ;
Comments
Post a Comment