For this phase, you will use Lex tool for writing the scanner and Yacc tool for writing the parser for a programming language called AA.
– Logic: &&,||,!
– Relational: ==, <>, <, <=, >,>=
The table below shows all AA operators from highest to lowest precedence, along with their associativity.
Table 1: precedence and associativity table
Operator |
Description |
Associativity |
! |
Unary Logical NOT |
right to left |
∗/ |
Multiplication/Division |
left to right |
+− |
Addition/ Subtraction |
left to right |
<, <=, >,>= |
Relational |
left to right |
=<> |
Equality |
left to right |
&& |
Logical AND |
left to right |
|| |
Logical OR |
left to right |
= |
Assignment |
right to left |
Identifiers: should start with capital letter and can include small, capital letters, underscores, or digits.
Literals: INT LITERAL e.g. 12345, STRING LITERAL e.g. "Hello"and DBL LITERAL e.g. 3.14.
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:
Write the Lex and Yacc file for AA language as described above. Once you built your parser, you should be able to parse AA programs. If you want to test your code, consider the following program.
This program should be compiled and have no errors. Note that this program does not cover all functionalities that could be tested based on the given specification. Test your code thoroughly. If the input program is in different syntax than the given grammar, your parser should report an error.
You must deliver one zip including:
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme