let-go

command module
v0.0.0-...-73db05b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 10 Imported by: 0

README

Squishy loafer

Tests

let-go

Greetings loafers! (λ-gophers haha, get it?)

This is a bytecode compiler and VM for a language closely resembling Clojure, a Clojure dialect, if you will.

Here are some nebulous goals in no particular order:

  • Quality entertainment,
  • Making it legal to write Clojure at your Go dayjob,
  • Implement as much of Clojure as possible - including persistent data types and true concurrency,
  • Provide comfy two-way interop for arbitrary functions and types,
  • AOT (let-go -> standalone binary) would be nice eventually,
  • Strech goal: let-go bytecode -> Go translation.

Here are the non goals:

  • Stellar performance (cough cough, it seems to be faster than Joker),
  • Being a drop-in replacement for clojure/clojure at any point,
  • Being a linter/formatter/tooling for Clojure in general.

Current status

It can eval a Clojure-like lisp. It's semi-good for solving Advent of Code problems but not for anything more serious yet.

There are some goodies:

  • Macros with syntax quote,
  • Reader conditionals,
  • Destructuring,
  • Multi-arity functions,
  • Atoms, channels & go-blocks a'la core.async,
  • Regular expressions (the Go flavor),
  • Simple json, http and os namespaces,
  • Many functions ported from clojure.core,
  • REPL with syntax-highlighting and completions,
  • Simple nREPL server that seems to work with BetterThanTomorrow/calva,

I'm currently contemplating:

  • Dynamic variables,
  • Exceptions & more comprehensive runtime errors,
  • Numeric tower i.e. floats, bignums and other exotic number species,
  • Optimized persistent data-structures and laziness,
  • Records and protocols,
  • A real test suite would be nice,

Examples

See:

Try online

Check out this bare-bones online REPL. It runs a WASM build of let-go in your browser!

Prerequisites and installation

Building or running let-go from source requires Go 1.19.

go install github.com/nooga/let-go@latest

Try it out:

let-go

Running from source

The best way to play with let-go right now is to clone this repo and run the REPL like this:

go run . 

To run an expression:

go run . -e '(+ 1 1)'

To run a file:

go run . test/hello.lg

Use the -r flag to run the REPL after the interpreter has finished with files and -e:

go run . -r test/simple.lg                # will run simple.lg first, then open up a REPL
go run . -r -e '(* fun 2)' test/simple.lg # will run simple.lg first, then (* fun 2) and REPL 

🤓 Follow me on twitter 🐬 Check out monk.io

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
api
rt
vm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL