Please write your solutions as clearly and concisely as possible.
E -> Lambda | Emptyset | a | b | c | E+E | EE | (E)Note that Lambda and Emptyset here are just symbols in the alphabet of G, used to represent particular regular expressions.
Consider the language L' obtained by putting a symbol "." (end-of-string) at the end of each string in L(G). Write a program which recognizes the language L'. You can use your favourite programming language among the following: C, C++, Java, Pascal and ML.
Hint: You can use either the top-down method or the bottom-up
method:
Top-down method.
Define an equivalent LL(1)
grammar G', and then apply the
Look-Ahead method described in
7.6.1 of Martin's book.
You can either use a stack (thus simulating
a pushdown automata) or
recursion (recursive-descent parsing).
Bottom-up method.
Define an equivalent unambiguous
grammar G'', and then apply the method described in
7.6.2 of Martin's book.
In both cases, you are free to choose the conventions
you prefer about the precedence and associativity of the
operators (but state explicitly which ones
are you using).
The solution will consist of the program, and the answers of the program on the following strings (the dot at the end is part of the string):
Please write down which of the above methods (top-down parsing with a stack, recursive-descent parsing, or bottom-up parsing) your program is based upon. If you use a stack, then please write down also the transition table, so to help me understanding your program.
Please keep the file with the program:
I might need to test it.