Skip to content

Welcome to the Simple Interpreted Language Parser repository! Say bye-bye to ANTLR grammar. This project is an exploration into the world of programming language development, where we've created a straightforward interpreted language and built a parser for it using the Java programming language.

Notifications You must be signed in to change notification settings

venkatasaikarthikeya/simple-interpreted-language-parser-using-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Unit 7 Assignment – A Programming Assignment Due: Oct 21, 12pm in Dropbox for Unit 7 Assignments Submit: Your source code in a pdf Counts for 50 points under “Programs” in the course grade.

In this assignment we are to do an extended version Unit 3 Assignment 2 WITHOUT the benefit of the ANTLR generated parser and lexer. That is, you must meet the requirements by creating code from scratch. Recall the sample:

LET A = 4 LET B = 5 LET C = A * B + 7 PRINT A PRINT " * " PRINT B PRINT " + 7 = " PRINTLN C

Your program should parse and execute this input as it did for Unit 3. The output was: 4*5+7=27

You may use any programming language you like except esoteric and functional. I recommend that you structure your program in a manner similar to the structure in the grammar, especially for expression evaluation. That is, create functions that mimic the operations performed in the grammar rules.

The “extended” bit is the addition of integer division to expression evaluation which you may have noticed was not in expr.g. Recall that multiplication and division has the same precedence.

A sample: LET H = 8 PRINTLN H / 2 PRINTLN 64/16

Output: 4 4

Do not use any code generated by ANTLR or any other compiler. BTW, this problem is about 60 years old. There are thousands of solutions online. But we learn by doing, not by copying. Do yourself a favor, do this on your own.

About

Welcome to the Simple Interpreted Language Parser repository! Say bye-bye to ANTLR grammar. This project is an exploration into the world of programming language development, where we've created a straightforward interpreted language and built a parser for it using the Java programming language.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages