From a6ebaeabd02866c8a79ffc3d23574dc8f5496655 Mon Sep 17 00:00:00 2001 From: David Given Date: Tue, 14 May 2013 18:01:38 +0100 Subject: [PATCH] Basic compiler now runs. --HG-- branch : dtrg-buildsystem --- lang/basic/build.mk | 3 +-- lang/basic/src/basic.lex | 2 +- lang/basic/src/build.mk | 44 ++++++++++++++++++++++++++++++++++++++++ lang/basic/src/compile.c | 2 +- lang/basic/src/gencode.c | 2 +- lib/descr/fe | 2 +- 6 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 lang/basic/src/build.mk diff --git a/lang/basic/build.mk b/lang/basic/build.mk index 9a61c3578..c14c7f358 100644 --- a/lang/basic/build.mk +++ b/lang/basic/build.mk @@ -1,4 +1,3 @@ include lang/basic/lib/build.mk -#include lang/cem/cemcom.ansi/build.mk -#include lang/cem/libcc.ansi/build.mk +include lang/basic/src/build.mk diff --git a/lang/basic/src/basic.lex b/lang/basic/src/basic.lex index 974768932..0f514c97d 100644 --- a/lang/basic/src/basic.lex +++ b/lang/basic/src/basic.lex @@ -237,7 +237,7 @@ File *stream; extern char *strchr(); -getline() +getinputline() { /* get next input line */ diff --git a/lang/basic/src/build.mk b/lang/basic/src/build.mk new file mode 100644 index 000000000..e8a6f3cfb --- /dev/null +++ b/lang/basic/src/build.mk @@ -0,0 +1,44 @@ +D := lang/basic/src + +define build-bem-impl + +$(call reset) +$(eval cflags += -I$(OBJDIR)/$D -I$D) + +$(call cfile, $D/bem.c) +$(call cfile, $D/symbols.c) +$(call cfile, $D/initialize.c) +$(call cfile, $D/compile.c) +$(call cfile, $D/parsepar.c) +$(call cfile, $D/gencode.c) +$(call cfile, $D/util.c) +$(call cfile, $D/graph.c) +$(call cfile, $D/eval.c) +$(call cfile, $D/func.c) + +$(call llgen, $(OBJDIR)/$D, $D/basic.g) + +$(eval g := $(OBJDIR)/$D/token.h) +$(eval CLEANABLES += $g) +$g: $D/maketokentab $(OBJDIR)/$D/Lpars.h + @echo TOKENTAB $$@ + @mkdir -p $$(dir $$@) + $(hide) cd $(OBJDIR)/$D && $(abspath $$^) + +$(eval $q: $(OBJDIR)/$D/token.h) +$(eval $q: $(OBJDIR)/$D/Lpars.h) +$(eval $q: $(INCDIR)/print.h) + +$(call file, $(LIBEM_MES)) +$(call file, $(LIBEMK)) +$(call file, $(LIBEM_DATA)) +$(call file, $(LIBALLOC)) +$(call file, $(LIBPRINT)) +$(call file, $(LIBSTRING)) +$(call file, $(LIBSYSTEM)) +$(call cprogram, $(BINDIR)/em_bem) +$(call installto, $(PLATDEP)/em_bem) + +endef + +$(eval $(build-bem-impl)) diff --git a/lang/basic/src/compile.c b/lang/basic/src/compile.c index 7325cdf74..eee685910 100644 --- a/lang/basic/src/compile.c +++ b/lang/basic/src/compile.c @@ -23,7 +23,7 @@ compileprogram() prolog2(); /* Some statements are moved from prolog2 to epilogcode in the new version of the compiler */ - while( basicline = 0, getline()) + while( basicline = 0, getinputline()) (void) LLparse(); epilogcode(); sys_close(yyin); diff --git a/lang/basic/src/gencode.c b/lang/basic/src/gencode.c index 4facb3af9..8c7a50e95 100644 --- a/lang/basic/src/gencode.c +++ b/lang/basic/src/gencode.c @@ -644,7 +644,7 @@ prolog2() C_loi((arith) BEMPTRSIZE); C_exa_dnam("trpbuf"); C_lae_dnam("trpbuf",(arith)0); - C_cal("setjmp"); + C_cal("__setjmp"); C_df_ilb(l); C_asp((arith)(BEMPTRSIZE+BEMPTRSIZE)); C_lfr((arith)BEMINTSIZE); diff --git a/lib/descr/fe b/lib/descr/fe index 2e69b0f3b..ac9b8b114 100644 --- a/lib/descr/fe +++ b/lib/descr/fe @@ -156,7 +156,7 @@ end name abc from .b to .k - program {EM}/lib.bin/em_bem + program {EM}/lib/ack/em_bem mapflag -h ABC_F={ABC_F?} -h mapflag -w ABC_F={ABC_F?} -w mapflag -L ABC_F={ABC_F?} -L -- 2.34.1