SomeRanDev / laxe

A Python-like programming language built entirely using Haxe metaprogramming.
MIT License
11 stars 2 forks source link

Converting a laxe string to haxe #2

Open neimanpinchas opened 3 months ago

neimanpinchas commented 3 months ago

I am thinking about compiling laxe in runtime to haxe to use with hscript.

How far is this from reality?

SomeRanDev commented 3 months ago

Hey sorry for the delay, don't know why I didn't get notified of your posts.

First, I'm not sure Laxe works with modern versions of Haxe. Most of it should work, but Laxe macros broke when there were reworks with Haxe's macro system in 4.2ish and above? So I guess as long as you don't use macros you're good?

Secondly, as mentioned above, Laxe requires the Haxe compiler to function for macros. Laxe runs using compile-time macros in Haxe and uses the Haxe compiler's compile-time API to execute the arbitrary Haxe code (generated from Laxe macros). As mentioned above, if you don't use Laxe macros, this might not be a problem.

Long story short, Laxe might be able to do this? Just define -D laxeRuntime and that will make the Laxe API available at runtime. There's a good chance it still might not work, but I'm sure you could make a couple minor edits to fix this. I'm not going to touch this project for a while, so don't count on me 😅

neimanpinchas commented 1 month ago

I've been able to make it work with 4.3.6 with some changes, I've made a PR

I wasn't able to get laxeRuntime to work for 2 reasons

1 since it relies on sys, and I was trying to use js target

2 the parser is using haxe.macro.Context which is not availible at runtime.

SomeRanDev commented 1 month ago

Hmmm, yeahhh, as I mentioned before, this project was always meant to be run during Haxe compile-time. Using sys to read .lx files and using Context are vital for the experience I was aiming for, never really intended for runtime use. 😅

Please feel free to make the changes you need! I unfortunately have no plans to continue working on this project for the foreseeable future. 🙇