Question
Design and implement tokens and analyzer that executes the code written in LAO language. The statements in LAO language are: ::= REM | REM ::=
Design and implement tokens and analyzer that executes the code written in LAO language. The statements in LAO language are:
::= REM | REM ::= = ::= PRINT | PRINT | PRINT | PRINT ::= READ ::= IF THEN ::= END.
Where:
A conditional expression must include logical or relational operators. Examples:
- 3 .gt. 5
- .not. 3 .gt. 5
- 3 .gt. 5 .and. 3 .eq. var
- .not. 3 .gt. 5 .and. 3 .eq. var
The keywords are reserved words. They are: IF, THEN, READ, PRINT, and END. In addition, the language is not case sensitive. An instruction with only the keyword PRINT is equivalent to a new line when the instruction is executed by the interpreter. Moreover, the interpreter will ignore the comments statements.
The alphabet of the language is the characters in the ASCII table. Additionally, the type of a variable is determined by the first letter of the variable name. The following table shows the previous:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started