beggining to stablish the EBNF of spider assembly
This commit is contained in:
+12
-9
@@ -35,7 +35,7 @@ float_lit = [ sign ] , (
|
||||
( digit , { digit } , "." , digit , { digit } , [ exponent ] ) |
|
||||
( "." , digit , { digit } , [ exponent ] ) |
|
||||
( digit , { digit } , exponent )
|
||||
) , [ "F" | "D" ] ;
|
||||
) , [ "F" | "D" ] ;
|
||||
|
||||
hex_lit = [ sign ] , "0x" , hex_digit , { hex_digit } ;
|
||||
octal_lit = [ sign ] , "0c" , octal_digit , { octal_digit } ;
|
||||
@@ -60,17 +60,20 @@ opcode = letter , { alpha_num_char } ;
|
||||
operand_list = operand , { "," , ws_optional , operand } ;
|
||||
instruction = opcode , [ whitespace , operand_list ] ;
|
||||
|
||||
(* Added Preprocessor, Sections, and Metadata Syntaxes *)
|
||||
include_decl = "include", whitespace, string_lit ;
|
||||
annotation_oper = identifier, [ ws_optional, "=", ws_optional, literal_decl ] ;
|
||||
annotation_ops = annotation_oper , { ws_optional, "," , ws_optional , annotation_oper } ;
|
||||
annotation_args = "(", ws_optional, annotation_ops, ws_optional, ")" ;
|
||||
annotation = "@", identifier, [ annotation_args ] ;
|
||||
section_decl = "section", whitespace, ".", identifier ;
|
||||
(* Added Preprocessor, Annotation *)
|
||||
annotation_named = identifier, ws_optional, "=", ws_optional, literal_decl;
|
||||
annotation_arg = literal_decl | annotation_named;
|
||||
annotation_args = annotation_arg, { ws_optional, "," , ws_optional , annotation_arg } ;
|
||||
annotation_pars = "(", ws_optional, annotation_args, ws_optional, ")" ;
|
||||
annotation = "@", identifier, [ annotation_pars ] ;
|
||||
preprocessor_val = identifier | string_lit;
|
||||
preprocessor = "#", identifier, whitespace, preprocessor_val;
|
||||
|
||||
(* Line Structure *)
|
||||
label = identifier, ":" ;
|
||||
line_content = include_decl | section_decl | ( [ annotation, whitespace ], [ label, ws_optional ], [ instruction ] ) ;
|
||||
line_label = label, [ whitespace, instruction ];
|
||||
line_annotation = annotation, [ whitespace, instruction ];
|
||||
line_content = preprocessor | line_annotation | line_label | instruction;
|
||||
line = ws_optional, [ line_content ], ws_optional , [ comment ] , newline ;
|
||||
line_last = ws_optional, [ line_content ], ws_optional , [ comment ] ;
|
||||
program = { line }, [ line_last ] ;
|
||||
|
||||
Reference in New Issue
Block a user