summaryrefslogtreecommitdiff
path: root/sys/src/cmd/forp/dat.h
diff options
context:
space:
mode:
authoraiju <devnull@localhost>2018-03-28 17:08:30 +0000
committeraiju <devnull@localhost>2018-03-28 17:08:30 +0000
commit382d37dbf0ee8bf5af9594e922db6094e30ace2a (patch)
tree26d20b8c336da4017376c931fc8f0e507f16c613 /sys/src/cmd/forp/dat.h
parent80474f7f59ee755cd1967c5703e3be724582f001 (diff)
add forp
Diffstat (limited to 'sys/src/cmd/forp/dat.h')
-rw-r--r--sys/src/cmd/forp/dat.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/sys/src/cmd/forp/dat.h b/sys/src/cmd/forp/dat.h
new file mode 100644
index 000000000..32d8f0756
--- /dev/null
+++ b/sys/src/cmd/forp/dat.h
@@ -0,0 +1,94 @@
+typedef struct Line Line;
+typedef struct Node Node;
+typedef struct Symbol Symbol;
+typedef struct Trie Trie;
+typedef struct TrieHead TrieHead;
+
+struct Line {
+ char *filen;
+ int lineno;
+};
+
+struct TrieHead {
+ uvlong hash;
+ int l;
+};
+
+enum { TRIEB = 4 };
+struct Trie {
+ TrieHead;
+ Trie *n[1<<TRIEB];
+};
+
+struct Symbol {
+ TrieHead;
+ char *name;
+ int type;
+ int size;
+ int flags;
+ int *vars;
+ Symbol *next;
+};
+enum {
+ SYMNONE,
+ SYMBITS,
+};
+enum {
+ SYMFSIGNED = 1,
+};
+
+struct Node {
+ int type;
+ Line;
+ int op;
+ mpint *num;
+ Symbol *sym;
+ Node *n1, *n2, *n3;
+ int size;
+ int *vars;
+};
+enum {
+ ASTINVAL,
+ ASTSYM,
+ ASTNUM,
+ ASTBIN,
+ ASTUN,
+ ASTIDX,
+ ASTTERN,
+ ASTTEMP,
+};
+enum {
+ OPINVAL,
+ OPABS,
+ OPADD,
+ OPAND,
+ OPASS,
+ OPCOM,
+ OPCOMMA,
+ OPDIV,
+ OPEQ,
+ OPEQV,
+ OPGE,
+ OPGT,
+ OPIMP,
+ OPLAND,
+ OPLE,
+ OPLOR,
+ OPLSH,
+ OPLT,
+ OPMOD,
+ OPMUL,
+ OPNEG,
+ OPNEQ,
+ OPNOT,
+ OPOR,
+ OPRSH,
+ OPSUB,
+ OPXOR,
+};
+
+extern Symbol *syms;
+
+#pragma varargck type "ε" Node*
+#pragma varargck type "α" int
+#pragma varargck type "O" int