Clojure-esque extension language for Go.

Overview

Squishy loafer

Tests

let-go

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

This is supposed to be a compiler and bytecode VM for a language resembling Clojure as close as possible.

Now, I know about candid82/joker and I 💛 it. Though, it has some drawbacks and design choices that I'd like to avoid.

Here are some nebulous goals in no particular order:

  • Quality entertainment,
  • Implement as much of Clojure as possible - including persistent data types and true concurrency,
  • Provide comfy two-way interop for arbitrary functions and types,
  • Serve primarily as an embedded extension language,
  • Standalone interpreter mode and AOT (let-go -> standalone binary) would be nice eventually,
  • Strech goal: let-go bytecode -> Go translation.

Here are the non goals:

  • Stellar performance,
  • Being a drop-in replacement for clojure/clojure at any point,
  • Being a linter/formatter/tooling for Clojure in general.

Current status

It doesn't do much yet - just started laying down the basics. Come back in a couple of months to see cool demos.

See compiler tests if you're really interested.

Issues
  • Closed over values are retained forever after an invoke

    Closed over values are retained forever after an invoke

    https://gist.github.com/alimpfard/8a04fd0816036ed314098964b3131588#gistcomment-3657876

    A hacky solution would be to just introduce a "clear closure" op (a more interesting solution could be to have something akin to leave take care of cleaning up functions post-invoke):

    Hacky solution
    diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go
    index 304beba..d2c977c 100644
    --- a/pkg/compiler/compiler.go
    +++ b/pkg/compiler/compiler.go
    @@ -205,6 +205,7 @@ func (c *Context) leaveFn(ctx *Context) {
     
     	// if we have a closure on our hands then add closed overs
     	if ctx.isClosure {
    +		c.emit(vm.OPPCK)
     		for _, clo := range ctx.closedOvers {
     			_ = clo.source().emit()
     			c.emit(vm.OPPAK)
    diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go
    index 41828a0..45afb9b 100644
    --- a/pkg/vm/vm.go
    +++ b/pkg/vm/vm.go
    @@ -45,6 +45,7 @@ const (
     
     	OPLDK // load closed over LDK (index int32)
     	OPPAK // push closed over value to a closure
    +	OPPCK // clear closed over values
     
     	OPREC // loop recurse REC (offset int32, argc int32)
     	OPREF // function recurse REF (argc int32)
    @@ -67,6 +68,7 @@ func OpcodeToString(op uint8) string {
     		"LDV",
     		"LDK",
     		"PAK",
    +		"PCK",
     		"REC",
     		"REF",
     	}
    @@ -492,6 +494,19 @@ func (f *Frame) Run() (Value, error) {
     			fun.closedOvers = append(fun.closedOvers, val)
     			f.ip++
     
    +		case OPPCK:
    +			idx := f.sp - 1
    +			if idx < 0 {
    +				return NIL, NewExecutionError("PCK stack overflow")
    +			}
    +			cls := f.stack[idx]
    +			if cls.Type() != FuncType {
    +				return NIL, NewExecutionError("PCK expected a Fn")
    +			}
    +			fun := cls.(*Func)
    +			fun.closedOvers = nil
    +			f.ip++
    +
     		case OPREF:
     			arity, err := f.code.Get32(f.ip + 1)
     			if err != nil {
    
    opened by alimpfard 5
  • Add license scan report and status

    Add license scan report and status

    Your FOSSA integration was successful! Attached in this PR is a badge and license report to track scan status in your README.

    Below are docs for integrating FOSSA license checks into your CI:

    opened by fossabot 1
Owner
Marcin Gasperowicz
Your average programming language tourist.
Marcin Gasperowicz
a decision & trigger framework backed by Google's Common Expression Language used in graphikDB

a decision & trigger framework backed by Google's Common Expression Language used in graphikDB

null 61 Apr 24, 2022
This is an open source project for commonly used functions for the Go programming language.

Common Functions This is an open source project for commonly used functions for the Go programming language. This package need >= go 1.3 Code Conventi

ᴜɴᴋɴᴡᴏɴ 730 Jun 12, 2022
hdq - HTML DOM Query Language for Go+

hdq - HTML DOM Query Language for Go+ Summary about hdq hdq is a Go+ package for processing HTML documents. Tutorials Collect links of a html page How

Qiniu Cloud 26 Jun 17, 2022
Rest Api Generator for Golang Programming Language

Rest Api Generator for Golang Programming Language

Eko Kurniadi 3 Nov 29, 2021
Small Clojure interpreter, linter and formatter.

Joker is a small Clojure interpreter, linter and formatter written in Go. Installation On macOS, the easiest way to install Joker is via Homebrew: bre

Roman Bataev 1.4k Jun 22, 2022
Carbon for Golang, an extension for Time

Carbon A simple extension for Time based on PHP's Carbon library. Features: Time is embedded into Carbon (provides access to all of Time's functionali

Uniplaces LTD 704 Jun 6, 2022
Theia Go Extension

Theia Go Extension An extension for the Theia-IDE to support the Go language, using the Go language server. Getting started Install nvm. curl -o- http

theia-ide 16 Nov 14, 2021
Go extension for VS Code

Go for Visual Studio Code The VS Code Go extension provides rich language support for the Go programming language. Quick Start Welcome! ???? Whether y

Go 2.7k Jun 24, 2022
kubequery is a Osquery extension that provides SQL based analytics for Kubernetes clusters

kubequery powered by Osquery kubequery is a Osquery extension that provides SQL based analytics for Kubernetes clusters kubequery will be packaged as

Uptycs Inc 66 May 23, 2022
Client extension for interacting with Kubernetes clusters from your k6 tests.

⚠️ This is a proof of concept As this is a proof of concept, it won't be supported by the k6 team. It may also break in the future as xk6 evolves. USE

k6 16 Jun 17, 2022
⚙️ A k6 extension for Tarantool

xk6-tarantool This is a k6 extension using the xk6 system. ❗ This is a proof of concept, isn't supported by the k6 team, and may break in the future.

Sergey Kononenko 7 Jan 20, 2022
Worker failover support for PostgreSQL Citus extension using pg_auto_failover.

citus-failover Worker failover support for citus community version using pg_auto_failover. What is this? This is a simple service to monitor changes i

Navid Zarepak 20 Jun 5, 2022
Lambda Extension for iamlive

iamlive Lambda Extension The iamlive Lambda Extension helps generate a least-privilege IAM policy by monitoring the AWS calls made within the Lambda e

Ian Mckay 33 May 26, 2022
Kubernetes OS Server - Kubernetes Extension API server exposing OS configuration like sysctl via Kubernetes API

KOSS is a Extension API Server which exposes OS properties and functionality using Kubernetes API, so it can be accessed using e.g. kubectl. At the moment this is highly experimental and only managing sysctl is supported. To make things actually usable, you must run KOSS binary as root on the machine you will be managing.

Mateusz Gozdek 3 May 19, 2021
k6 prometheus output extension

xk6-prometheus A k6 extension implements Prometheus HTTP exporter as k6 output extension. Using xk6-prometheus output extension you can collect metric

Iván Szkiba 33 Jun 20, 2022
General Pod Autoscaler(GPA) is a extension for K8s HPA, which can be used not only for serving, also for game.

Introduction General Pod Autoscaler(GPA) is a extension for K8s HPA, which can be used not only for serving, also for game. Features Compatible with a

Open Cloud-native Game-application Initiative 13 Jun 27, 2022
Standalone client for proxies of Windscribe browser extension

windscribe-proxy Standalone Windscribe proxy client. Younger brother of opera-proxy. Just run it and it'll start a plain HTTP proxy server forwarding

null 43 Jun 7, 2022
An extension for the GitHub Cli application that displays your current contribution graph

gh-graph An extension for the GitHub Cli application that displays your current contribution graph in the terminal (logged out contribution graph) Ins

Benjamin Chadwick 14 Sep 29, 2021
An extension for discordgo to create a Discord bot quickly using the Builder pattern.

botbuilder An extension for discordgo to create a Discord bot quickly using the Builder pattern. Example usage: package main import ( "log" "os"

baka da yo 5 Apr 15, 2022
Small gh extension that suggests issues to work on in a given GitHub repository

gh contribute being a gh extension for finding issues to help with in a GitHub repository. This extension suggests an issue in a given repository to w

Nate Smith 22 May 12, 2022
entviz is an ent extension that provides visualization of the schema graph

entviz entviz is an ent extension that creates visual graph (html file) of your ent's schema. install go get github.com/hedwigz/entviz add this exten

Amit Shani 73 Jun 26, 2022
being a gh extension that runs animated terminal "screensavers"

gh-screensaver being a gh extension that runs animated terminal "screensavers" usage gh screensaver run a random screensaver gh screensaver -s pipes r

Nate Smith 112 Jun 23, 2022
extension of SMx crypto support for go standard lib

Crypto Extension support of China crypto standards for go lib. You can simply copy and replace them to [your_go_src_path]/crypto Use as vendor is alte

null 4 Dec 3, 2021
gh extension for bumping version of a repository

gh bump a gh extension for bumping version of a repository. Usage gh bump with another repository. gh bump -R <repository> Installation gh extension

null 29 Jun 5, 2022
a gh extension that prints out an oblique strategy

gh-oblique being a gh extension that prints one of the oblique strategies install gh extension install vilmibm/gh-oblique run $ gh oblique Be dirty.

Nate Smith 9 May 12, 2022
A plugin for running Open Policy Agent (OPA) in AWS Lambda as a Lambda Extension.

opa-lambda-extension-plugin A custom plugin for running Open Policy Agent (OPA) in AWS Lambda as a Lambda Extension. To learn more about how Lambda Ex

GoDaddy 23 May 10, 2022
PolarDB-X Operator is a Kubernetes extension that aims to create and manage PolarDB-X cluster on Kubernetes.

GalaxyKube -- PolarDB-X Operator PolarDB-X Operator is a Kubernetes extension that aims to create and manage PolarDB-X cluster on Kubernetes. It follo

null 57 Jun 16, 2022
GitHub CLI extension to preview your markdown similar to the style of GitHub.

gh markdown-preview GitHub CLI extension to preview your markdown similar to the style of GitHub gh markdown-preview is a GitHub CLI extension to prev

Yusuke Wada 122 Jun 16, 2022
ROFL eXtension Debugger - for League of Legends replay files

ROFLXD - ROFL eXtension Debugger This is an incomplete project. The original goal of this project was to convert GLR replays to a form that was playab

Fraxiinus 0 Apr 11, 2022