@node Language Specification @chapter Specification @section Introduction This document specifies the semantics and behavior of the O Programming Language for compiler designers be informed how the language is designed. This specification is a DRAFT and will be the discussions drive over olang-dev mailing list. @section Language Syntax This is the O Programming Language EBNF grammar specification[^1] [^1]: EBNF variant https://github.com/Engelberg/instaparse/tree/v1.4.12 and live test can be accessed here https://mdkrajnak.github.io/ebnftest/ NOTE: This grammar spec is a DRAFT and it covers only a small portion of the language. @verbatim (* Entry Point *) ::= ( ( | ))* (* Translation Unit *) ::= | (* Variables *) ::= 'var' ':' ? ::= 'const' ':' ::= ::= '=' (* Functions *) ::= 'fn' '(' ( | ) ')' ':' ::= ::= ':' ( ',' )* ::= ::= ::= '{' ( )* ? '}' ::= ( ',' )* ::= '(' ( | ) ')' ::= | | | | ::= 'if' ( 'else' ( | ) )? ::= 'while' ::= 'return' (* Statements *) ::= ';' | ::= | ::= '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' (* Expressions *) ::= ::= ::= ( '||' )* ::= ( '&&' )* ::= ( '|' )* ::= ( '^' )* ::= ( '&' )* ::= ( ('==' | '!=') )* ::= ( ('<' | '>' | '<=' | '>=') )* ::= ( ('<<' | '>>') )* ::= ( ('+' | '-') )* ::= ( ('*' | '/' | '%') )* ::= ( )* ::= | | | | '(' ')' ::= ::= '&' | '*' | '+' | '-' | '~' | '!' (* Identifiers *) ::= 'u32' ::= ( | '_') ( | | '_')* (* Literals *) ::= | ::= #'[1-9]' ( | '_')* | '0' ::= #'0[Xx]' ( | '_')* (* Utilities *) ::= + ::= * ::= | ::= #'[\n\v\f\r]' | '\r\n' ::= #'[ \t]' ::= #'[a-zA-Z]' ::= #'[0-9]' ::= | #'[a-fA-F]' ::= #'$' @end verbatim