Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

First, carefully read the first three sections of the GCC Frontend HOWTO to learn the basics of building lexers and parsers. The first complete example

image text in transcribed

First, carefully read the first three sections of the GCC Frontend HOWTO to learn the basics of building lexers and parsers. The first complete example in this tutorial is to build a simple calculator capable of "+*/" operations. Your task is very simple. Extend the example in the tutorial by including parentheses in your grammar. For example, your new parser should able to resolve that (12+4)*s will be 80 Your executable should be named calc . The parser as given in the example will accept input from stdin, prints the parsed value, and waits for next input (you perhaps need to manually terminate the program using ctrl-c )In order to test your program you can either use it in the interactive mode or pipe your input to it. The latter is how we will test your program. For example: echo "(12+4)*5" | -/calc The contents of your project should be calc.: the input file to flex calc.y the input file to bison makefile : including at least the following targets: o calc (default target): build the executable file calc o lex.yy.o : compiles lex.yy.c which is the result of running flex on your input o calc.tab.o compiles calc.tab.c which is the result of running bison on your input o clean: delete all but your input files and makefile First, carefully read the first three sections of the GCC Frontend HOWTO to learn the basics of building lexers and parsers. The first complete example in this tutorial is to build a simple calculator capable of "+*/" operations. Your task is very simple. Extend the example in the tutorial by including parentheses in your grammar. For example, your new parser should able to resolve that (12+4)*s will be 80 Your executable should be named calc . The parser as given in the example will accept input from stdin, prints the parsed value, and waits for next input (you perhaps need to manually terminate the program using ctrl-c )In order to test your program you can either use it in the interactive mode or pipe your input to it. The latter is how we will test your program. For example: echo "(12+4)*5" | -/calc The contents of your project should be calc.: the input file to flex calc.y the input file to bison makefile : including at least the following targets: o calc (default target): build the executable file calc o lex.yy.o : compiles lex.yy.c which is the result of running flex on your input o calc.tab.o compiles calc.tab.c which is the result of running bison on your input o clean: delete all but your input files and makefile

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

Students also viewed these Databases questions

Question

Differentiate between hard and soft measures of service quality.

Answered: 1 week ago

Question

Be familiar with the different perspectives of service quality.

Answered: 1 week ago