Git Product home page Git Product logo

arret's Introduction

Arret

License Build status

Overview

Arret is pure functional, strongly typed language with Lisp-like syntax. It aims to combine the expressiveness of Lisp with guarantees provided by functional programming. The language design documentation has a high-level summary of the language's design choices.

The Arret compiler and parts of its standard library are written in Rust. The mechanism for calling Rust code from Arret is referred to as the Rust Function Interface or RFI. Documentation for the arret_runtime crate describes the core concepts of the RFI.

Installation

Docker REPL Image

There is a public Docker image at ghcr.io/etaoins/arret-repl that runs the Arret REPL. Whenever cargo run repl appears in the documentation this command can be used instead:

> docker run -ti ghcr.io/etaoins/arret-repl

It can also evaluate single file programs:

> cat hello-world.arret
(import [stdlib base])
(defn main! ()
  (println! "Hello, world!"))

> docker run -i ghcr.io/etaoins/arret-repl eval - < hello-world.arret
Hello, world!

Build Requirements

  1. A Unix-like host running on ARM64, x86-64 or x86-32. These are the platforms supporting lazy compilation with LLVM's ORC JIT.
  2. LLVM 10 or 11
  3. Rust

Building with rustup and Cargo

> curl https://sh.rustup.rs -sSf | sh
> cd ~/path/to/repo/root
> cargo run repl

Usage

REPL

The REPL provides an interactive environment for exploring Arret. It's supported as a first class environment in Arret; the REPL is just as powerful as the compiler.

> cargo run repl
arret> (length '(1 2 3 4 5))
=> 5
arret> (defn identity #{T} ([x T]) -> T x)
defined
arret> /type identity
=> (All #{T} T -> T)
arret> (identity "Hello, world!")
=> "Hello, world!"
arret> /type (identity [one two three])
=> (Vector 'one 'two 'three)
arret> /quit

Compiler

Compiled programs have a (main!) function as their entry point:

(import [stdlib base])

(defn main! ()
  (println! "Hello, world!"))

These can be compiled to a static binary by running Arret with the path name:

> cargo run compile hello-world.arret
> ./hello-world
"Hello, world!"

Editors

A basic Visual Studio Code extension is bundled in editors/code. This uses the Language Server from the lsp-server crate.

# Install `arret-lsp-server`
cargo install --path lsp-server

# Install the Visual Studio code extension
cd editors/code
yarn
yarn vscode:install

Examples

The Arret language is still rapidly evolving. This makes it impractical to provide accurate documentation of the language and standard library. However, the test programs in run-pass give examples of working Arret code.

arret's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar etaoins avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

iomeone mwatts yibit

arret's Issues

Occurrence typing does not work with polymorphic types

This intuitively correct code does not compile:

(defn generic-typing #{[T Num]} ([input T]) -> T
  (if (float? input)
    (ann input Float)
    (ann input Int)))

Within our current type inference architecture we have two options:

  1. Ignore occurrence typing and leave input as T in both branches. This is the current behaviour and allows input to still satisfy T.
  2. Override input's type to Float/Int in the branches. This means input no longer satisfies T because we "forget" that it used to be a T.

The fundamental problem is we have no way of internally representing constrained versions of polymorphic types

There was an attempt to work around this by updating T's bound in the branches. This allows the above example to compile. However, this is incorrect if multiple variables have type T:

(defn generic-typing #{[T Num]} ([first T] [second T]) -> T
  (if (float? first)
    (ann second Float) ; <-- WRONG
    (ann second Int)))

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Update dependency vsce to v1.103.1
  • Update dependency @types/node to v16
  • Update dependency vsce to v2
  • Update eslint deps (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser, eslint, eslint-plugin-prettier)

Pending Status Checks

These updates await pending status checks. To force their creation now, click the checkbox below.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.


  • Check this box to trigger a request for Renovate to run again on this repository

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

What can I build with arret?

I came across Arret while experimenting with Tree-Sitter, and I really like the choices you've made in designing Arret.

What are Arret's capabilities in regards to binding to other Rust/C library interfaces? How much work is involved in putting together a web server example?

Cheers.

--- edit ---

I just realized I missed a large part of the documentation regarding RFI in the runtime.
https://rustdoc.arret-lang.org/arret_runtime/index.html

So, it looks like it would be possible I can definitely do more research from here, though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.