subject

1. Must produce a lex/yacc-based compiler that compiles the example program into assembly code that gcc accepts and can produce an executable from. You may or may not have any separate C source files; this assignment is still small enough that all you might have is your lex and yacc input source files. 2. Your compiler must also correctly compile similar programs as the above, with multiple functions defined, and multiple function call statements inside a function body.
3. You must have a Makefile that compiles your program. For all C compiling, including the output of the lex and yacc commands, it must use -Wall as a compilation flag. It must have a "clean" target that removes all auto-generated files, including those from lex and yacc. It must have a "test" target that invokes your mini-compiler program on an example source file, then invokes gcc on your resulting assembly source file, and then runs the resulting executable file.
4. Your code must have zero warnings under the -Wall flag usage.
5. Submit a zip file with your lex, yacc, and C source files (not generated ones), and your Makefile and the test program referred to in your "test" target.
That's it!
Hints and Help
Above the rules section in your yacc source file, you will want to have something like this:
/* token value data types */
%union { int ival; char* str; }
/* Starting non-terminal */
%start prog
%type function statements statement funcall
/* Token types */
%token cival> NUMBER COMMA SEMICOLON LPAREN RPAREN LBRACE RBRACE
%token ID STRING

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:40
Respecting individual differencespre-test active2time remaining48: 47nina is exploring her gender identity and sexual orientationwhich best describes how the role of the media might influence nina during this time in her life? the media would her decide because television shows are always unbiased about gender issues and do notstereotypethe media could make things difficult for her because television sometimes portrays rigid ideas about gender roles.all forms of media will her decide because the media always portrays rigid ideas about gender roles.all forms of media will make things easy for her because the media always portrays open and fair ideas about gender roles.
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
You need a quick answer from a coworker. the most effective way to reach your coworker is through a. cloud server b. instant message c. teleconference d. telepresence
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Jake really works well with numbers and is skilled with computers but doesn't work well with others. which of the jobs discussed in this unit might be best for jake? why?
Answers: 3
question
Computers and Technology, 24.06.2019 07:20
Ingrid started speaking about her slide presentation. when she clicked to th"third slide, which had just a picture of an elephant, she forgot what she wassupposed to talk about. what could ingrid do to avoid this situation in thefuture? oa. print handouts for her audience.ob. add presenter's notes to each slide.oc. add a video to each slide.od. save her slide presentation to a flash drive
Answers: 2
You know the right answer?
1. Must produce a lex/yacc-based compiler that compiles the example program into assembly code that...
Questions
question
Mathematics, 28.01.2020 14:04
Questions on the website: 13722363