CS 3150 Project
The project for this term is the implement the following project in three different languages: Java, Ada, and Python.
This project will be to write an interpreter for a minimal form of Fortran. This minimal form of Fortran has only 1 data type, integer, and the only identifiers are single letters (i.e. there are only 26 possible identifiers since fortran is not case sensitive).
The interpreter will parse the fortran program and build some intermediate data structures. These data structures will then be interpreted to execute the program. All tokens in this language are separated by white space. The parsing algorithm should detect any syntactical or semantic error. The first such error discovered should cause an appropriate error message to be printed, and then the interpreter should terminate. Run-time errors should also be detected with appropriate error messages being printed.
The Java version of the project is due at 8:00 am on Tuesday, October 1st. The Python version of the project is due at 8:00 am on Tuesday, October 29th. The Ada version is due at 8:00 am on Tuesday, December 3rd.
Grammar for the language
<program> → program id <statement_list> end program id
<statement_list> → <statement> <statement_list> | <statement>
<statement> → <assignment_statement> | <print_statement> | <do_statement> | <if_statement>
<if_statement> → if ( <boolean_expression> ) then <statement_list> else <statement_list> end if
<do_statement> → do id assignment_operator <literal_integer> , <literal_integer> <statement_list> end do
<assignment_statement> → id assignment_operator <expression>
<print_statement> → write ( <expression> )
<boolean_expression> → <relational_operator> <expression> <expression>
<relational_operator> → le_operator | lt_operator | ge_operator | gt_operator | eq_operator | ne_operator
<expression> → <arithmetic_operator> <expression> <expression> | id | literal_integer
<arithmetic_operator> → add_operator | sub_operator | mul_operator | div_operator
id → letter
literal_integer → digit literal_integer | digit
assignment_operator → =
le_operator → <=
lt_operator → <
ge_operator → >=
gt_operator → >
eq_operator → ==
ne_operator → /=
add_operator → +
sub_operator → -
mul_operator → *
div_operator → /
left_paren → (
right_parent → )