program = toplv*
toplv = typ ident ("(" (typ ident ("," typ ident)*)? ")" "{" stmt* "}" | ("[" num "]")* ";")
stmt = expr ";"
| "{" stmt* "}"
| "if" "(" expr ")" stmt ("else" stmt)?
| "while" "(" expr ")" stmt
| "for" "(" expr? ";" expr? ";" expr? ")" stmt
| "return" expr ";"
| typ ident ("[" num "]")* ";"
expr = assign
assign = equality ("=" assign)?
equality = relational ("==" relational | "!=" relational)*
relational = add ("<" add | "<=" add | ">" add | ">=" add)*
add = mul ("+" mul | "-" mul)*
mul = unary ("*" unary | "/" unary)*
unary = "+"? primary
| "-"? primary
| "&" unary
| "*" unary
| "sizeof" unary
| primary "[" expr "]"
primary = num
| ident ("(" (expr ("," expr)*)? ")")?
| "(" expr ")"
typ = ("int" | "char") "*"*
-
Notifications
You must be signed in to change notification settings - Fork 1
Yet another C compiler for x86
License
kafumi/9cc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Yet another C compiler for x86
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published