Question: I think I'm having some issues with my Bison (parser generator) and Flex (lexical analyzer generator) files, but I can't see what went wrong. Can

I think I'm having some issues with my Bison (parser generator) and Flex (lexical analyzer generator) files, but I can't see what went wrong. Can someone help me fix this and be able to run this test file?

When I recompile my code, then use the command ./compile I get this error:

I think I'm having some issues with my Bison (parser generator) andFlex (lexical analyzer generator) files, but I can't see what went wrong.Can someone help me fix this and be able to run thistest file?When I recompile my code, then use the command ./compile Iget this error: The second project involves modifying the syntactic analyzer for

The second project involves modifying the syntactic analyzer for the attached compiler by adding to the existing grammar. The full grammar of the language is shown below. The highlighted portions of the grammar show what you must either modify or add to the existing grammar. function : function_header {variable) body function_header: FUNCTION IDENTIFIER [parameters] RETURNS type ; variable: IDENTIFIER : type IS statement parameters: parameter {, parameter} parameter: IDENTIFIER : type type : INTEGER | REAL | BOOLEAN body: BEGIN statement END ; statement : expression ; REDUCE operator {statement ) ENDREDUCE ; IF expression THEN statement ELSE statement ENDIF CASE expression IS (case) OTHERS ARROW statement ENDCASE ; operator : ADDOB | MULOP case: WHEN INT LITERAL ARROW statement expression : ( expression ) | expression binary_operator expression | NOTOP expression | INT LITERAL | REAL LITERAL | BOOL LITERAL | IDENTIFIER binary_operator: ADDOF | MULOF | REMOP | EXPOP | RELOP | ANDOP | OROB In the above grammar, the red symbols are nonterminals, the blue symbols are terminals and the black punctuation are EBNF metasymbols. The braces denote repetition 0 or more times and the brackets denote optionalYou must rewrite the grammar to eliminate the EBNF brace and bracket metasymbols and to incorporate the significance of parentheses, operator precedence and associativity for all operators. Among arithmetic operators the exponentialion operator has highest precedence following by the multiplying operators and then the adding operators. All relational operators have the same precedence. Among the binary logical operators, and has higher precedence than or. Of the categories of operators, the unary logical operator has highest precedence, the arithmetic operators have next highest precedence, followed by the relational operators and finally the binary logical operators. All operators except the exponentialion operator are left associative. The directives to specify precedence and associativity, such as spree and left, may not be used Your parser should be able to correctly parse any syntactically correct program without any problem. You must modify the syntactic analyzer to detect and recover from additional syntax errors using the semicolon as the synchronization token. To accomplish detecting additional errors an error production must be added to the function header, another to the variable declaration and a final one to the when clause of the case statement. Your bison input file should not produce any shift reduce or reduce/reduce errors. Eliminating them can be difficult so the best strategy is not introduce any. That is best achieved by making small incremental additions to the grammar and ensuring that no addition introduces any such errors. An example of compilation listing output containing syntax errors is shown below: Multiple errors function main a integer returns real; Syntax Error, Unexpected INTEGER, expecting 1 : ' 4 b: integer is * 2; Syntax Error, Unexpected MULOP c: real is 6.0; begin if a > c then b 2.0; Syntax Error, Unexpected REAL LITERAL, expecting !; " else 10 =4.; 11 endif; 12 Syntax Error, Unexpected expecting END Lexical Errors 0 Syntax Errors 4 Semantic Errors 0 You are to submit two files.lexemes lexemes.txt. Zone.Identifier listing.c listing.cc hi listing.h listing.h.gch listing.o makefile makefile makefile. Zone.Identifier parser.o parser.output hj parser.tab.h parser parser parser.y" Zone.Identifier [ scanner.C scanner scanner.I- Zone.Identifier scanner.0 syntax 1 syntax 1.txt. Zone.Identifier syntax2 syntax2.txt Zone.Identifier syntax3 syntax3.txt. Zone.Identifier syntax4 syntax4.txt Zone.Identifier syntax 5 syntax5.txt. Zone.Identifier\ftyphoon1828@GTO:~/lexical-analyzer$ make g++ -c scanner . C g++ -c parser . C g++ -c listing. cc g++ -0 compile scanner.o parser.o listing.o typhoon1828@GTO:~/lexical-analyzer$ . /compile

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 Programming Questions!