CSCE 4430 ASSIGNMENT #2
Consider the extended BNF grammar for Clite, extended with function definitions, and function calls as a statement (returning a void type) as an expression (returning a value type). We will call this language CliteF.
Program ::= { Function } int main ( ) { Declarations Statements }
Function ::= FunctionType Identifier ( [ FormalParameters ] )
{ Declarations Statements return Expression ; }
FunctionType ::= ValueType | void
ValueType ::= int | bool | float | char
FormalParameters ::= ValueType Identifier [ [ ] ] { , ValueType Identifier [ [ ] ] }
Declarations ::= { Declaration }
Declaration ::= ValueType Identifier [ [ Integer ] ] { , Identifier [ [ Integer ] ] }
Statements ::= { Statement }
Statement ::= ; | Block | Assignment | IfStatement | WhileStatement | ProcedureCall Block ::= { Statements }
Assignment ::= Identifier [ [ Expression ] ] = Expression ; IfStatement ::= if ( Expression ) Statement [ else Statement ] WhileStatement ::= while ( Expression ) Statement ProcedureCall ::= FunctionCall ;
FunctionCall ::= Identifier ( [ ExpressionList ] ) ExpressionList ::= Expression { , Expression } Expression ::= Conjunction { || Conjunction } Conjunction ::= Equality { && Equality } Equality ::= Relation [ EquOp Relation ]
EquOp ::= == | !=
Relation ::= Addition [ RelOp Addition ]
RelOp ::= < | <= | > | >=
Addition ::= Term { AddOp Term }
AddOp ::= + | -
Term ::= Factor { MulOp Factor }
MulOp ::= * | / | %
Factor ::= [ UnaryOp ] Primary
UnaryOp ::= - | !
Primary ::= Identifier [ [ Expression ] ] | Literal | ( Expression ) | FunctionCall
| ValueType ( Expression )
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of