Skip to content

A simple handwritten LL(1) compiler based on the dragon book

Notifications You must be signed in to change notification settings

magnetenstad/dragon-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dragon-compiler

Lexical Analysis

Tokens

literal     -> ".*"
number      -> [0-9]+
identifier  -> [a-zA-Z]+
operator    -> = | < | > | * | / | + | - | <= | >= | == | !=

print       -> print

Syntax Analysis

BNF Grammar

program     -> blocks

blocks      ->
    block blocks
  | block

block       ->
  { blocks }
  { statements }

statements  ->
    statement statements
  | statement

statement   ->
    identifier = expression
  | print expression
  | # expression
  | struct block

expression  ->
    ( expression operator expression )
  | number
  | literal
  | identifier

About

A simple handwritten LL(1) compiler based on the dragon book

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages