parsing - understanding grammar implementation in java -
i searching implementation of context free grammars in java operations on them related compilers design course ll(1), slr parsing , stuff , found implementation. grammar main method reading grammar file write grammar , code parse it, problem cannot write grammar in right way code understand, example cannot write epsilon transition whenever write epsilon
or ε
considered terminals. please me write grammar in right way code understand example grammar:
e -> t e' e' -> + t e' | epsilon t -> f t' t' -> * f t' | epsilon f -> ( e ) | id
you make nonterminal empty string , have terminal produce empty string literal. e.g., empty -> ''
, everywhere want empty string transition use empty
.
Comments
Post a Comment