Open Source XojoScript - Precursor to OS Xojo Compiler πŸ™

After building numerous compilers for many platforms, Ive decided to create a Xojo Syntax based compiler. :pray: I’m working on an OS implementation of Xojo and XojoScript. The XojoScript bytecode compiler and VM are the precursor to the full-fledged compiler for Xojo. The AST will be used to emit LLVM IR for cross-platform compilation. Feel free to report issues or make pull requests.

Happy coding!

License: MIT :pray:

5 Likes

Intersting
But not sure the grammar is quite complete
Modules appear to be unsupported
I use them extensively in my XojoScripts (some of which are truly enormous exceeding 10K lines in total)

I do have a pretty complete Xojo grammar for ANTLR 4 that I’ve not done much with

2 Likes

Hi Norman! Absolutely :slight_smile: Modules are next on the agenda this evening. Completed classes and method overloading yesterday (along with all math keywords and operator handlers)… and making sure self works correctly - just need to update classes to auto invoke the constructor upon instantiation instead of manually invoking it. Lots to be done still but pretty good start for 3 days of solid coding :raised_hands: I still need to implement the remaining built-in base properties and methods for xojoscript native classes (ie Random - currently only supports random.inrange(x,y)). Would love any suggestions or contributions along the way.

Console apps will be first
Followed by desktop… which i have most cross-platform control creation setup - just need to re-build the LLVM IR emitter for native compilations (ripped from my original S++ compiler)

Contemplating WASM for web apps…

If AI/LLMs gets good enough at coding by the end of 2025, I may implement an agentic setup to propel the development as issues arise or new features are desired. :pray:

Thanks for taking a peek!

API 1 or 2?

also you might want to make sure you handle DIM & VAR the same (since they are synonyms)

the ANTLR grammar I mentioned has examples for as much of Xojo’s grammar as I can

Many are just examples of syntax that the grammar properly recognizes (both legal & illegal syntax)

XojoScript has the same grammar for MOST of the language but I dont think it supports DECLARES at run time

API 1 and 2 are not changes at the COMPILER level in terms of grammar (excepting the addition of VAR)

Arrays are about the only thing that is a little weird

But everything from API 2 like Integer.ToString, etc are done as extension methods (you can see that in the tip at the bottom of the IDE code editor window)
Controls & classes are similar
They arent GRAMMAR changes right in the compiler

Hi Npalary,
Can you share your ANTLR 4 for Xojo ?
Thanks,

I have a Private Git Hub repo for it
That way I can be very selective about who can read it and clone it etc
Since folks in here often dont use their full name I’m not sure who is who so I didnt make a public repo

Send me an email off list with your github username & we can go from there

Anyone else interested do the same

EDIT Made the repo public so anyone can see it

1 Like