Skip to content

Technical Overview

Jose Luis Vivero edited this page Dec 13, 2016 · 1 revision

BNF

  • <Language> ::= <Code Block>

  • <Code Block> ::= "{" (({<Code Line>}?)<EndLine>*)* "}"

  • <Code Line> ::= <Statement>{;<Statement>}

  • <Statement> ::= <Declaration> | <Assignment> | <Instruction>

  • <Declaration> ::= <type> (<variable Declaration> | <Array Declaration>)

  • <Variable Declaration> ::= <String Declaration> | <Regular Declaration>

  • <Regular Declaration> ::= <Variable>

  • <String Declaration> ::= <Regular Declaration> "(" <number> ")"

  • <Array Declaration> ::= <String Array Declaration> | <Regular Array Declaration>

  • <String Array Declaration> ::= "[" <Number> "]" <String Declaration>

  • <Regular Array Declaration> ::= "[" <Number> "]" <Regular Declaration>

  • <Type> ::= "int" | "float" | "string" | "double"

  • <Variable> ::= <Alpha> <Alphanumeric> *

  • <Alpha> ::= "a"..."z"

  • <Alphanumeric> ::= <Alpha> | <Number>

  • <Number> ::= {"-"} (( "1"..."9" )* ( "." ( "0"..."9" )*)) | ( "0." ( "0"..."9" )*)

  • <assignment> ::= <Variable> "=" <Boolean Expression>

  • <Boolean Expression> ::= <\And Expression> (<Or Operator> <And Expression>)*

  • <And Expression> ::= <Not Expression> (<And Operator> <Not Expression>)*

  • <Not Expression> ::= <Not Operator> ? <Relation>

  • <Relation> ::= <Expression> (<Relational Operator> <Expression>)?

  • <Expression> ::= <Multiplication Expression>(<Add Operator> <Multiplication Expression>)*

  • <Multiplication Expression> ::= <Factor> (<Multiplication Operator> <Factor>)*

  • <Factor> ::= "(" <Expression> ")" | <variable> | <Number>

  • <Or Operator> ::= "||"

  • <And Operator> ::= "&&"

  • <Not Operator> ::= "!"

  • <Relational Operator> ::= "==" | "<" | ">" | "<=" | ">="

  • <Add Operator> ::= "+" | "-"

  • <Multiplication Operator> ::= "*" | "/"

  • <Endline> ::= LF|CRLF|EndFile

  • <instruction> ::= <if> | <while> | <for> | <print> | <read> ...

  • <if> ::= "if(" <Boolean Expression> ")" <Code Block>

  • <while> ::= "while(" <Boolean Expression> ")" <Code Block>

  • <for> ::= "for(" <Assignment> ";" <Boolean Expression> ";" <Assignment> ")" <Code Block>

  • <print> ::= "print(" <Variable> ")"

  • <read> :: = "read(" <Variable> ")"

Clone this wiki locally