summaryrefslogtreecommitdiff
path: root/lexer.c
diff options
context:
space:
mode:
authorPeter Mikkelsen <petermikkelsen10@gmail.com>2022-01-14 00:31:03 +0000
committerPeter Mikkelsen <petermikkelsen10@gmail.com>2022-01-14 00:31:03 +0000
commit07082593ab4abfbf9a3dd6729cb2e548ec303115 (patch)
treef6fa70b94a0bf263f2fa8af21b26aaae90e1965f /lexer.c
parent454e026edc25b1d0f6b4f035d41b38a1e60e16e3 (diff)
Implement code for running operators (both monadic and dyadic).
Also implement ⍨ and ⍥ since they are very simple
Diffstat (limited to 'lexer.c')
-rw-r--r--lexer.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lexer.c b/lexer.c
index ceccf2f..bf2aaa4 100644
--- a/lexer.c
+++ b/lexer.c
@@ -4,8 +4,6 @@
#include "apl9.h"
-Rune primmonopnames[] = L"¨⍨⌸⌶&";
-Rune primdyadopnames[] = L"⍣.∘⍤⍥@⍠⌺";
Rune primhybridnames[] = L"/\⌿⍀";
Statement *
@@ -77,11 +75,15 @@ lexline(Rune *line)
offset++;
}else if(p = runestrchr(primmonopnames, line[offset])){
stmt->toks[stmt->ntoks].tag = MonadicOpTag;
- stmt->toks[stmt->ntoks].func.code = p-primmonopnames;
+ stmt->toks[stmt->ntoks].operator.type = OperatortypePrim;
+ stmt->toks[stmt->ntoks].operator.dyadic = 0;
+ stmt->toks[stmt->ntoks].operator.code = p-primmonopnames;
offset++;
}else if(p = runestrchr(primdyadopnames, line[offset])){
stmt->toks[stmt->ntoks].tag = DyadicOpTag;
- stmt->toks[stmt->ntoks].func.code = p-primdyadopnames;
+ stmt->toks[stmt->ntoks].operator.type = OperatortypePrim;
+ stmt->toks[stmt->ntoks].operator.dyadic = 1;
+ stmt->toks[stmt->ntoks].operator.code = p-primdyadopnames;
offset++;
}else if(isdigitrune(line[offset])){
char buf[64];