diff options
Diffstat (limited to 'module/sh9parser.m')
| -rw-r--r-- | module/sh9parser.m | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/module/sh9parser.m b/module/sh9parser.m new file mode 100644 index 0000000..0807105 --- /dev/null +++ b/module/sh9parser.m @@ -0,0 +1,29 @@ +Sh9Parser: module +{ +PATH: con "/dis/lib/sh9parser.dis"; +DESCR: con "Mostly generic parser for sh9"; + +mk_tok: fn(start: int, line: int, tok: string, typ: string) : ref TokNode; +set_last_tok: fn(last_tok: ref TokNode, toks: list of ref TokNode): (ref TokNode, list of ref TokNode); +print_toks: fn(toks: array of ref TokNode); +print_toks_short: fn(toks: array of ref TokNode); +check_grammar_node_match: fn(toks: array of ref TokNode, gn: ref GrammarNode): int; +replace_toks: fn(src: array of ref TokNode, replace_start: int, replace_len: int, replace_with: array of ref TokNode): array of ref TokNode; +parse_toks: fn(toks: array of ref TokNode, g: array of ref GrammarNode): array of ref TokNode; +init: fn(); + +TokNode: adt { + start: int; + line: int; + tok: string; + typ: string; +}; + +GrammarNode: adt { + expr: array of string; + transform: string; + + callback: ref fn(toks: array of ref TokNode); + print_expr: fn(gn: self ref GrammarNode); +}; +}; |
