Turing-Complete now
This commit is contained in:
parent
3bf4a73c2e
commit
9dbb9e882c
6 changed files with 405 additions and 30 deletions
|
@ -25,17 +25,20 @@ typedef struct FlupFunction_s {
|
|||
StringView name;
|
||||
ParameterDefinition* parameters;
|
||||
StringView return_type;
|
||||
FlupFunctionAlternative* alternative;
|
||||
FlupFunctionAlternative* alternatives;
|
||||
struct FlupFunction_s* next;
|
||||
} FlupFunction;
|
||||
|
||||
enum ValueType {
|
||||
VALUETYPE_INT64,
|
||||
VALUETYPE_DOUBLE
|
||||
VALUETYPE_DOUBLE,
|
||||
VALUETYPE_BOOLEAN,
|
||||
};
|
||||
|
||||
union ValueContent {
|
||||
int64_t i64;
|
||||
double f64;
|
||||
bool boolean;
|
||||
};
|
||||
|
||||
typedef struct Value_s {
|
||||
|
@ -43,13 +46,22 @@ typedef struct Value_s {
|
|||
union ValueContent get;
|
||||
} Value;
|
||||
|
||||
typedef struct FlupVariable_s {
|
||||
StringView name;
|
||||
Value value;
|
||||
struct FlupVariable_s* next;
|
||||
} FlupVariable;
|
||||
|
||||
typedef struct CallFrame_s {
|
||||
size_t instruction_pointer;
|
||||
/* ip = condition start : start
|
||||
* ip = condition_end + 1 : done
|
||||
*
|
||||
*/
|
||||
FlupFunctionAlternative* function;
|
||||
FlupFunction* self_function;
|
||||
FlupFunctionAlternative* alternative;
|
||||
FlupFunction* functions; // functions defined in this callframe
|
||||
FlupVariable* variables; // variables defined in this callframe
|
||||
DynamicArray stack; // Value
|
||||
Scratchpad memory_pad;
|
||||
} CallFrame;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue