Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Lex and Yacc to construct a translator from modified tiny BASIC ; the translator will parse input code according to the given grammar and

Use Lex and Yacc to construct a translator from modified tiny BASIC ; the translator will parse input code according to the given grammar and generate C/C++ code which you be able to compile and test. Note that the link describes a tiny BASIC compiler. This is a front end for a compiler, using C/C++ as intermediate code.

Modified tiny BASIC:

/* modified tiny basic - terminals in CAPS */ program ::= block block ::= block line | line line ::= INTEGER statement CR | statement CR statement ::= PRINT expr-list | IF expression relop expression THEN statement | GOTO expression | INPUT var-list | LET var = expression | GOTO expression | END expr-list ::= expr-list , expression | expression var-list ::= var-list , var | var expression ::= expression + term | expression - term | term term ::= term * factor | term / factor | factor factor ::= var | number | (expression) number ::= INTEGER | DECIMAL var ::= A | B | C .... | Y | Z relop ::= < | <= | > | >= | == | != 

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

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

d. How will lack of trust be handled?

Answered: 1 week ago

Question

Are the rules readily available?

Answered: 1 week ago