@@ -6,13 +6,15 @@ import std.stdio;
66import std.string ;
77import std.process ;
88import std.algorithm ;
9+ import callisto.error;
910import callisto.compiler;
1011import callisto.language;
1112import callisto.codeRemover;
1213import callisto.preprocessor;
1314import callisto.backends.lua;
1415import callisto.backends.uxn;
1516import callisto.backends.rm86;
17+ import callisto.backends.arm64;
1618import callisto.backends.x86_64;
1719
1820const static string usage = "
4547Backends and their operating systems:
4648 rm86 - Real mode x86, for bare-metal, dos
4749 x86_64 - 64-bit x86, for bare-metal, linux
50+ arm64 - 64-bit ARM, for linux
4851 uxn - Varvara/Uxn
4952 lua - Lua, uses subset CallistoScript
5053
@@ -73,7 +76,7 @@ int main(string[] args) {
7376 bool optimise;
7477 string [] versions;
7578 bool runFinal = true ;
76- CompilerBackend backend = new BackendX86_64() ;
79+ CompilerBackend backend;
7780 bool doDebug;
7881 bool debugParser;
7982 bool exportSymbols;
@@ -85,6 +88,17 @@ int main(string[] args) {
8588 bool assemblyLines;
8689 string os = " DEFAULT" ;
8790
91+ // choose default backend
92+ version (X86_64 ) {
93+ backend = new BackendX86_64();
94+ }
95+ else version (AArch64 ) {
96+ backend = new BackendARM64();
97+ }
98+ else {
99+ WarnNoInfo(" No default backend for your system" );
100+ }
101+
88102 for (size_t i = 1 ; i < args.length; ++ i) {
89103 if (args[i][0 ] == ' -' ) {
90104 switch (args[i]) {
@@ -162,6 +176,10 @@ int main(string[] args) {
162176 backend = new BackendX86_64();
163177 break ;
164178 }
179+ case " arm64" : {
180+ backend = new BackendARM64();
181+ break ;
182+ }
165183 case " uxn" : {
166184 backend = new BackendUXN();
167185 break ;
@@ -285,6 +303,10 @@ int main(string[] args) {
285303 }
286304 }
287305
306+ if (backend is null ) {
307+ ErrorNoInfo(" No backend selected" );
308+ }
309+
288310 if (os == " DEFAULT" ) {
289311 os = backend.defaultOS;
290312 }
0 commit comments