Coder Social home page Coder Social logo

broom-lang / broom Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 1.0 2.29 MB

A programming language with first-class modules and algebraic effects.

Home Page: https://broom.readthedocs.io

License: BSD 3-Clause "New" or "Revised" License

OCaml 91.58% Makefile 0.44% TeX 5.23% Rust 2.40% Shell 0.13% Vim Script 0.21%
modules algebraic-effects row-polymorphism compiler broom programming-language type-inference generalized-algebraic-data-type implicit type-class

broom's Introduction

Broom

Broom logo

A programming language with first-class modules and algebraic effects. Still very much a work in progress (i.e. not yet usable).

(Planned) Features

  • Functional-first, with strict evaluation
  • ML-style module system with higher-order, recursive and first-class modules
    • Records and modules are the same, à la 1ML
    • First-class ML-modules also provide higher-ranked and higher kinded types
      • with impredicative instantiation
    • Modular implicits support ad-hoc polymorphism and type level programming
  • Algebraic effects and effect handlers
  • Row typed modules, records, polymorphic variants and effects
  • Conventional and simplified syntax
    • extensible with procedural hygienic macros
  • Optimizing whole-program compilation to Javascript or (later) native code

(Abstract) Syntax

program ::= defs
repl_input ::= stmts

stmt ::= def | expr
stmts ::= (stmt (";" stmt)*)? ";"?
alts ::= (stmt ("|" stmt)*)? "|"?

def ::= pat "=" expr
defs ::= (def (";" def)*)? ";"?

exprs ::= types ::= (expr ("," expr)*)? ","?

expr ::=
pat ::=
type ::= 
    | type ("-!" type)? "->" type
    | type "=>" type

    | expr ":" type
    | expr "||" expr
    | expr "&&" expr
    | expr ("==" | "<" | "<=" | ">" | ">=") expr
    | expr ("+" | "-") expr
    | expr ("*" | "/") expr
    | expr OTHER_INFIX expr
    | expr expr+
    | PREFIX expr
    | expr POSTFIX
    | expr "." ID

    | "{" ("|" pat ("," pat)* "->" expr)+ "}" (* function literal *)
    | "{" "|" "->" stmts "}" (* thunk *)
    | "{" "|" "}" (* empty function (uncallable) *)
    | "{" ("|" pat ("," pat)* "=>" expr)+ "}" (* implicit function literal *)
    | "{" stmts "}"
    | "[" exprs "]"
    | "(" exprs ")"
    | "(" ( "||" | "&&"
          | "==" | "<" | "<=" | ">" | ">="
          | "+" | "-"
          | "*" | "/" | "%" ) ")"
    | "{" ":" stmts ")"
    | "[" "|" alts "]"
    | "(" "|" alts ")"
    | "(" ":" types ")"

    | ID
    | "_"
    | CONST

See the intro for a slightly more detailed exposition.

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.