Summary
This chapter has introduced several Objective CAML tools for lexical analysis
(lexing) and syntax analysis (parsing). We explored (in order of
occurrence):
-
module Str to filter rational expressions;
- module Genlex to easily build simple lexers;
- the ocamllex tool, a typed integration of the lex
tool;
- the ocamlyacc tool, a typed integration of the
yacc tool;
- the use of streams to build top-down parsers, including
contextual parsers.
Tools ocamllex and ocamlyacc were used to define a
parser for the language Basic more easily maintained than that
introduced in page ??.