bc and bd compiled without a problem, be/bx will compile too (but not separately).
bc throws an exception when I try to compile basic source.
$ ./bc test.bas
Triga-Basic Compiler v2.0
Compiling 'test.bas' to 'test.tbbc'
1: test:
2: LET test = "hello"
HLA Exception (53)
Memory Access Violation
Error reading file 'test.bas'
test.bas:
test:
LET test = "hello"
print test
I at first thought maybe because I reused a statement label as a variable but changing it doesn't resolve the exception.
I haven't tried bd or be yet, without having any bytecode to decompile or run.
There is an error in the documentation. Remove the "LET" and it will compile.
test = "Hello"
print test
You will need a program like the following in order to run the compiled program:
run.hla // compile with "hla -nolibc run bx"
program runbasic;
#include( "stdlib.hhf" )
#include( "basic.hhf" )
var
mycode :rtPgmClass;
begin runbasic;
mov( false, bl );
arg.c();
if( eax < 2 || eax > 3 ) then
stdout.put( "ERRusage: run program.tbbc <<anything>>" nl );
stdout.put( "Any second parameter will turn DEBUG mode on." nl );
os.exitProcess( 1 );
elseif( eax = 3 ) then
mov( true, bl );
endif;
arg.a_v( 1 );
mycode.create( eax, 0 );
mov( bl, mycode.debugFlag );
mycode.run();
mycode.destroy();
end runbasic;
Nathan.
I get the same error without the 'LET' or statement label.
$ ./bc test.bas
Triga-Basic Compiler v2.0
Compiling 'test.bas' to 'test.tbbc'
1: testvar = "hello"
HLA Exception (53)
Memory Access Violation
Error reading file 'test.bas'
I was trying to compile the 'be' standalone example for running the basic code.