lang: add var keyword for variable declarations
the var keyword allows greater control over what scope a particular variable exists in. it clarifies whether a new variable is being defined or an existing variable is being assigned to. it will also facilitate the implementation of global variables.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include "../debug.h"
|
||||
#include "codegen.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -25,7 +26,7 @@ static struct code_generator_result gen_int(
|
||||
{
|
||||
struct expr_codegen_state *expr = (struct expr_codegen_state *)state;
|
||||
|
||||
printf("codegen: got int\n");
|
||||
debug_printf("codegen: got int\n");
|
||||
|
||||
struct ivy_ast_int_node *int_node = (struct ivy_ast_int_node *)node;
|
||||
struct mie_value *value
|
||||
@@ -46,7 +47,7 @@ static struct code_generator_result gen_op(
|
||||
{
|
||||
struct expr_codegen_state *expr = (struct expr_codegen_state *)state;
|
||||
|
||||
printf("codegen: got operator\n");
|
||||
debug_printf("codegen: got operator\n");
|
||||
|
||||
struct mie_value *left = codegen_pop_value(gen);
|
||||
struct mie_value *right = codegen_pop_value(gen);
|
||||
@@ -100,14 +101,14 @@ static struct code_generator_result gen_op(
|
||||
static enum ivy_status state_init(
|
||||
struct ivy_codegen *gen, struct code_generator_state *state)
|
||||
{
|
||||
printf("codegen: start of expression\n");
|
||||
debug_printf("codegen: start of expression\n");
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
static enum ivy_status state_fini(
|
||||
struct ivy_codegen *gen, struct code_generator_state *state)
|
||||
{
|
||||
printf("codegen: end of expression\n");
|
||||
debug_printf("codegen: end of expression\n");
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user