Provide regular expressions to characterize the following lexical items:
Generate tokens from the regular expression using ML-Lex
Note
The task in this assignment is to build a recursive descent parser, based on the LL(1) parsing table developed in class, for the following grammar. Your recursive descent parser should interface with the lexical tokenizer developed in assignment 1 (corrections and improvements to what you did then are allowed). In fact, you should also try to see if your parser program interfaces correctly with someone else's tokenizer. (Hint: develop the parser as a functor).
You may have to massage this grammar into a suitable form before it is LL(1). I require you to present the modified grammar and the first and follow sets, as well as the parsing table (hone your noweb and LaTeX skills).
Please be careful with your error-handling routines
The output from the parser (at this stage) can be parse trees. These are isomorphic to a term of a suitable data type. So you can output these terms and write suitable print routines to display them as strings.
The following grammar is deliberately ambiguous. You need to
disambiguate it in the standard way, and give precedences according to
the following conventions:
The grammar is as follows:
Assume you are given any IR code trees belonging to the datatype defined in module TREE of Appel's book. Your task is to make the tree canonical (i.e., massage away any SEQ or ESEQ constructions, and ensure that any CALL is the child of a MEM, EXP ... and not of another CALL. Next ensure that you build basic blocks and ensure that conditional jump instructions are turned into a form where false branches are eliminated ("fall through if false"). Finally you have to choose any RISC architecture instruction set (easiest is the Jouette architecture in Appel's book), and implement the maximal munch tiling algorithm. Please generate assembly level commentary to describe the tile that has been replaced.