Skip to content

simonhyslop/simple-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

simple-interpreter

Interpreter for a made-up programming language.

Note: This project was for coding practice, it likely does not contain any groundbreaking new features!

Input format

The file input.txt should contain each instruction on a new line

Our simple programming language allows:

  • variables which are a single letter e.g. A
  • whole numbers e.g. -5, 0, 20
  • assignment (=) e.g. A = 5, B = A
  • addition of 2 elements e.g. B = A + 1, C = A + B
  • returning a value e.g. A, B, 20

Example operation

Input

For an example of how the input should be formatted, see input.txt.

The initial contents of the input file are:

A = 2
B = 8 + 7
C = A + B
D = C + A
D

Output

Interpreter output:
19

How to run

  • Download the repository
  • Compile the .java file and then run it
  • Check the console for the expected output above
  • Try changing the input.txt file and running again

About

Interpreter for a made-up programming language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages