The Basic compiler works now.

This commit is contained in:
David Given 2016-08-12 00:19:51 +02:00
parent b592c88bdf
commit 7c60c27302
8 changed files with 53 additions and 6 deletions

View file

@ -12,6 +12,7 @@ installable {
name = "ack", name = "ack",
map = { map = {
"lang/cem/cemcom.ansi+pkg", "lang/cem/cemcom.ansi+pkg",
"lang/basic/src+pkg",
"plat/pc86+pkg", "plat/pc86+pkg",
"util/ack+pkg", "util/ack+pkg",
"util/amisc+pkg", "util/amisc+pkg",

View file

@ -90,7 +90,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "bem.h" #include "bem.h"
#include "llmess.c" #include "llmess.h"
typedef union { typedef union {
int integer ; int integer ;
@ -112,7 +112,7 @@ int in_data = 0; /* set if processing DATA statement */
char *formatstring; /* formatstring used for printing */ char *formatstring; /* formatstring used for printing */
Symbol *s; /* Symbol dummy */ Symbol *s; /* Symbol dummy */
#include "yylexp.c" #include "yylexp.h"
#include "basic.lex" #include "basic.lex"
} }

View file

@ -235,8 +235,6 @@ File *stream;
} }
} }
extern char *strchr();
getinputline() getinputline()
{ {
/* get next input line */ /* get next input line */

47
lang/basic/src/build.lua Normal file
View file

@ -0,0 +1,47 @@
include("util/LLgen/build.lua")
llgen {
name = "llgen",
srcs = { "./*.g" }
}
normalrule {
name = "tokentab_h",
ins = {
"./maketokentab",
matching(filenamesof("+llgen"), "/Lpars.h$"),
},
outleaves = { "tokentab.h" },
commands = {
"%{ins} %{outs}"
}
}
cprogram {
name = "em_bem",
srcs = {
"./*.c",
matching(filenamesof("+llgen"), "%.c$"),
},
deps = {
"+llgen",
"+tokentab_h",
"h+emheaders",
"modules+headers",
"modules/src/alloc+lib",
"modules/src/em_code+lib_k",
"modules/src/em_mes+lib",
"modules/src/print+lib",
"modules/src/string+lib",
"modules/src/system+lib",
"util/data+em_data",
}
}
installable {
name = "pkg",
map = {
["$(PLATDEP)/em_bem"] = "+em_bem"
}
}

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
ed -s "${1:-Lpars.h}" <<'+' ed -s "${1:-Lpars.h}" > $2 <<'+'
1d 1d
1,$s/# *define // 1,$s/# *define //
1,$s/ ...$// 1,$s/ ...$//
@ -13,6 +13,6 @@ char *tokentab[] = {
$a $a
}; };
. .
w tokentab.h 1,$p
q q
+ +

View file

@ -13,6 +13,7 @@ definerule("ackfile",
name = e.name, name = e.name,
srcs = e.srcs, srcs = e.srcs,
deps = { deps = {
"lang/cem/cemcom.ansi+pkg",
"lang/cem/cpp.ansi+pkg", "lang/cem/cpp.ansi+pkg",
"plat/"..plat.."+tools", "plat/"..plat.."+tools",
"util/ack+pkg", "util/ack+pkg",