Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This project will be to write an interpreter for a minimal form of Julia in Java. This minimal form of Julia has only 1 data

This project will be to write an interpreter for a minimal form of Julia in Java. This minimal form of Julia has only 1 data type, integer, and the only identifiers are single letters.

The interpreter will parse a Julia 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.

Grammar for the (subset of SCL) language

function id ( ) end

|

| | | |

if else end

while end

-> id

-> for id = end

print ( )

:

le_operator | lt_operator | ge_operator | gt_operator | eq_operator | ne_operator

| |

add_operator | sub_operator | mul_operator | div_operator | mod_operator | exp_operator | rev_div_operator

Lexical Analyzer

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 /

mod_operator %

rev_div_operator \

exp_operator ^

These are the sample code for the project, and it is based on modified example 3.4

modified grammar: http://ksuweb.kennesaw.edu/~dgayler/cs4308/examples/text_grammar/modified%20grammar.html

Sample code: http://ksuweb.kennesaw.edu/~dgayler/cs4308/examples/text_grammar/java_code/?s=n&d=d

test program: http://ksuweb.kennesaw.edu/~dgayler/cs4308/examples/project_test_programs/

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

LO1 Understand human resource management and define human capital.

Answered: 1 week ago