Skip to content

Commit 670efac

Browse files
committed
make examples use the select core
1 parent 364563b commit 670efac

File tree

11 files changed

+25
-12
lines changed

11 files changed

+25
-12
lines changed

examples/arithmetic.cal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include "cores/rm86.cal"
1+
include "cores/select.cal"
22
include "std/io.cal"
33
include "std/common.cal"
44

examples/arrays.cal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include "cores/rm86.cal"
1+
include "cores/select.cal"
22
include "std/io.cal"
33
include "std/array.cal"
44

examples/countTo10.cal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include "cores/rm86.cal"
1+
include "cores/select.cal"
22
include "std/io.cal"
33

44
func new_line begin

examples/helloWorld.cal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include "cores/rm86.cal"
1+
include "cores/select.cal"
22
include "std/io.cal"
33
include "std/array.cal"
44

examples/sierpinski.cal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include "cores/rm86.cal"
1+
include "cores/select.cal"
22
include "std/io.cal"
33

44
func sierpinski begin

examples/stars.cal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include "cores/rm86.cal"
1+
include "cores/select.cal"
22
include "std/io.cal"
33

44
let cell x 0 x !

examples/structs.cal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include "cores/rm86.cal"
1+
include "cores/select.cal"
22
include "std/io.cal"
33

44
func new_line begin

examples/variables.cal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include "cores/rm86.cal"
1+
include "cores/select.cal"
22

33
let i16 myGlobal
44

examples/version.cal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include "cores/rm86.cal"
1+
include "cores/select.cal"
22
include "std/io.cal"
33

44
# will execute on RM86 backend

source/app.d

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Flags:
1818
--org ADDR - Sets ORG value for compiler backend's assembly, ADDR is hex
1919
-i PATH - Adds PATH to the list of include directories
2020
-O - Enables optimisation (only works properly with programs without errors)
21+
-v VER - Enables VER as a version
2122
";
2223

2324
int main(string[] args) {
@@ -36,6 +37,7 @@ int main(string[] args) {
3637
bool orgSet;
3738
string[] includeDirs;
3839
bool optimise;
40+
string[] versions;
3941

4042
for (size_t i = 1; i < args.length; ++ i) {
4143
if (args[i][0] == '-') {
@@ -88,6 +90,16 @@ int main(string[] args) {
8890
optimise = true;
8991
break;
9092
}
93+
case "-v": {
94+
++ i;
95+
if (i >= args.length) {
96+
stderr.writeln("-v requires VER parameter");
97+
return 1;
98+
}
99+
100+
versions ~= args[i];
101+
break;
102+
}
91103
default: {
92104
stderr.writefln("Unknown flag '%s'", args[i]);
93105
return 1;
@@ -116,11 +128,12 @@ int main(string[] args) {
116128
compiler.backend = new BackendRM86();
117129
compiler.backend.org = org;
118130
compiler.backend.orgSet = orgSet;
119-
compiler.includeDirs = includeDirs;
131+
132+
versions ~= compiler.backend.GetVersions();
120133

121134
auto preproc = new Preprocessor();
122135
preproc.includeDirs = includeDirs;
123-
preproc.versions = compiler.backend.GetVersions();
136+
preproc.versions = versions;
124137
nodes = preproc.Run(nodes);
125138

126139
if (optimise) {

0 commit comments

Comments
 (0)