Question about bmax dependencies (compiler)

BlitzMax Forums/BlitzMax Programming/Question about bmax dependencies (compiler)

Yahfree(Posted 2015) [#1]
I'm writing a bmax compiler in TypeScript (aka typed JavaScript), for fun. Scanning and parsing it is relatively straight forward, as I can sort of deduce a formal grammar for LALR(1) / LR(k) bottom up parsing, but I'm not sure what to do about all the library functions mentioned here:

http://www.blitzbasic.com/bmdocs/command_list_2d_cat.php

Are these written in bmax somewhere and thus can be subsequently parsed (I haven't written code in bmax and don't recall importing things for functions like Sqrt())?

Or will I have to keep some sort of intermediate run time library of these things?


Floyd(Posted 2015) [#2]
Look in the \mod folder. The source is usually written in BlitzMax or C (or C++).


Yasha(Posted 2015) [#3]
You didn't say what your output format is, but since several versions ago, everything in the mod folder is free to redistribute under the BSD licence, so if your output is C, or C-compatible, you shouldn't need to do anything - you can use the same runtime library as stock BlitzMax. (There's a tiny bit of assembly for the exception handling, but I think that's all.)


I can sort of deduce a formal grammar for LALR(1) / LR(k) bottom up parsing


Yay, someone who actually knows what they're doing! That's really cool.


Yahfree(Posted 2015) [#4]
Thanks! That's good news. I'm planning on making it output to LLVM intermediate representation (which is relatively straightforward since its basically a mapping from one tree to another), so then it can be optimized and compiled to pretty much any language. I'm not sure of the legality of this but I'm just doing it as side project to distract me.

Graphics is another beast though. I'd have to snoop around and see what the openGL stuff looks like, as that's probably the only sane route to get graphics from bmax to render on these various platforms.