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-z | A-Z

::= |

::= | < unsign integer>

::= |

::= |

::=

::= .

::=

::= e | E

::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

::= + | -

::= "" | ""

::=

::= .gt. | .lt. | .eq. | .ge. | .le. | .ne.

::= .or. | .and. | .not.

::= | |

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!