tokenizer 代写

Requirements of the Assignment

As in the tokenizer project, your parser should ignore (but copy) “meta-statements”.
Convert the given grammar into an unambiguous LL(1) grammar and submit it as part of your

README.
Use look-ahead top-down parsing.
For each input program, your parser should report ”Pass” or ”Error” as the result of grammar analysis.

Count the number of global and local variables (data decls), functions (func list but not function declarations), and statements (statements) in correct programs (Note: int a,b; increases the counter of variables by 2, not 1.).

 

Output to stdout the result in the following format: Pass
Variables: num variables
Functions: num functions

Statements num statements OR
Error

For example, for a correct program with 4 variables, 2 functions and 6 statements, your compiler should output at least the following:
Pass
Variables: 4

Functions: 2
Statements: 6
And if the input program fails to pass the grammar analysis, output: Error