"Name" = 'Homer Demo Grammar' "Version" = 'Made in 2010' "Author" = 'Leith Ketchell' "About" = 'Example: OA32 Object Definitions' "Case Sensitive" = True "Start Symbol" = {Hex Digit} = {Digit} + [abcdefABCDEF] {Oct Digit} = [01234567] {Id Head} = {Letter} + [_] {Id Tail} = {Id Head} + {Digit} {String Ch} = {Printable} - ["] {Char Ch} = {Printable} - [''] DecLiteral = [123456789]{digit}* OctLiteral = 0{Oct Digit}* HexLiteral = 0x{Hex Digit}+ FloatLiteral = {Digit}*'.'{Digit}+ StringLiteral = '"'( {String Ch} | '\'{Printable} )* '"' CharLiteral = '' ( {Char Ch} | '\'{Printable} )'' Id = {Id Head}{Id Tail}* ! =================================================================== ! Comments ! =================================================================== Comment Start = '/*' Comment End = '*/' Comment Line = '//' ! Typically, C comments cannot be nested. As a result, the ! Comment Start and Comment End terminals cannot be used. ! ! To implement non-nested comments, the whitespace terminal is ! modified to accept them. In the definition below, Whitespace ! is defined as one or more {Whitespace} characters OR a series ! of characters delimited by /* and */. Note that the characters ! between the two delimiters cannot contain the */ sequence. ! ! Uncomment the following to prevent block commments. Make sure ! to comment the Comment Start and Comment End definitions. ! ! {Non Slash} = {Printable} - [/] ! {Non Asterisk} = {Printable} - [*] ! ! Whitespace = {Whitespace}+ ! | '/*' ( {Non Asterisk} | '*' {Non Slash}? )* '*/' !======================================================= !================================================================= ! Decls is our Start Symbol. ! = Declaration of some 'highlevel construct' (contextual) ! or just a block of statements not part of any such 'construct' (context-free). !================================================================= ::= | ::= | | | | | | | !OA32 Object Declaration | !Any block of colon-delimited statements surrounded by curly braces | !Any block of Directive(s) with/without ';' delimiter ::= ';' ! One or more Colon-delimitied Directives | !======================================================= ! Object Class Definition !======================================================= ::= ::= Object ',' ',' ::= ObjectEnd | ObjectEnd !One or more Object Definition Statements ::= | !Object Definition Statement ::= | DefineVariable | Embed Id !Object Method and Variable definitions ::= ',' | Id ::= Id ',' ',' dup '{<>}' | Id ',' | Id !Method Types ::= StaticMethod | DynamicMethod | AbstractMethod !Interesting Fields , make life easier on our interpreter ::= Id ::= ::= Id ::= Id !One or more comma-delimited ::= ',' | ! =================================================================== ! Function Declaration ! =================================================================== ::= '(' ')' ';' | '(' ')' ';' | '(' ')' ';' ::= '(' ')' | '(' ')' | '(' ')' ::= ',' | ::= const ID | ID ::= ',' | ::= Id ',' | Id ::= ID | ID ! =================================================================== ! Type Declaration ! =================================================================== ::= typedef ID ';' ::= struct Id '{' '}' ';' ::= union Id '{' '}' ';' ::= | ! =================================================================== ! Variable Declaration ! = static ! =================================================================== ::= ';' | ';' | ';' ::= ID | ID '=' ::= '[' ']' | '[' ']' | ::= ',' | ::= ::= extern | static | register | auto | volatile | const ! =================================================================== ! Enumerations ! =================================================================== ::= enum Id '{' '}' ';' ::= ',' | ::= Id | Id '=' OctLiteral | Id '=' HexLiteral | Id '=' DecLiteral ! =================================================================== ! Types ! =================================================================== ::= ::= | | struct Id | struct '{' '}' | union Id | union '{' '}' | enum Id ::= byte | word | dword | qword | tword | void ::= sbyte | sword | sdword | sqword | stword ::= '*' | ! ====================================================================================== ! = Variable declaration, opcode, label, 'if/while/for' or Normal Statement ! ======================================================================================= ::= | ';' |