Beruflich Dokumente
Kultur Dokumente
A statement can assume any of the following two possible forms: if (Expr Lop Expr) then { assignmentStatement; assignmentStatement; } if (Expr Lop Expr) then { AssignStatement; AssignStatement; } else { AssignStatement; AssignStatement; } Identifier = Expr
An Identifier: a string of lower-case letters. Expr is an algebraic expression such as: Identifier /( Identifier - Identifier ) Identifier - Identifier * Identifier +
The following is example of the (suggested) tokens of the language tokenCo de 1001 1002 tokenID ifTok Lparen tokenLex if (
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016
Rparen equalsTok gtTok ltTok thenTok lBrace rBrace semicTok assignTok elseTok plusTok minusTok multTok divTok geTok leTok idTok
a) Develop a CFG grammar for the language of Function b) Develop a left linear regular grammar for the language (if not possible, you may modify the language slightly to make it possible). c) Develop a scanner (lexical analyzer) for a Function.