
Urn: A Lisp implementation for Lua - necrodome
http://urn-lang.com/
======
nerdponx
How does this compare to Fennel?

[https://github.com/bakpakin/Fennel](https://github.com/bakpakin/Fennel)

~~~
squiddev
Urn effectively tries to be it's own language which sits on top of the Lua
runtime. I've tried to take the nicest bits of Lua and combine it with macros
and a little more compile-time checking. Though I'm not entirely sure how
successful I've been...

Urn was is very much an experimental project for me: part of me wanted to see
how much I could do with as little syntax. Consequently Urn has comparatively
few "special forms", but meaning it generates less idiomatic Lua.

Fennel is much more an alternative syntax to Lua. Most Lua constructs have a
corresponding Fennel form, meaning the generated code looks more "like Lua".
Lua interop is also much nicer: Urn requires you to declare all variables, so
you have to jump through hoops to use external libraries. With Fennel you can
just go ahead like you would with Lua.

~~~
ansible
Kudos to you for creating and sharing this.

I've toyed around with ideas related to your project. Such as: What if... you
had a Lisp that instead of being based around the classic linked list, was
based around the Lua table instead?

I've briefly tried to come up with formulations for how the code itself should
be represented as a series of nested tables.

And perhaps have a series of nested tables for all variables in the runtime as
well (including local ones), though Lua sort of does this now.

All that would increase ease the introspection, creation of macros, and other
fun stuff. I hadn't started deciding on a syntax or anything either.

------
sillysaurus3
Also see Lumen, a Lisp for Lua and JS:
[https://github.com/sctb/lumen](https://github.com/sctb/lumen)

------
giancarlostoro
I have never asked this before, but Lua seems to have a couple of different
languages implemented in itself, almost making me think of how JavaScript has
a similar offering. Has anyone compared JavaScript and Lua in the language
building regard? I'm curious to see what the most commonly used JS / Lua
features are when designing a new language on top of those two languages. I
know some languages have features that help you to build a new language (or it
seemed to be like that) I think Java / C# do but I don't remember the names of
the classes for that stuff, last I saw it was many years ago. Also of course I
know Lisp lets you get there too, if I were to try to create my own language
I'd try building my own lisp as a first project, and then go from there to try
and make something different.

~~~
fsloth
If you are interested in how to implement languages I've not yet come across a
better introduction than the classic "Structure and interpretation of computer
languages". The 'build your own scheme' section is transferable to any other
language. [https://mitpress.mit.edu/sicp/full-
text/book/book.html](https://mitpress.mit.edu/sicp/full-text/book/book.html)

~~~
sillysaurus3
On the other hand, I've been building languages for a few years, and I never
got anything useful out of that book. If you open it and feel dumb, don't
worry, it's not just you.

MIT and especially books from MIT are held on a pedestal. If you can't
understand them or don't feel like pursuing them, just find a different book.

~~~
giancarlostoro
Any suggestions as opposed to that book? I would appreciate it. :)

~~~
sillysaurus3
The art of the interpreter: [http://repository.readscheme.org/ftp/papers/ai-
lab-pubs/AIM-...](http://repository.readscheme.org/ftp/papers/ai-lab-
pubs/AIM-453.pdf)

On lisp:
[https://www.lurklurk.org/onlisp/onlisp.pdf](https://www.lurklurk.org/onlisp/onlisp.pdf)

Mainly the key is to start tinkering, rather than jump from book to book. Just
start with a very informal v1 and start hacking stuff together. When you run
into a design dead-end, you'll know it because it will become increasingly
hard to make forward progress.

And that's the tricky situation. When you run into a design dead end, what do
you do?

Books! :) And that's where SICP might end up useful.

Or think about the problem really hard, and write down the answer. I've
occasionally pulled that off.

Oh, I thought of one other suggestion: linkers and loaders. It's another
classic. And unlike all the other references, there's no Lisp.

Two more:

Linkers, Ian Taylor:
[https://www.docdroid.net/2L1IZ5y/linkers.pdf](https://www.docdroid.net/2L1IZ5y/linkers.pdf)

Assemblers:
[https://www.docdroid.net/2tgkwNI/assemadvertisasl.pdf](https://www.docdroid.net/2tgkwNI/assemadvertisasl.pdf)

~~~
vram22
>linkers and loaders

Do you mean the book by John Levine? I had read it, it was good.

------
half-kh-hacker
Hey, I used to play ComputerCraft with the lead developer of this project.

Guess that's why it targets Lua.

~~~
squiddev
I can't deny it! Though Urn was much more a "I want to do something with Lua"
project, than something targeting CC. That being said, I know people have got
the compiler running on various other fantasy consoles.

------
i_feel_great
And how is Lua support in the Guile runtime coming along these days?

~~~
bjoli
I think the best bet is [https://github.com/NalaGinrut/guile-lua-
rebirth](https://github.com/NalaGinrut/guile-lua-rebirth)

~~~
krylon
That, combined with Guile-Emacs would be super sweet.

Not that I have anything against Lisp, but an emacs-ish text editor with Lua
as an extension language would be really cool. I know the Zile project tried
something like that, but I have no clue how far they have gotten.

Also, there is a huge body of code written in elisp that has been around for
ages and got properly debugged along the way. Replacing that is not a very
realistic task.

~~~
bjoli
I tried guile-emacs last year, and back then it even ran org.

I doubt it will happen though, since more trivial and much less intrusive
changes to Emacs get bikeshedded into oblivion.

~~~
krylon
Ah, but we still can dream, can't we? ;-)

------
nikofeyn
i have recently become interested in lua, especially the fun looking love
framework [[https://love2d.org/](https://love2d.org/)]. but one thing i have
had trouble understanding is what lua is particularly useful for and/or used
for. can someone explain what type of use cases are up lua's alley? thanks.

~~~
dwc
One of the most popular and compelling real world uses of Lua is for embedded
scripting. It's easy to embed, it's easy to use, for a scripting language it's
blazing fast.

I'm sure Lua has other sweet spots, but that's the one I'm most familiar with.

~~~
kemayo
I've mostly experienced it through World of Warcraft -- it's embedded there as
the language used to write the game's user interface[1]. Then it's exposed to
third-party authors as an API, so they can write addons for the game.

It's also embedded in Wikipedia[2]. Complex templates can be written with Lua
modules, rather than relying on wikitext.

[1]:
[http://wowwiki.wikia.com/wiki/World_of_Warcraft_API](http://wowwiki.wikia.com/wiki/World_of_Warcraft_API)

[2]:
[https://www.mediawiki.org/wiki/Extension:Scribunto](https://www.mediawiki.org/wiki/Extension:Scribunto)

------
Zolomon
This looks interesting! I'm going to take another look at this during my
coming vacation and play around together with
[https://love2d.org/](https://love2d.org/).

------
iLemming
My exposure to Lua is limited around writing Hammerspoon scripts. Lua is nice
but I really wanted to write those scripts in a Lispy language, maybe
something Clojurescque. Has anyone done Hammerspoon either in Urn or Fennel?
Which one should I try? Would that even work?

------
leephillips
Those are very nice error messages.

