cubescript.atg (928B)
1 COMPILER CubeScript2 2 3 CHARACTERS 4 5 cr = '\r'. 6 lf = '\n'. 7 printable = '\u0020'..'\u007e'. 8 eol = ';' + cr + lf. 9 blocks = "()[]". 10 11 strch = ANY - cr - lf - '"'. 12 wordch = printable - '"' - blocks - eol - ' '. 13 14 TOKENS 15 16 string = '"' { strch | '^' printable } '"'. 17 word = wordch { wordch }. 18 newline = eol. 19 20 COMMENTS FROM "//" TO cr 21 COMMENTS FROM "//" TO lf 22 /* not currently supported by engine */ 23 COMMENTS FROM "/*" TO "*/" 24 25 IGNORE '\t' + ' ' 26 27 PRODUCTIONS 28 29 CubeScript2 = 30 statement 31 { 32 statement 33 } 34 . 35 36 identifier = word | string . 37 statement = 38 identifier 39 | ( "alias" identifier ( identifier | block ) newline ) 40 | block 41 | newline 42 . 43 44 block = code_block | priority_block . 45 46 /* execution delayed at end of block, mostly used to define "code blocks" */ 47 code_block = '[' { statement } ']' . 48 49 /* immediate execution, mostly used for priority/calls */ 50 priority_block = '(' { statement } ')' . 51 52 END CubeScript2 .