diff options
author | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2022-01-08 22:45:00 +0000 |
---|---|---|
committer | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2022-01-08 22:45:00 +0000 |
commit | 1ef3119fe613823a2145126c58948361ca7d3cd8 (patch) | |
tree | 5252d957ae512e1a727c9dec2b31e7b2a1d63e56 /apl9.h | |
parent | 214cdacca02552649d63f9045fdb8a17cfbb6fca (diff) |
Add initial code, just to get started
Diffstat (limited to 'apl9.h')
-rw-r--r-- | apl9.h | 65 |
1 files changed, 65 insertions, 0 deletions
@@ -0,0 +1,65 @@ +/* Global definitions of limits and constants */ +#define MAX_LINE_LENGTH 1024 +#define MAX_LINE_TOKENS 1024 + +typedef enum +{ + ArrayTag, + FunctionTag, + HybridTag, + MonadicOpTag, + DyadicOpTag, + BoundFunctionTag, /* Function with left arg bound */ + LParTag, + RParTag, + LCurlTag, + RCurlTag, + LBracketTag, + RBracketTag +} datumTag; + +typedef enum +{ + AtypeInt +} arrayDataType; + +/* Data types */ +typedef struct Array Array; +typedef struct Datum Datum; + +struct Array +{ + arrayDataType type; + int rank; + int *shape; + union { + char *rawdata; + vlong *intdata; + }; +}; + +struct Datum +{ + datumTag tag; + Rune *strrep; + union { + Array *array; + }; +}; + +/* Function prototypes for the different source files */ +/* print.c */ +Rune *ppdatum(Datum); +Rune *ppdatums(Datum *, int); + +/* lexer.c */ +Datum *lexline(Rune *, int *); + +/* array.c */ +Array *mkscalarint(vlong); + +/* eval.c */ +Datum *eval(Datum *, int *); + +/* Global variables */ +Rune *errormsg; /* eval.c */
\ No newline at end of file |