In this exercise you shall construct scanner and parser for documents
obeying the DTD of Fig. 5.14 in HMU. In particular you must complete
the input to mosmllex and mosmlyacc given below.
Programs:
- Absyn.sml: Abstract syntax for the DTD in
Fig. 5.14. You don't have to change this file.
- PClex.lex: Input to mosmllex. Complete
this specification.
- PCpar.grm: Input to mosmlyacc. Complete
this specification.
- parse.sml: File containing functions to
parse documents. You do not have to change this file solving the
exercise. You only have to use the function parses: string -> expr
(parses a document from a string) or the function
parsef: string -> expr, which parses a document from a file.
- Try out your parser (at least) on the following examples:
example 1 and example 2 and