Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SquidDev/urn
Yet another Lisp variant which compiles to Lua
https://github.com/SquidDev/urn
compiler language lisp lisp-dialect lisp-variant lua
Last synced: 3 months ago
JSON representation
Yet another Lisp variant which compiles to Lua
- Host: GitHub
- URL: https://github.com/SquidDev/urn
- Owner: SquidDev
- License: bsd-3-clause
- Archived: true
- Created: 2016-12-01T23:42:02.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-08T10:26:47.000Z (about 6 years ago)
- Last Synced: 2024-08-01T03:42:15.076Z (6 months ago)
- Topics: compiler, language, lisp, lisp-dialect, lisp-variant, lua
- Language: Common Lisp
- Homepage: http://urn-lang.com/
- Size: 3.93 MB
- Stars: 363
- Watchers: 17
- Forks: 18
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ![](https://i.imgur.com/XqKyCMC.png) Urn [![Travis Build Status](https://travis-ci.org/SquidDev/urn.svg?branch=master)](https://travis-ci.org/SquidDev/urn) [![Build status](https://gitlab.com/urn/urn/badges/master/build.svg)](https://gitlab.com/urn/urn/commits/master)
Urn is a new language developed by SquidDev, and demhydraz. Urn is a Lisp dialect with a focus on minimalism which compiles
to Lua.## What?
- A minimal¹ Lisp implementation, with full support for compile time code execution and macros.
- Support for Lua 5.1, 5.2 and 5.3. Should also work with LuaJIT.
- Lisp-1 scoping rules (functions and data share the same namespace).
- Influenced by a whole range of Lisp implementations, including Common Lisp and Clojure.
- Produces standalone, optimised Lua files: no dependencies on a standard library.¹: Minimalism is an implementation detail.
## Features
### Pattern matching
> (case '("x" (foo 2 3))
. [(string? @ ?x) (.. "Got a string " x)]
. [("x" (foo . ?x)) (.. "Got some remaining values " (pretty x))])
out = "Got some remaining values (2 3)"### Various looping constructs
> (loop [(o '())
. (l '(1 2 3))]
. [(empty? l) o]
. (recur (cons (car l) o) (cdr l)))
out = (3 2 1)### Powerful assertion and testing framework
> (import test ())
out = nil
> (affirm (eq? '("foo" "bar" "")
. (string/split "foo-bar" "-")))
[ERROR] <stdin>:1 (compile#111{split,temp}:46): Assertion failed
(eq? (quote ("foo" "bar" "")) (string/split "foo-bar" "-"))
| |
| ("foo" "bar")
("foo" "bar" "")### First-class support for Lua tables
> { :foo 1
. :bar 2 }
out = {"bar" 2 "foo" 1}### Friendly error messages
> (]
[ERROR] Expected ')', got ']'
=> <stdin>:[1:2 .. 1:2] ("]")
1 │ (]
│ ^... block opened with '('
1 │ (]
│ ^ ']' used here
>## Getting started
We have a [getting started guide](https://squiddev.github.io/urn/tutorial/01-introduction.html) to help you get set up. Or
you can [clone the repo](https://gitlab.com/urn/urn) and jump right in!The website also contains [documentation for all functions and macros](https://squiddev.github.io/urn/docs/lib.prelude.html),
should you need to check how something works.If you have any questions, would like to contribute or just feel like chatting, do join us in the `#urn` channel on FreeNode.