<program> := <declaration>* EOF
<declaration> := <varDeclaration> | <funcDeclaration> | <statement>;
<funcDeclaration> := "function" <TYPE> <function>;
<varDeclaration> := <TYPE> <IDENTIFIER> ("=" expression>)? ";"
<statement> := <expressionStatement> | <printStatement> | <block> | <ifStatement> | <whileStatement | forStatement
<expressionStmt> := <expression> ";"
<print> := "log" <expression> ";"
<block> := "{" + <declaration> + "}"
<expression> := <assignment>
<assignment> := <IDENTIFIER> "=" <assignment> | <logicOr>
<logicOr> := <logicAnd> ( "or" <logicAnd> )
<logicAnd> := <equality> ( "or" <equality> )
<equality> := <comparison> ( ( "!=" | "==" ) <comparison> )*
<comparison> := <term> ( ( ">" | ">=" | "<" | "<=" ) <term> )*
<term> := <factor> ( ( "-" | "+" ) <factor> )*
<factor> := <unary> ( ( "/" | "*" | "%" ) <unary> )*
<unary> := ( "-" | "!" ) <unary> | <call>
<primary> := <NUMBER> | <STRING> | "true" | "false" | "nil" | "(" <expression> ")" | <IDENTIFIER>
<ifStatement> := "if" "(" <expression> ")" <statement> ( "else" <statement> )?
<whileStatement> := "while" "(" <expression> ")" <statement>
<forStatement> := "for" "(" ( <varDeclaration> | <expressionStatement> | ";" ) <expression>? ";" <expression>? ")" <statement>
<call> := <IDENTIFIER> ( "(" <arguments>? ")" )*
<function> := <IDENTIFIER> "(" <parameters>? ")" <block>;
<arguments> := <IDENTIFIER> ( "," <IDENTIFIER> )*
<parameters> := <type> <IDENTIFIER> ( "," <type> <IDENTIFIER> )*
-
Notifications
You must be signed in to change notification settings - Fork 0
oebelus/Language
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Trying to make a Language
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published