The Ludus programming language.
Go to file
Scott Richmond 86cb4c2d76 Smol change
2023-11-26 12:18:57 -05:00
.helix Add project helix config 2023-09-16 13:48:37 -04:00
assets Keep working, cljs repl :((((( 2023-11-24 13:17:20 -05:00
doc leinify 2021-10-30 14:51:35 -04:00
src/ludus Smol change 2023-11-26 12:18:57 -05:00
test/ludus Keep working, cljs repl :((((( 2023-11-24 13:17:20 -05:00
.gitattributes Initial commit 2021-10-21 12:47:28 -04:00
.gitignore Clean .gitignore up 2023-11-26 12:16:13 -05:00
CHANGELOG.md leinify 2021-10-30 14:51:35 -04:00
deps.edn Wire up proof of concept! 2023-11-24 18:41:26 -05:00
foo.ld Wire up repl & file interpreters. 2023-06-01 15:06:33 -06:00
graal-compile.sh fix graal compile opts for vthreads 2023-01-28 17:48:43 -05:00
justfile Clean it up, wire it up. 2023-11-16 19:16:31 -05:00
LICENSE Eclipse->GPL 2022-05-24 23:47:27 -04:00
logo.png Add logo 2022-04-28 17:07:26 -04:00
ludus.sublime-project Add post-save cljfmt 2022-05-27 19:40:40 -04:00
notary.json Add build tooling 2022-05-24 23:18:41 -04:00
package-lock.json Wire up proof of concept! 2023-11-24 18:41:26 -05:00
package.json Wire up proof of concept! 2023-11-24 18:41:26 -05:00
project.clj Keep working, cljs repl :((((( 2023-11-24 13:17:20 -05:00
README.md Typofix 2022-05-26 18:06:05 -04:00
sandbox.ld Futz with sandbox 2023-09-16 13:48:50 -04:00
shadow-cljs.edn Wire up proof of concept! 2023-11-24 18:41:26 -05:00
TODO.xit Add and/or special forms 2023-07-04 12:38:31 -04:00
tokens Many iterations of parser combinator strategies. Not yet working. 2023-05-07 22:49:19 -04:00

Ludus logo

Ludus: A friendly, dynamic, functional language

A reference implementation of an interpreter for the Ludus programming language, using Clojure as a host language.

Ludus is part of the Thinking with Computers project, run by Scott Richmond at the University of Toronto. Ludus is our research language, which aspires to be a free translation of Logo for the 2020s.

Status

Pre-alpha, still under active development. See the ludus-spec repo for progress notes and additional documentation.

Use

  • Clone this repo.
    • git clone https://github.com/thinking-with-computers/ludus
  • Have Clojure and Leiningen installed.
    • On a Mac: brew install clojure leiningen
  • lein run {script}, it runs your script.

Or, download a binary on the releases page. (At current: M1 Mac only.)

Main features

  • Pattern matching
  • No operators: everything is called as a function
  • Persistent or immutable data structures

Under construction

  • Actor model style concurrency
  • Strong nominal data typing, including tagged unions
    • Exhaustiveness-checking in match expressions in dynamically-typed code

Hello, world!

Ludus is a scripting language. At current it does not have a REPL (our aim is to get interactive coding absolutely correct).

Either

"Hello, world!"

=> "Hello, world!"

Ludus scripts (and blocks) simply return their last expression; this script returns the bare string (to stdout) and exits.

Or:

print ("Hello, world!")
=> Hello, world! 
=> :ok

Or, you can use a the print function, which sends a string to stdout. Because print returns the keyword :ok when it completes, that is the result of the last expression in the script--and so Ludus also prints this.

Some code

Fibonacci numbers:

& fibonacci!, with multi-clause fns/pattern matching

fn fib {
	(1) -> 1
	(2) -> 1
	(n) -> add (
		fib (sub (n, 1))
		fib (sub (n, 2)))
}

fib (10) &=> 55

More on Ludus

Most of the (very active, somewhat messy) thinking about Ludus is housed in the ludus-spec repository.