Question: *Will pay for functioning code Parser/Symbol Table (parser.c) In this project, you will implement and document a parser and symbol table for a modest subset

 *Will pay for functioning code Parser/Symbol Table (parser.c) In this project,you will implement and document a parser and symbol table for a

*Will pay for functioning code

Parser/Symbol Table (parser.c) In this project, you will implement and document a parser and symbol table for a modest subset of the C programming language. The subset includes constructs which require application of all the key concepts of compiler design; however, the subset is very small so that it can be done with reasonable effort. To further aid in reducing the effort required, the compiler builds on what has been done in the lexer project and the linear symbol table manager that we discussed in detail in class. 1. Development Procedure Since you might not complete the entire project, it is important that your understanding of compilers be evidenced in the work you do complete. Each implementation decision you make should be documented in your implementor's notes as early as possible, preferably before you rite the associated code. Further, the following development procedure outlined in class and the earlier handouts -is suggested: Modify your lexical analyzer to interact with the symbol table package for looking-up key- words. This involves embedding actions in your lex routine so that the name (string) can be looked-up in the symbol table. Note that keywords can also be recognized by lookup in the symbol table -your lex routine need not deal with if, int, else, or while as (1) special cases (2) Build the parser. (3) Add actions to create and print-out the constructed abstract syntax tree (AST). i d (4) Once everything is done, go back and add some error handling 2. The Input Language The input language is well-defined by the semantics of the C programming language and the syntax given by the syntax diagrams which follow. Variables can be global or local (to a function) in scope, the body of a while loop can be evaluated zero or more times (not one or more times), keywords are reserved (may not be used as function or variable names), and vari ables must be allowed to be at least 7 significant characters long Notice that the language provides only for integer-valued computations and supports only one data structure, one-dimensional array of integers. Since pointers are not supported and arrays are not first-class objects, function arguments and return values can only be simple integer values. expr-> term +--> +<...term fact .> +-> cond -+ +--fact ...+ +fact -- +.( -cond -->- array -+>WORD 3. The Output The output from your system is to be an AST representing the entire program. This should be built as a child-sibling tree, as discussed in class. When done, you should walk the tree to print a Lisp-style representation Parser/Symbol Table (parser.c) In this project, you will implement and document a parser and symbol table for a modest subset of the C programming language. The subset includes constructs which require application of all the key concepts of compiler design; however, the subset is very small so that it can be done with reasonable effort. To further aid in reducing the effort required, the compiler builds on what has been done in the lexer project and the linear symbol table manager that we discussed in detail in class. 1. Development Procedure Since you might not complete the entire project, it is important that your understanding of compilers be evidenced in the work you do complete. Each implementation decision you make should be documented in your implementor's notes as early as possible, preferably before you rite the associated code. Further, the following development procedure outlined in class and the earlier handouts -is suggested: Modify your lexical analyzer to interact with the symbol table package for looking-up key- words. This involves embedding actions in your lex routine so that the name (string) can be looked-up in the symbol table. Note that keywords can also be recognized by lookup in the symbol table -your lex routine need not deal with if, int, else, or while as (1) special cases (2) Build the parser. (3) Add actions to create and print-out the constructed abstract syntax tree (AST). i d (4) Once everything is done, go back and add some error handling 2. The Input Language The input language is well-defined by the semantics of the C programming language and the syntax given by the syntax diagrams which follow. Variables can be global or local (to a function) in scope, the body of a while loop can be evaluated zero or more times (not one or more times), keywords are reserved (may not be used as function or variable names), and vari ables must be allowed to be at least 7 significant characters long Notice that the language provides only for integer-valued computations and supports only one data structure, one-dimensional array of integers. Since pointers are not supported and arrays are not first-class objects, function arguments and return values can only be simple integer values. expr-> term +--> +<...term fact .> +-> cond -+ +--fact ...+ +fact -- +.( -cond -->- array -+>WORD 3. The Output The output from your system is to be an AST representing the entire program. This should be built as a child-sibling tree, as discussed in class. When done, you should walk the tree to print a Lisp-style representation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!