Skip to content

qoqosz/Interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple calculator using integer numbers. Based on the original tutorial: Let's Build A Simple Interpreter.

Supported grammar:

factor : (PLUS | MINUS) factor | INTEGER | LPAREN expr RPAREN

term : factor ((MUL | DIV) factor)*

expr : term ((PLUS | MINUS) term)*

Sample output with debug info:

>> 4+(12*5 / (2 + 1))
[Debug] tokens read:
Integer(4)
Add
LParen
Integer(12)
Mul
Integer(5)
Div
LParen
Integer(2)
Add
Integer(1)
RParen
RParen
=24

About

Simple calculator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages