diff_months: 2

Summer 2022 CIS524 Group project

Flat 50% Off Order New Solution
Added on: 2024-12-25 21:31:14
Order Code: SA Student Sunny IT Computer Science Assignment(6_22_27062_566)
Question Task Id: 450203
Summer 2022 CIS524 Group project

Requirements:

Write in two languages

Language 1: C or C++

Language 2: Java

Language 3: Python

Must be able to compile in a machine in our department (spirit, bach, etc)

Submit to both CSU Blackboard and grail.eecs.csuohio.edu CIS524

Each person in a group must submit; otherwise treated as "NO SUBMISSION" (0 points)

Java sample code is available at https://github.com/YalingZheng/Summer22CIS524/tree/main/Proj1

Project Description:

write a parser for a programming language that accepts the following EBNF

using the method in textbook Chapters 3 and 4

<Program1> -> (<VarDefinition> | <AssignmentStatement> | <ForStatment> ) {(<VarDefinition> | <AssignmentStatement> | <ForStatment>) }

<varDefinition> -> var <varName>;

<varName> -> (a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z){ (0|1|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z) }

<AssignmentStatement> -> <varname> = <ExpressionStatement>;

<ExpressionStatement> -> (<varname> | <constant>) { + (<varname> | <constant>) };

<constant> -> (0|1) {(0|1)}

<ForStatement> -> for ( var <AssignmentStatement> <ConditionStatement> <IncreasementStatement> ) "{"

{<AssignmentStatement>}

"}"

<ConditionStatement> -> <VarName> (">" | "<" ) <ExpressionStatement>

<IncreasementStatement> -> <varName>++;

(1) var <varname>;

<varname> -> (a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z){0|1|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z}

<varname> begins with a letter in a-z, remaining can be a-z, 0-1

var is the keyword.

Example:

var abcd001;

(2) assignment statements

<varname> = (<varname> | <constant>) { + (<varname> | <constant>) };

<constant> is an integer number in binary format, such as 000, 1000, 011000011, 111001000

example

var1 = var2 + var3 + 110 + 011 + var5;

(3) for statements

example

for (var var1=001; var1 < 11100; var1++){

myvar = myvar + var1;

}

Given a text file, if the text file follows the above format, your compiler compiles the text file successfully, and outputs

"Compilation succeeded."

Eg. run your compiler as ./MyCompiler successful-compilation-text-case-1.txt

the successful-compilation-text-case-1.txt is written as follows:

var counter;

counter = 10;

for (var index=0; index < 11100; index++){

counter = counter + index;

}

The output will be "Compilation succeeded."

Given a text file, if the text file fails the above grammar, it will point out where the exact position where the grammar is wrong.

If there are multiple places grammar is wrong, then the first position where grammar is wrong will be pointed.

It will point to the exact line and the exact column position from the line that is incorrect.

Eg. run your compiler as ./MyCompiler unsuccessful-compilation-text-case-1.txt

the unsuccessful-compilation-text-case-1.txt is written as follows:

var counter;

counter = 93

for (var index=0; index < 11100; index++){

counter = counter index;

}

Your program will output

Line 2, column 11, incorrect grammar

Compilation failed.

Eg. run your compiler as ./MyCompiler unsuccessful-compilation-text-case-2.txt

the unsuccessful-compilation-text-case-2.txt is written as follows:

var counter;

counter = 11;

for (var index=0; index 11100; index++){

counter = counter index;

}

Your program will output

Line 3, column 25, incorrect grammar

Compilation failed.

Eg. run your compiler as ./MyCompiler unsuccessful-compilation-text-case-3.txt

the unsuccessful-compilation-text-case-3.txt is written as follows:

var counter;

counter = 11;

for (var index=0; index < 11100; index++){

counter = counter index;

}

Your program will output

Line 4, column 23, incorrect grammar

Compilation failed.

  • Uploaded By : Pooja Dhaka
  • Posted on : December 25th, 2024
  • Downloads : 0
  • Views : 59

Order New Solution

Can't find what you're looking for?

Whatsapp Tap to ChatGet instant assistance

Choose a Plan

Premium

80 USD
  • All in Gold, plus:
  • 30-minute live one-to-one session with an expert
    • Understanding Marking Rubric
    • Understanding task requirements
    • Structuring & Formatting
    • Referencing & Citing
Most
Popular

Gold

30 50 USD
  • Get the Full Used Solution
    (Solution is already submitted and 100% plagiarised.
    Can only be used for reference purposes)
Save 33%

Silver

20 USD
  • Journals
  • Peer-Reviewed Articles
  • Books
  • Various other Data Sources – ProQuest, Informit, Scopus, Academic Search Complete, EBSCO, Exerpta Medica Database, and more