Programming Languages and Compilers - IT Assignment Help

Download Solution Order New Solution
Assignment Task:

1  AA Language
For this phase, you will use the Lex tool for writing the scanner and Yacc tool for writing the parser for a programming language called AA.

The Parser and the Grammar: 

When YACC finds input that doesn’t match the grammar, it automatically termi- nates with the message ’Syntax error’. You will need to implement an error routine (yyerror) that also prints out the line number before this termination, and a main method that read AA code from a file. Print an appropriate message in case of no syntax error. Build your parser using the grammar below: 

• Start→ Program START Statements END 

• Statements → Statements Statement| Statement 

• Statement→ Dec stmt | Assignment stmt | Print stmt | Read stmt | Condition stmt | While stmt 

 Dec stmt→ Type ID |Type ID,IDList 

• IDList → ID | ID,IDList 

• Type→ int | double 

• Assignment stmt→ID = Expression 

• Expression → exp == exp | exp <> exp | exp < exp | exp <= exp| exp >= exp | exp >= exp | exp 

• exp→ exp + exp | exp - exp| exp * exp | exp /exp | exp || exp | exp && exp | !exp | Factor 

• Factor→ ( exp )| INT LITERAL | DBL LITERALL | ID 

• Print stmt→ print ( ID ) | print ( STRING LITERAL ) 

 Read stmt→ ID = read ( ) 

• Condition stmt→ if (Expression ) statements 

• While stmt→ while ( Expression ) statements

This IT Assignment has been solved by our IT Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.