Skip to content

This is a recursive descent parser to generate JVM bytecode for a minimally defined programming language grammar using Java.

Notifications You must be signed in to change notification settings

bsaptarshi/tinypl-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tinypl-parser

This is a recursive descent parser to generate JVM bytecode for a minimally defined programming language grammar called TinyPL using Java.

Grammar for TinyPL (using EBNF notation) is as follows:

program -> decls stmts end
decls -> int idlist ;
idlist -> id { , id }
stmts -> stmt [ stmts ]
cmpdstmt-> '{' stmts '}'
stmt -> assign | cond | loop
assign -> id = expr ;
cond -> if '(' rexp ')' cmpdstmt [ else cmpdstmt ]
loop -> while '(' rexp ')' cmpdstmt
rexp -> expr (< | > | =) expr
expr -> term [ (+ | -) expr ]
term -> factor [ (* | /) term ]
factor -> int_lit | id | '(' expr ')'

Lexical: id is a single character;
int_lit is an unsigned integer;
equality operator is =, not ==

About

This is a recursive descent parser to generate JVM bytecode for a minimally defined programming language grammar using Java.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages