Summary
In this chapter, you learned the crucial technical skills and tools used in programming languages when they are parsing the sequence of lexemes from the program source code in order to check its organization and structure.
You learned to write context-free grammars, and to use the iyacc and BYACC/J tools to take your context-free grammar and generate a parser for it.
When input fails to follow the rules, an error reporting function, yyerror()
, is called. You learned some basics about this error handling mechanism.
You learned how to call a generated parser from a main()
function. The parser that yacc generates is called via the yyparse()
function.
You are now ready to learn how to build the syntax tree data structure that reflects the structure of the input source code. The next chapter will cover the construction of syntax trees in detail.