Question: For this assignment, you will use FLex or Lex for the lexical part of the task and Yacc or Bison for writing a parser for

 For this assignment, you will use FLex or Lex for the

For this assignment, you will use FLex or Lex for the lexical part of the task and Yacc or Bison for writing a parser for a simple language described as: Consider the CFG that defines a simple expression. E int +E int E (E) int We want to read expressions and generate codes for this language using the MIPS processor's assembly language, assuming a stack evaluation model. For example, the generated code for the expression 5+7 shou be li $a05 sw $a00($sp) addiu $ sp \$sp -4 li $a07 Iw $t14($sp) add $a0$t1$a0 addiu $ sp \$sp -4 Your work results in a C program that can take expressions written in the above language and produce the relevant code. For example, for input 5+7, it generates the above MIPS code. You will use FLex to capture the tokens of the language. And Yacc or Bison to parse and generate code for valid expressions. Hint: There are lots of online resources on Flex/lex including tutorials on youtube. See for example (709) Part 01: Tutorial on lex/vacc- YouTube Part 02: Tutorial on lex/yacc. - YouTube Due Date for part Sat 11 Feb. 2023

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!