|
|
|
|
|
by tgv
1530 days ago
|
|
Generating the tree is trivial. The lexer is part of the parser. A pretty printer is not part of a compiler. The rest you have to do by hand. I know the name is a play on yacc (Yet Another Compiler Compiler), but it generates only a part of a compiler, the parser. |
|
If by "generating the tree" you mean generating definitions for the AST data structures, this is nontrivial enough that yacc does not do it.
> The lexer is part of the parser.
Again, yacc (a parser generator) does not include a lexer generator; that requires a second package such as lex.
> A pretty printer is not part of a compiler.
A pretty-printer for the IR or target language is an important part of a compiler, as one needs to render the output in a form that some other tool (e.g., an assembler) can accept. A pretty-printer for the source language also comes in handy.
> The rest you have to do by hand.
What you have to do by hand is to write a function from the source AST to the target AST (i.e., a compiler backend). langcc generates the whole frontend, not just the parser.