/interpreter

A simple interpreter written in javascript

Primary LanguageJavaScriptMIT LicenseMIT

interpreter

A small interpreter built in nodejs. Because why not ?

How to launch

To interpret a source code file just pass it to main.js like this:

node main expr

If you made changes to the project and want to check if you didn't break everything in the process, just type:

node test

Current state of the project

  • General

    • Error handling
    • Scopes
    • Code blocks
    • Variables and identifiers
    • Multiple instructions
    • If/else branching
    • Loops (do..while/while/for)
    • Custom functions
  • Mathematical expressions

    • Base operators (+-*/)
    • Operator predecence
    • Parenthesis
    • Nested parenthesis
    • Floating point numbers
    • Modulo operator
    • Power operator
    • Variables
    • Logical operators
    • Comparison operators
    • Binary operators
    • Increment and decrement
    • Operation and assignment operators
    • Math functions call (cos/sin/tan)
    • Post increment and decrement