An open API service indexing awesome lists of open source software.

https://github.com/rgwohlbold/interpreter-ice

Java lexer, parser and interpreter for a c-style programming language
https://github.com/rgwohlbold/interpreter-ice

interpreter java lexer parser

Last synced: over 1 year ago
JSON representation

Java lexer, parser and interpreter for a c-style programming language

Awesome Lists containing this project

README

          

interpreter-ice


Description


This is a simple Java interpreter and parser, inspired by Ruslan Spivak's tutorials on writing a Pascal interpreter in Python.
The language syntax (currently named iCe) is just C without semicolons (who needs those anyway?). The interpreter currently supports arithmetic expressions and variable assignments and prints out all assigned variables.

Structure


The Program is divided into three parts:

  1. The Lexer, also called Tokenizer, reads in the Text and converts it into Tokens with defined TokenTypes.

  2. The Parser receives the Tokens from the Lexer and creates an Abstract Syntax Tree (AST)

  3. The Interpreter gets the Abstract Syntax Tree from the Parser and recursively "visits" every Node and executes the actions specified.


Links


Ruslan Spivak's tutorials