Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE HELP. The lex and yacc file is attached. In this labwork, you will implement a lex/yacc program that will accept map initialization statements. -

image text in transcribed

image text in transcribed

image text in transcribed

PLEASE HELP. The lex and yacc file is attached.

In this labwork, you will implement a lex/yacc program that will accept map initialization statements. - A map initialization starts with the name of map and continues with a list that contains key/value pairs denoted with \{"str", number\}. - Be careful, there can be countless numbers of key/value pairs in a list. - Your program should accept only the correct inputs and reject the others - In addition, you should detect missing "," symbol between key and value. letter [A2az] su Anclude (stdlo.hs \#include (string. h ) "include "y.tab. h" Include f " return OCB; j - return CCB; "." return EQUAL; \" [a2Az]+1" return staing; [09]+ return INTEGER; (letter) (\{letter\}|(digit\})" return IoentIfIER; in \{IInenum ++;} [lt]+ 88 8 *include ciostreas anclude // use varlable 11 nenue froe the lex flle int nap(ount-1; int count-8; 8) Xtoken cown SERTCOLON OCB CCB Equal STRING INTEGER IDENTIFIER 8s void yyerror(string s) ( \} cerres"Error at line: "eslinenumceendl; int yyerap() return 1; \} int main(int argc, char *argv[1) t /* Call the lexer, then quit. "/ yyln=fopen (argv[1], "r"); yyparse (): felose(yyin); return 0

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

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions

Question

2. How will you handle the situation?

Answered: 1 week ago