Skip to content

Commit

Permalink
added git commit
Browse files Browse the repository at this point in the history
  • Loading branch information
vpisarev committed Apr 2, 2021
1 parent ffc41ee commit 07b405e
Show file tree
Hide file tree
Showing 15 changed files with 539 additions and 503 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ FICUS0 := $(BOOTSTRAP_BUILD_DIR)/ficus0
CFLAGS := -I$(INCLUDE)
LDLIBS := -lm
LDFLAGS :=
GIT_COMMIT := "$(shell git describe)"

FICUS_SRC := ./compiler
FICUS_SRCS := $(wildcard $(FICUS_SRC)/*.fx)
Expand Down Expand Up @@ -64,6 +65,7 @@ $(BOOTSTRAP_BUILD_DIR)/%.o: $(BOOTSTRAP_SRC)/%.c | $(BOOTSTRAP_BUILD_DIR)

$(FICUS): $(FICUS0) $(FICUS_SRCS) $(FICUS_STDLIB_SRCS)
@echo "\033[34;1mBuilding fresh compiler from the actual ficus sources\033[0m"
@echo '#define FX_GIT_COMMIT $(GIT_COMMIT)' > $(RUNTIME_DIR)/version.git_commit
@$(MKDIR) $(FICUS_BIN)
@$(FICUS0) $(FICUS_FLAGS) -o $(FICUS) $(FICUS_SRC)/fx.fx

Expand Down
18 changes: 12 additions & 6 deletions compiler/Compiler.fx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,22 @@ type id_t = Ast.id_t
type kmodule_t = K_form.kmodule_t
val pr_verbose = Ast.pr_verbose

val iscolorterm = Sys.colorterm()

type msgcolor_t = MsgRed | MsgGreen | MsgBlue
fun clrmsg(clr: msgcolor_t, msg: string)
{
val esc = match clr {
| MsgRed => "\33[31;1m"
| MsgGreen => "\33[32;1m"
| MsgBlue => "\033[34;1m"
| _ => ""
if iscolorterm {
val esc = match clr {
| MsgRed => "\33[31;1m"
| MsgGreen => "\33[32;1m"
| MsgBlue => "\033[34;1m"
| _ => ""
}
f"{esc}{msg}\33[0m"
} else {
msg
}
f"{esc}{msg}\33[0m"
}
val error = clrmsg(MsgRed, "error")

Expand Down
12 changes: 6 additions & 6 deletions compiler/bootstrap/Ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -14138,14 +14138,14 @@ static int _fx_M3AstFM10walk_pe_l_LT2VM5pat_tVM5exp_t1LT2VM5pat_tVM5exp_t(
struct _fx_LT2V10Ast__pat_tV10Ast__exp_t_data_t** fx_result,
void* fx_fv)
{
_fx_FPV10Ast__pat_t1V10Ast__pat_t walk_pat__0 = { };
_fx_FPV10Ast__exp_t1V10Ast__exp_t walk_exp__0 = { };
_fx_FPV10Ast__pat_t1V10Ast__pat_t walk_pat__0 = { };
int fx_status = 0;
_fx_M3AstFM10walk_pe_l_LT2VM5pat_tVM5exp_t1LT2VM5pat_tVM5exp_t_cldata_t* cv_0 =
(_fx_M3AstFM10walk_pe_l_LT2VM5pat_tVM5exp_t1LT2VM5pat_tVM5exp_t_cldata_t*)fx_fv;
_fx_R16Ast__ast_callb_t* callb_0 = &cv_0->t0;
_fx_M3AstFM7make_fpFPVM5pat_t1VM5pat_t1RM11ast_callb_t(callb_0, &walk_pat__0);
_fx_M3AstFM7make_fpFPVM5exp_t1VM5exp_t1RM11ast_callb_t(callb_0, &walk_exp__0);
_fx_M3AstFM7make_fpFPVM5pat_t1VM5pat_t1RM11ast_callb_t(callb_0, &walk_pat__0);
_fx_LT2V10Ast__pat_tV10Ast__exp_t lstend_0 = 0;
_fx_LT2V10Ast__pat_tV10Ast__exp_t lst_0 = pe_l_0;
for (; lst_0; lst_0 = lst_0->tl) {
Expand Down Expand Up @@ -14178,8 +14178,8 @@ static int _fx_M3AstFM10walk_pe_l_LT2VM5pat_tVM5exp_t1LT2VM5pat_tVM5exp_t(
}

_fx_cleanup: ;
FX_FREE_FP(&walk_pat__0);
FX_FREE_FP(&walk_exp__0);
FX_FREE_FP(&walk_pat__0);
return fx_status;
}

Expand Down Expand Up @@ -14249,14 +14249,14 @@ static int _fx_M3AstFM11walk_cases_LT2VM5pat_tVM5exp_t1LT2VM5pat_tVM5exp_t(
struct _fx_LT2V10Ast__pat_tV10Ast__exp_t_data_t** fx_result,
void* fx_fv)
{
_fx_FPV10Ast__pat_t1V10Ast__pat_t walk_pat__0 = { };
_fx_FPV10Ast__exp_t1V10Ast__exp_t walk_exp__0 = { };
_fx_FPV10Ast__pat_t1V10Ast__pat_t walk_pat__0 = { };
int fx_status = 0;
_fx_M3AstFM11walk_cases_LT2VM5pat_tVM5exp_t1LT2VM5pat_tVM5exp_t_cldata_t* cv_0 =
(_fx_M3AstFM11walk_cases_LT2VM5pat_tVM5exp_t1LT2VM5pat_tVM5exp_t_cldata_t*)fx_fv;
_fx_R16Ast__ast_callb_t* callb_0 = &cv_0->t0;
_fx_M3AstFM7make_fpFPVM5pat_t1VM5pat_t1RM11ast_callb_t(callb_0, &walk_pat__0);
_fx_M3AstFM7make_fpFPVM5exp_t1VM5exp_t1RM11ast_callb_t(callb_0, &walk_exp__0);
_fx_M3AstFM7make_fpFPVM5pat_t1VM5pat_t1RM11ast_callb_t(callb_0, &walk_pat__0);
_fx_LT2V10Ast__pat_tV10Ast__exp_t lstend_0 = 0;
_fx_LT2V10Ast__pat_tV10Ast__exp_t lst_0 = pe_l_0;
for (; lst_0; lst_0 = lst_0->tl) {
Expand Down Expand Up @@ -14289,8 +14289,8 @@ static int _fx_M3AstFM11walk_cases_LT2VM5pat_tVM5exp_t1LT2VM5pat_tVM5exp_t(
}

_fx_cleanup: ;
FX_FREE_FP(&walk_pat__0);
FX_FREE_FP(&walk_exp__0);
FX_FREE_FP(&walk_pat__0);
return fx_status;
}

Expand Down
208 changes: 104 additions & 104 deletions compiler/bootstrap/C_gen_code.c

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions compiler/bootstrap/C_gen_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -8697,9 +8697,9 @@ FX_EXTERN_C int
static int _fx_M11C_gen_typesFM9cvt2ctyp_v2V9Ast__id_tR10Ast__loc_t(
_fx_V9Ast__id_t* tn_0, _fx_R10Ast__loc_t* loc_0, void* fx_fv)
{
_fx_FPR29C_gen_types__ctyp_temp_info_t3V9Ast__id_tBR10Ast__loc_t create_ctyp_decl_0 = { };
_fx_FPv2V9Ast__id_tV15C_form__cstmt_t add_decl_0 = { };
_fx_FPT2V9Ast__id_tLT2V9Ast__id_tVt6option1V14C_form__cexp_t1rR21K_form__kdefvariant_t get_var_enum_0 = { };
_fx_FPR29C_gen_types__ctyp_temp_info_t3V9Ast__id_tBR10Ast__loc_t create_ctyp_decl_0 = { };
_fx_Rt6Set__t1V9Ast__id_t deps_0 = { };
_fx_V15K_form__kinfo_t kt_info_0 = { };
_fx_T5V9Ast__id_tLT2V9Ast__id_tVt6option1V14C_form__cexp_tBBRt6Set__t1V9Ast__id_t v_0 = { };
Expand Down Expand Up @@ -8739,12 +8739,12 @@ static int _fx_M11C_gen_typesFM9cvt2ctyp_v2V9Ast__id_tR10Ast__loc_t(
_fx_rLV15C_form__cstmt_t top_fwd_decl_ref_0 = cv_0->t5;
_fx_rLV15C_form__cstmt_t top_typ_decl_ref_0 = cv_0->t6;
_fx_rLV15C_form__cstmt_t top_typfun_decl_ref_0 = cv_0->t7;
_fx_M11C_gen_typesFM7make_fpFPRM16ctyp_temp_info_t3V9Ast__id_tBR10Ast__loc_t2rRt6Set__t1V9Ast__id_trLV15C_form__cstmt_t(
all_fwd_decls_ref_0, top_fwd_decl_ref_0, &create_ctyp_decl_0);
_fx_M11C_gen_typesFM7make_fpFPv2V9Ast__id_tV15C_form__cstmt_t3rRt6Set__t1V9Ast__id_trLV15C_form__cstmt_trLV15C_form__cstmt_t(
all_decls_ref_0, top_typ_decl_ref_0, top_typfun_decl_ref_0, &add_decl_0);
_fx_M11C_gen_typesFM7make_fpFPT2V9Ast__id_tLT2V9Ast__id_tVt6option1V14C_form__cexp_t1rR21K_form__kdefvariant_t4rRt6Set__t1V9Ast__id_trRt6Map__t2V9Ast__id_tV9Ast__id_trLV15C_form__cstmt_trLV15C_form__cstmt_t(
all_decls_ref_0, all_var_enums_ref_0, top_typ_decl_ref_0, top_typfun_decl_ref_0, &get_var_enum_0);
_fx_M11C_gen_typesFM7make_fpFPRM16ctyp_temp_info_t3V9Ast__id_tBR10Ast__loc_t2rRt6Set__t1V9Ast__id_trLV15C_form__cstmt_t(
all_fwd_decls_ref_0, top_fwd_decl_ref_0, &create_ctyp_decl_0);
bool visited_0;
FX_CALL(_fx_M3SetFM3memB2RtM1t1V9Ast__id_tV9Ast__id_t(all_visited_0, tn_0, &visited_0, 0), _fx_cleanup);
FX_CALL(
Expand Down Expand Up @@ -10830,9 +10830,9 @@ _fx_endmatch_1: ;
}

_fx_cleanup: ;
FX_FREE_FP(&create_ctyp_decl_0);
FX_FREE_FP(&add_decl_0);
FX_FREE_FP(&get_var_enum_0);
FX_FREE_FP(&create_ctyp_decl_0);
_fx_free_Rt6Set__t1V9Ast__id_t(&deps_0);
_fx_free_V15K_form__kinfo_t(&kt_info_0);
_fx_free_T5V9Ast__id_tLT2V9Ast__id_tVt6option1V14C_form__cexp_tBBRt6Set__t1V9Ast__id_t(&v_0);
Expand Down
6 changes: 3 additions & 3 deletions compiler/bootstrap/C_post_rename_locals.c
Original file line number Diff line number Diff line change
Expand Up @@ -2896,16 +2896,16 @@ FX_EXTERN_C int _fx_M20C_post_rename_localsFM7make_fpFPv2V9Ast__id_tR10Ast__loc_
static int _fx_M20C_post_rename_localsFM12rename_cstmtv2V15C_form__cstmt_tR22C_form__c_fold_callb_t(
struct _fx_V15C_form__cstmt_t_data_t* s_0, _fx_R22C_form__c_fold_callb_t* callb_0, void* fx_fv)
{
_fx_FPS1V9Ast__id_t gen_cname_0 = { };
_fx_FPv2V9Ast__id_tR10Ast__loc_t gen_cval_cname_0 = { };
_fx_FPS1V9Ast__id_t gen_cname_0 = { };
int fx_status = 0;
_fx_M20C_post_rename_localsFM12rename_cstmtv2V15C_form__cstmt_tR22C_form__c_fold_callb_t_cldata_t* cv_0 =
(_fx_M20C_post_rename_localsFM12rename_cstmtv2V15C_form__cstmt_tR22C_form__c_fold_callb_t_cldata_t*)fx_fv;
_fx_Rt10Hashmap__t2ii* global_prefix_hash_0 = &cv_0->t0->data;
_fx_rRt10Hashmap__t2ii prefix_hash_ref_0 = cv_0->t1;
_fx_Rt10Hashmap__t2ii* prefix_hash_0 = &prefix_hash_ref_0->data;
_fx_M20C_post_rename_localsFM7make_fpFPS1V9Ast__id_t1rRt10Hashmap__t2ii(prefix_hash_ref_0, &gen_cname_0);
_fx_M20C_post_rename_localsFM7make_fpFPv2V9Ast__id_tR10Ast__loc_t1rRt10Hashmap__t2ii(prefix_hash_ref_0, &gen_cval_cname_0);
_fx_M20C_post_rename_localsFM7make_fpFPS1V9Ast__id_t1rRt10Hashmap__t2ii(prefix_hash_ref_0, &gen_cname_0);
int tag_0 = FX_REC_VARIANT_TAG(s_0);
if (tag_0 == _FX_V15C_form__cstmt_t_CDefVal) {
_fx_T4V14C_form__ctyp_tV9Ast__id_tVt6option1V14C_form__cexp_tR10Ast__loc_t* vcase_0 = &s_0->u.CDefVal;
Expand Down Expand Up @@ -3167,8 +3167,8 @@ _fx_catch_12: ;
_fx_endmatch_1: ;

_fx_cleanup: ;
FX_FREE_FP(&gen_cname_0);
FX_FREE_FP(&gen_cval_cname_0);
FX_FREE_FP(&gen_cname_0);
return fx_status;
}

Expand Down
Loading

0 comments on commit 07b405e

Please sign in to comment.