Skip to content
/ lilc Public

A hand-written compiler for a small, C-like language, built on LLVM

Notifications You must be signed in to change notification settings

gw/lilc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lilc

A hand-written compiler for a small, C-like language, targeting LLVM and built for learning purposes.

Grammar

Just for reference, as the parser is implemented by hand. Nonterminals defined in token.h

program => block
block => expr_stmt+
expr_stmt =>
    expr SEMI
funcdef =>
    DEF ID LPAREN ID {COMMA ID} RPAREN LCURL expr RCURL
call =>
    ID LPAREN expr{,expr} RPAREN
expr =>
    expr ADD term |
    expr SUB term |
    term          |
    call          |
    funcdef
term =>
    term MUL factor |
    term DIV factor |
    factor
factor =>
    DBL{DBL} |
    LPAREN expr RPAREN

Start Symbol: program

About

A hand-written compiler for a small, C-like language, built on LLVM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published