Reading material

Pages 22-28
Variables and Declarations

Additional material

Grammars (Chapter 2)
Grammatical Difficulties (Section 19.1)

To use ML-Lex, copy the files driver.sml, errormsg.sml,, tokens.sig and tokens.sml. The file language.lex contains a simple example of input for the lexical analyzer generator. The file program contains a short sample program. To generate the lexical analyzer for the language specified in language.lex, execute sml and type the command CM.make(); The command Parse.parse "program"; will lexically analyze the sample program.

The file language.grm contains a simple example of input for the syntax analyzer generator. By executing ml-yacc language.grm the parse table is generated in the file language.grm.desc.