Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 12 commits into from
Sep 27, 2024

Conversation

davschneller
Copy link
Contributor

@davschneller davschneller commented Aug 28, 2024

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.

@davschneller davschneller marked this pull request as ready for review September 6, 2024 19:38
@davschneller davschneller changed the title Add Impala-to-Lua Transpiler Add Impala-to-Lua Transpiler, Add Lua Math Functions, Re-Enable Unit Tests Sep 6, 2024
message("Enabled Lua lmathx support.")

if (LUA_VERSION_STRING VERSION_GREATER_EQUAL "5.5")
message(WARNING "You Lua version ${LUA_VERSION_STRING} is newer than the maximum lmathx package version supported (5.4.x). We'll try with the version compatible to 5.4/5.3, but no guarantee on success for that.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "Your"?. But what do we suggest the user if their LUA version is greater than 5.5? Just downgrade to 5.4.x?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, typos. :)
We can suggest a downgrade here.

elseif (LUA_VERSION_STRING VERSION_GREATER_EQUAL "5.1")
target_sources(easi PRIVATE lua51/lmathx.c)
else()
message(FATAL_ERROR "You Lua version ${LUA_VERSION_STRING} is older than the minimum lmathx package version supported (5.1).")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another typo?

@davschneller davschneller merged commit d4ab63d into master Sep 27, 2024
2 checks passed
@davschneller davschneller deleted the davschneller/transpile-impala branch September 27, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hyperbolic Functions Deprecated/Removed in Newer Lua Versions
2 participants