LuaGravity is the name of my toy language that implements the synchronous approach for concurrency (I'll dig into it sometime).
(Actually, it's a *serious* toy language as a I'm very concerned to it and keep adding features and tweaking it all the time.)
When running it without a filename, you'll see a prompt just like in the Lua Language [1].
As you type the statements and expressions you'll attest that it's just normal Lua...
Except, it's reactive!
The video above shows that the variables a and b reacts to the current time, a - b to a and to b, and so on.
The INT function integrates its argument over dt (remember it from Calculus?).
It's used here only to create a time reference for the application.
The L function states to its arguments that they should behave reactively (the name comes from "function Lifting").
The result of the expression a - b shows the perfect synchronism between its arguments: no need for locks, no milliseconds difference, no text blinking, just zero as it is expected.
LuaGravity is roughly based on Esterel [2] and FrTime [3], two synchronous languages, the former having an imperative style, the latter being functional.
The example above shows only some functional features.
Here are some LuaGravity Implementation Facts:
- It's implemented over the Lua language runtime (there's no need to parse source code).
- The engine running the system is "just" an event handler.
- The elapsed time during an event handling determines the dt value used by INT and varies over the time.
- The prompt you see is a collection of graphical objects (no, it's not a magical raw terminal).
- It's single threaded, of course.
- The engine's whole source has about 300 lines of Lua code.
- Chuck Norris wrote a version in assembly in 2 hours.
[1] http://www.lua.org
[2] http://www-sop.inria.fr/meije/esterel/esterel-eng.html
[3] http://www.cs.brown.edu/research/pubs/techreports/reports/CS-03-20.html
Two things:
ReplyDelete1)Can I write the f word here? This is f awesome, I can't wait to see the graphics thingies! And I may stop by your office tomorrow and hit you for not talking about this before!
2)You're getting seriously nerdy here. I mean, a Chuck Norris joke? :P
Three things:
ReplyDelete1) congratulations for your initiative.
2) I'd like to see how it works with programs involving intensive calculations. As you might know performance is a critical issue in my research (statistical learning).
1) you are getting seriously nerd here... Chuck Norris..
About intensive calculation programs, I don't see it as an obvious area.
ReplyDeleteThe reactivity should not slow down things, though.
You create the relations because you need it and you'd have to implement it by hand w/o reactivity.
Simulation, GUI, AI, CG, Games and Multimedia are more obvious areas.
The nerdy joke is to attract my target audience. ;)
It's a pity you can't override == for different types in Lua, or you wouldn't even have to lift EVEN. BTW, as you are abbreviating lift with L, have you thought about abbreviating integrate with S (the obvious mnemonic is the math symbol)? Then you could have gravity.integrate and gravity.lift as the "official" names and S and L as the aliases.
ReplyDeleteAs you know, the same holds for ">", "not", "and", etc.
ReplyDeleteThe aliases for these liftings are: GT, NOT, AND, etc.
So, I could have written EQ(a%2, 0) instead of EVEN...
I'll use S for integration and D for derivative (currently DER).
thanks
wow, congrats. let us see the example with graphics ;)
ReplyDelete