summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorKonstantin Kirik (snegovick) <snegovick@uprojects.org>2025-12-12 06:24:08 +0300
committerKonstantin Kirik (snegovick) <snegovick@uprojects.org>2025-12-12 06:24:08 +0300
commit06c7845f0247e77ed861b85b6c48556f6b6b120d (patch)
tree6e9eac0970f97bdae439925772f51f232af5e30f /module
parenta40ef1434889babbd88c9d0c5913c70e96ac2774 (diff)
Reorganize files according to proper directory structure
Diffstat (limited to 'module')
-rw-r--r--module/mkfile9
-rw-r--r--module/mkmod16
-rw-r--r--module/sh9parser.m29
-rw-r--r--module/sh9util.m8
4 files changed, 62 insertions, 0 deletions
diff --git a/module/mkfile b/module/mkfile
new file mode 100644
index 0000000..ebe0018
--- /dev/null
+++ b/module/mkfile
@@ -0,0 +1,9 @@
+<../mkconfig
+
+MODS=\
+ sh9util.m\
+ sh9parser.m\
+
+<mkmod
+
+nuke:QV: \ No newline at end of file
diff --git a/module/mkmod b/module/mkmod
new file mode 100644
index 0000000..16b7252
--- /dev/null
+++ b/module/mkmod
@@ -0,0 +1,16 @@
+MODDIR=$ROOT/module
+
+$MODDIR/%.m: %.m
+ rm -f $MODDIR/$stem.m && cp $stem.m $MODDIR/$stem.m
+
+
+MODFILES=${MODS:%=$MODDIR/%}
+
+all:QV:
+
+clean:QV:
+
+install:V: $MODFILES
+
+nuke:V:
+ rm -f $MODFILES
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);
+};
+};
diff --git a/module/sh9util.m b/module/sh9util.m
new file mode 100644
index 0000000..bcf940a
--- /dev/null
+++ b/module/sh9util.m
@@ -0,0 +1,8 @@
+Sh9Util: module
+{
+PATH: con "/dis/lib/sh9util.dis";
+DESCR: con "Utility functions for sh9";
+
+reverse_list: fn[T](toks: list of T): list of T;
+to_array: fn[T](toks: list of T): array of T;
+};