diff options
author | crupest <crupest@outlook.com> | 2021-11-24 20:43:52 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-11-24 20:43:52 +0800 |
commit | 04cfc657115bb0f9b26b1b59fcb956fe3abb83d7 (patch) | |
tree | 78fe10fb9db60952b89e889aef056c706620322d /compile-principle-experiment/3/main.h | |
parent | d08a3a340a42bbd9616ea910fbad020d7aac212d (diff) | |
download | life-04cfc657115bb0f9b26b1b59fcb956fe3abb83d7.tar.gz life-04cfc657115bb0f9b26b1b59fcb956fe3abb83d7.tar.bz2 life-04cfc657115bb0f9b26b1b59fcb956fe3abb83d7.zip |
Add compile principle experiment 3.
Diffstat (limited to 'compile-principle-experiment/3/main.h')
-rw-r--r-- | compile-principle-experiment/3/main.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/compile-principle-experiment/3/main.h b/compile-principle-experiment/3/main.h new file mode 100644 index 0000000..9bd6e56 --- /dev/null +++ b/compile-principle-experiment/3/main.h @@ -0,0 +1,25 @@ +#pragma once + +typedef union SymbolValue { + double val; + double (*ptr)(); +} SymbolValue; + +typedef struct Symbol { + char *name; + int type; + SymbolValue value; + struct Symbol *next; +} Symbol; + +Symbol *cru_symbol_lookup(const char *name); +Symbol *cru_symbol_install(const char *name, int type, SymbolValue value); + +double Pow(double x, double y); + +int yylex(); +int yyparse(); +void yyerror(const char *s); + +extern int lineno; +void execerror(const char *s, const char *t); |