2 ".emtcode DECLARATION_END 0\n"
3 ".emtcode DECLARATION_EMITCODE 1\n"
4 ".emtcode DECLARATION_ERRORTEXT 2\n"
5 ".emtcode DECLARATION_REGBYTE 3\n"
6 ".emtcode DECLARATION_LEXER 4\n"
7 ".emtcode DECLARATION_RULE 5\n"
8 ".emtcode SPECIFIER_END 0\n"
9 ".emtcode SPECIFIER_AND_TAG 1\n"
10 ".emtcode SPECIFIER_OR_TAG 2\n"
11 ".emtcode SPECIFIER_CHARACTER_RANGE 3\n"
12 ".emtcode SPECIFIER_CHARACTER 4\n"
13 ".emtcode SPECIFIER_STRING 5\n"
14 ".emtcode SPECIFIER_IDENTIFIER 6\n"
15 ".emtcode SPECIFIER_TRUE 7\n"
16 ".emtcode SPECIFIER_FALSE 8\n"
17 ".emtcode SPECIFIER_DEBUG 9\n"
18 ".emtcode IDENTIFIER_SIMPLE 0\n"
19 ".emtcode IDENTIFIER_LOOP 1\n"
20 ".emtcode ERROR_NOT_PRESENT 0\n"
21 ".emtcode ERROR_PRESENT 1\n"
22 ".emtcode EMIT_NULL 0\n"
23 ".emtcode EMIT_INTEGER 1\n"
24 ".emtcode EMIT_IDENTIFIER 2\n"
25 ".emtcode EMIT_CHARACTER 3\n"
26 ".emtcode EMIT_LAST_CHARACTER 4\n"
27 ".emtcode EMIT_CURRENT_POSITION 5\n"
28 ".errtext INVALID_GRAMMAR \"internal error 2001: invalid grammar script\"\n"
29 ".errtext SYNTAX_EXPECTED \"internal error 2002: '.syntax' keyword expected\"\n"
30 ".errtext IDENTIFIER_EXPECTED \"internal error 2003: identifier expected\"\n"
31 ".errtext MISSING_SEMICOLON \"internal error 2004: missing ';'\"\n"
32 ".errtext INTEGER_EXPECTED \"internal error 2005: integer value expected\"\n"
33 ".errtext STRING_EXPECTED \"internal error 2006: string expected\"\n"
35 " grammar_1 .error INVALID_GRAMMAR;\n"
37 " optional_space .and \".syntax\" .error SYNTAX_EXPECTED .and space .and identifier .and\n"
38 " semicolon .and declaration_list .and optional_space .and '\\0' .emit DECLARATION_END;\n"
42 " single_space .and .loop single_space;\n"
44 " white_char .or comment_block;\n"
46 " ' ' .or '\\t' .or '\\n' .or '\\r';\n"
48 " '/' .and '*' .and comment_rest;\n"
50 " .loop comment_char_no_star .and comment_rest_1;\n"
52 " comment_end .or comment_rest_2;\n"
54 " '*' .and comment_rest;\n"
55 "comment_char_no_star\n"
56 " '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n"
60 " identifier_ne .error IDENTIFIER_EXPECTED;\n"
62 " first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit '\\0';\n"
64 " 'a'-'z' .or 'A'-'Z' .or '_';\n"
66 " first_idchar .or digit_dec;\n"
70 " optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;\n"
72 " declaration .and .loop declaration;\n"
74 " emitcode_definition .emit DECLARATION_EMITCODE .or\n"
75 " errortext_definition .emit DECLARATION_ERRORTEXT .or\n"
76 " regbyte_definition .emit DECLARATION_REGBYTE .or\n"
77 " lexer_definition .emit DECLARATION_LEXER .or\n"
78 " rule_definition .emit DECLARATION_RULE;\n"
79 "emitcode_definition\n"
80 " \".emtcode\" .and space .and identifier .and space .and integer .and space_or_null;\n"
82 " integer_ne .error INTEGER_EXPECTED;\n"
84 " hex_integer .emit 0x10 .or dec_integer .emit 10;\n"
86 " hex_prefix .and digit_hex .emit * .and .loop digit_hex .emit * .and .true .emit '\\0';\n"
88 " '0' .and hex_prefix_1;\n"
92 " '0'-'9' .or 'a'-'f' .or 'A'-'F';\n"
94 " digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n"
97 "errortext_definition\n"
98 " \".errtext\" .and space .and identifier .and space .and string .and space_or_null;\n"
100 " string_ne .error STRING_EXPECTED;\n"
102 " '\"' .and .loop string_char_double_quotes .and '\"' .emit '\\0';\n"
103 "string_char_double_quotes\n"
104 " escape_sequence .or string_char .emit * .or '\\'' .emit *;\n"
106 " '\\x5D'-'\\xFF' .or '\\x28'-'\\x5B' .or '\\x23'-'\\x26' .or '\\x0E'-'\\x21' .or '\\x0B'-'\\x0C' .or\n"
107 " '\\x01'-'\\x09';\n"
109 " '\\\\' .emit * .and escape_code;\n"
111 " simple_escape_code .emit * .or hex_escape_code .or oct_escape_code;\n"
112 "simple_escape_code\n"
113 " '\\'' .or '\"' .or '?' .or '\\\\' .or 'a' .or 'b' .or 'f' .or 'n' .or 'r' .or 't' .or 'v';\n"
115 " 'x' .emit * .and digit_hex .emit * .and .loop digit_hex .emit *;\n"
117 " digit_oct .emit * .and optional_digit_oct .and optional_digit_oct;\n"
120 "optional_digit_oct\n"
121 " digit_oct .emit * .or .true;\n"
122 "regbyte_definition\n"
123 " \".regbyte\" .and space .and identifier .and space .and integer .and space_or_null;\n"
125 " \".string\" .and space .and identifier .and semicolon;\n"
127 " identifier_ne .and space .and definition;\n"
129 " specifier .and optional_specifiers_and_or .and semicolon .emit SPECIFIER_END;\n"
130 "optional_specifiers_and_or\n"
131 " and_specifiers .emit SPECIFIER_AND_TAG .or or_specifiers .emit SPECIFIER_OR_TAG .or .true;\n"
133 " specifier_condition .and optional_space .and specifier_rule;\n"
134 "specifier_condition\n"
135 " specifier_condition_1 .or .true;\n"
136 "specifier_condition_1\n"
137 " \".if\" .and optional_space .and '(' .and optional_space .and left_operand .and operator .and\n"
138 " right_operand .and optional_space .and ')';\n"
142 " operator_1 .or operator_2;\n"
144 " optional_space .and '!' .and '=' .and optional_space;\n"
146 " optional_space .and '=' .and '=' .and optional_space;\n"
150 " specifier_rule_1 .and optional_error .and .loop emit .and .true .emit EMIT_NULL;\n"
152 " character_range .emit SPECIFIER_CHARACTER_RANGE .or\n"
153 " character .emit SPECIFIER_CHARACTER .or\n"
154 " string_ne .emit SPECIFIER_STRING .or\n"
155 " \".true\" .emit SPECIFIER_TRUE .or\n"
156 " \".false\" .emit SPECIFIER_FALSE .or\n"
157 " \".debug\" .emit SPECIFIER_DEBUG .or\n"
158 " advanced_identifier .emit SPECIFIER_IDENTIFIER;\n"
160 " '\\'' .and string_char_single_quotes .and '\\'' .emit '\\0';\n"
161 "string_char_single_quotes\n"
162 " escape_sequence .or string_char .emit * .or '\"' .emit *;\n"
164 " character .and optional_space .and '-' .and optional_space .and character;\n"
165 "advanced_identifier\n"
166 " optional_loop .and identifier;\n"
168 " optional_loop_1 .emit IDENTIFIER_LOOP .or .true .emit IDENTIFIER_SIMPLE;\n"
170 " \".loop\" .and space;\n"
172 " error .emit ERROR_PRESENT .or .true .emit ERROR_NOT_PRESENT;\n"
174 " space .and \".error\" .and space .and identifier;\n"
176 " emit_output .or emit_regbyte;\n"
178 " space .and \".emit\" .and space .and emit_param;\n"
180 " integer_ne .emit EMIT_INTEGER .or\n"
181 " identifier_ne .emit EMIT_IDENTIFIER .or\n"
182 " character .emit EMIT_CHARACTER .or\n"
183 " '*' .emit EMIT_LAST_CHARACTER .or\n"
184 " '$' .emit EMIT_CURRENT_POSITION;\n"
186 " space .and \".load\" .and space .and identifier .and space .and emit_param;\n"
188 " and_specifier .and .loop and_specifier;\n"
190 " or_specifier .and .loop or_specifier;\n"
192 " space .and \".and\" .and space .and specifier;\n"
194 " space .and \".or\" .and space .and specifier;\n"
195 ".string __string_filter;\n"
197 " __first_identifier_char .and .loop __next_identifier_char;\n"
198 "__first_identifier_char\n"
199 " 'a'-'z' .or 'A'-'Z' .or '_' .or '.';\n"
200 "__next_identifier_char\n"
201 " 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';\n"