lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I wonder, Scheme is better for some types of natural language generation… Perhaps this would work for Wikipedia?

On Wed, May 24, 2017 at 10:25 PM, Emeka <emekamicro@gmail.com> wrote:
Great! I will check out.

On May 23, 2017 20:42, "Weird Constructor" <weirdconstructor@gmail.com> wrote:
Hello,

first TL;RD:
I wrote a Scheme/LISP dialect to Lua compiler in Lua.
Didn't want it to bit rot on my hard disks, so I published
it on GitHub: http://github.com/WeirdConstructor/lal

I've been a long time lurker on this mailing list, and have been
using Lua for almost a decade now, with varying intensity.

I'll present it in an Q&A style on this mailing list:

Q: How mature is it?
A: I've been working on it for about a year now. A big part of Scheme
syntax and procedures are supported already, but many are also still missing.
I've created a test suite for LAL that covers most of the implementation,
which helped me a lot with quality control.

I've not yet used it in a production environment,
but for some of my pet/free time/hobby projects. I actually combined
it with a larger runtime, which combines the Lua interpreter with C++
libraries like Boost, POCO and Qt. That project is called LALRT and
can also be found on GitHub. LALRT is actually the second iteration
of an embedded Lua runtime for my projects, which was originally only
based on Qt. But I wanted to be less dependent on Qt and use more
standard C++ for implementation. So I reimplemented it, but have not
reached yet feature coverage of my first iteration.

Q: Which Lua versions are supported?
A: I developed it on 5.3, but I made it compatible with 5.2 too.

Q: Why Scheme/LISP?
A: I am very fond of Scheme, and I would like to be able to combine
Scheme with the simplicity of embedding a Lua interpreter. None of the
embeddable Scheme implementation seemed so active, stable and proven as the current
Lua implementation.

Q: Why Scheme _dialect_?
A: I like the uniform syntax of LISP, and the ability to write macros on
a high level. But I didn't want to be tied too much to R5RS or R7RS Scheme,
even though I use the syntax forms and procedures from R7RS. LAL does not
have hygienic macros yet, but porting some implementation of hygienic macros
should be possible without too much hassle.

Q: How does LAL support Scheme call/cc?
A: It doesn't. In contrast to other Scheme implementations
based on Lua LAL does not try to support language features
that Lua does not have. The idea is, that you can write
some kind of Scheme with the performance implications that Lua
imposes on you.

Q: What about cons cells?
A: cons cells are arguably a core part of Scheme and LISP,
but translating those to a huge amount of 2 element big Lua
tables did not seem like an wise idea to me. The lists from
LISP are actually translated 1:1 to Lua tables. This changes
some performance implications that Scheme actually has w.r.t
the linked list data structures.

Q: Why Lua?
A: I tried to target _javascript_ and Python with my project
actually. But Lua has a very large language feature coverage
with regard to LISP or Scheme. Lexial scopes, block scope (begin .. end),
closures, environments, tail call optimization, strings
that are actually pretty symbolic in nature instead of character
buffers and a very uniform main data structure. If you think about
it, it's amazing how versatile Lua actually is compared to the
currently widely used scripting languages like _javascript_ or Python.
Only Perl could compete.

Q: Why not Python?
A: Because Python does not have a usable form of anonymous closures
and a ton of other artificial limitations in it's language. I'm just
not compatible with it.

Q: The future?
A: I am using LAL for many of my private projects, and will further
complete the language implementation on demand and on my (limited) free time.

Q: Can I help?
A: If you are interested, maybe. Feedback is appreciated and you may use
the GitHub issue tracker, but make sure to at least potentially bring
enough time to implement and fix the things you need yourself.
I don't know when I can find the time to fix someone's problems.



Greetings to everyone,
     Weird Constructor