SeisSol / easi

A library for the Easy Initialization of model parameters.
https://easyinit.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
1 stars 6 forks source link

Add Impala-to-Lua Transpiler, Add Lua Math Functions, Re-Enable Unit Tests #58

Open davschneller opened 2 weeks ago

davschneller commented 2 weeks ago

We add a small and quickly-written tokenizer and parser for Impala (akin to what's done over there in the repository, but with a bit more manual labor). Probably it's actually overkill to walk down the Impala ast here, since the Impala/C and Lua syntax are pretty similar in their behavior. Right now, every Impala function gets converted to one Lua function (it may also be easily possible to merge all functions into one (you'd "just" need to track the returns for that and shift code into else blocks, if there's a return in an if); but I'm not sure if that's really useful).

As a result, ImpalaJIT is no longer required to run a FunctionMap; only Lua is.

Also, we refactor the Lua function evaluation a tiny bit, and cut down the number of calls by the number of output parameters (so far, a function was executed for each output value again, even though the execution should result in exactly the same result). Would be interesting to think about supporting LuaJIT.

Furthermore, we now by default include the lmathx Lua library; thus the whole C math header should be effectively available now (the code for that is under public domain—I've just put it into the repo for now).

Also, the unit tests get re-enabled and fixed.