Question: In this programming assignment, you will be building a lexical analyzer for small programming language and a program to test it. This assignment will be

 In this programming assignment, you will be building a lexical analyzer

for small programming language and a program to test it. This assignment

will be followed by two other assignments to build a parser and

interpreter to the same language. Although, we are not concerned about the

syntax definitions of the language in this assignment, we intend to introduce

In this programming assignment, you will be building a lexical analyzer for small programming language and a program to test it. This assignment will be followed by two other assignments to build a parser and interpreter to the same language. Although, we are not concerned about the syntax definitions of the language in this assignment, we intend to introduce it ahead of Programming Assignment 2 in order to show the language reserved words, constants, and operators. The syntax definitions of a Fortran-Like small programming language are given below using EBNF notations. The details of the meanings (i.e. semantics) of the language constructs will be given later on. Prog = PROGRAM IDENT {Decl} {Stmt} END PROGRAM IDENT Decl Type : VarList Type = INTEGER | REAL CHAR Varlist = Var {, Var) Stmt = Assigstmt | Ifstmt | Printstmt ReadStmt PrintStmt := PRINT, ExprList IfStmt = IF (LogicExpr) THEN {Stmt} END IF AssignStmt = Var = Expr ReadStmt = READ , VarList Exprlist Expr {, Expr} Expr Term { (+/-) Term} Term = SFactor {(*1/) SFactor} SFactor = Sign Factor | Factor LogicExpr = Expr (== |

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!