Skip to content

interpreter for the Lox programming language implemented in Java

License

Notifications You must be signed in to change notification settings

peshala-prabhapoorna/jlox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jlox

Interpreter for the Lox programming language implemented in Java.
Implementation of the interpreter follows guidelines provided by the book
Crafting Interpreters written by
Robert Nystorm. jlox - sta

grammar

program        → declaration* EOF ;
declaration    → varDecl | statement ;
statement      → exprStmt | printStmt | block ;
block          → "{" declaration* "}" ;
varDecl        → "var" IDENTIFIER ("=" expression)? ";" ;
exprStmt       → expression ";" ;
printStmt      → "print" expression ";" ;
expression     → assignment ;
assignment     → IDENTIFIER "=" assignment | comma ;
comma          → conditional ( "," conditional )* ;
conditional    → equality ( "?" expression ":" conditional )? ;
equality       → comparison ( ( "!=" | "==" ) comparison )* ;
comparison     → term ( ( ">" | ">=" | "<" | "<=" ) term )* ;
term           → factor ( ( "-" | "+" ) factor )* ;
factor         → unary ( ( "/" | "*" ) unary )* ;
unary          → ( "!" | "-" ) unary
               | primary ;
primary        → NUMBER | STRING | "true" | "false" | "nil"
               | "(" expression ")"
               | IDENTIFIER
               // Error productions...
               | ( "!=" | "==" ) equality
               | ( ">" | ">=" | "<" | "<=" ) comparison
               | ( "+" ) term
               | ( "/" | "*" ) factor ;

About

interpreter for the Lox programming language implemented in Java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published