bison -d macrojava.y
flex macrojava.l
gcc macrojava.tab.c lex.yy.c -lfl -o macrojava
./macrojava < X.java > Y.tokens
should generate the correct tokens in Y.tokens. Note, your program must take input from standard input and write to standard output (so that we can use the redirection).
The format for the set of tokens is given by JavaTokens grammar.
You can test the validity (not necessarily the correctness) of any given MacroJava and JavaTokens program by the following commands:
java -jar macrojavaParse.jar < X.java
# Outputs "Program parsed successfully" or the Details of the Parse error.
java -jar JavaTokensParse.jar < Y.tokens
# Outputs "Program parsed successfully" or the Details of the Parse error.
A non-erroneous JavaTokens file should lead to the original MacroJava code, if all the token-values are concatenated together.
Grading policy
Your homework will be graded for a total of 100 marks.
[ under development ]