Skip to content

oebelus/Language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 

Repository files navigation

<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> )*

About

Trying to make a Language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages