Lua DSL in C++

81 views
Skip to first unread message

mohammadbagher bidram

unread,
Jun 8, 2026, 3:01:55 PM (4 days ago) Jun 8
to lua-l

Hello,

I’m developing a Lua-like DSL in C++ called TinyLC. Unlike standard Lua, it does not use a traditional VM loop, with the goal of keeping overhead low and improving integration with C++.

The main challenge is that I’m running into is library compatibility. Because TinyLC does not follow the usual Lua VM or stack-based execution model, existing Lua libraries, such as LÖVE2D and other projects that depend on the Lua C API, cannot work with it directly.

I wanted to ask whether there is any practical way to address or work around this limitation without giving up the current runtime design.

You can take a look at the project here: tinylc-github-repo

Sainan

unread,
Jun 8, 2026, 3:39:47 PM (4 days ago) Jun 8
to lu...@googlegroups.com
???

-- Sainan

mohammadbagher bidram

unread,
Jun 9, 2026, 4:43:25 AM (4 days ago) Jun 9
to lua-l
Hello again, i don't know why my message was incomplete 😅. I am making a Lua like DSL in C++, unlike standard Lua it does not use a Virtual Machine Loop or Traditional Stack.
I am aiming to get near as possible to Lua's behavior with minimal overhead and reach near native speed.

My issue is that because there is no Stack, Virtual Machine and Lua C API, Libraries such as LOVE2D or others that are bound with Lua using Lua C API wont work in the DSL.
I didn't find any solution for it.

I have 2 questions:
  1. How can i support Libraries that use Lua C API in my DSL?
  2. Is a debug library implementable in the DSL and how?
 
You can review my project at here : https://github.com/MB-Bidram/TinyLC
On Monday, June 8, 2026 at 11:09:47 PM UTC+3:30 Sainan wrote:
???

-- Sainan

TopchetoEU

unread,
Jun 9, 2026, 4:59:01 AM (4 days ago) Jun 9
to lu...@googlegroups.com
Very interesting project! You could workaround this by partially implementing the lua.h (and friends) API with `extern "C"`, so that libraries can talk to you. You will need to still create a stack, but it would only be used by C code, when a call happens into a DSL function, you could completely sidestep the stack.

As for debugging, you could *probably* do some native stack unwinding, although that's gonna be very tricky...


Sent with Proton Mail secure email.
> --
> You received this message because you are subscribed to the Google Groups "lua-l" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to lua-l+un...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/lua-l/921c26aa-6cb4-4eb5-b9ed-d4f0847ab118n%40googlegroups.com.

Sainan

unread,
Jun 9, 2026, 5:17:42 AM (4 days ago) Jun 9
to lu...@googlegroups.com
Your message wasn't incomplete, I was just baffled.

My observation: Your project is a C++ standard library with a Lua skin.

Your goal, apparently: Compatibility with Lua and it will have better performance because you implemented less and C++.

My prediction: You will have to (re)implement most stuff to achieve your compatibility goal. You will find equal or worse performance to Lua.

-- Sainan

Martin Eden

unread,
Jun 9, 2026, 5:27:57 AM (4 days ago) Jun 9
to lu...@googlegroups.com
On 2026-06-08 21:39, 'Sainan' via lua-l wrote:
> ???
>
> -- Sainan
>
I think OP was going to ask AI, not post to maillist.

-- martin

Reply all
Reply to author
Forward
0 new messages