broom-lang / broom

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

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

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

https://broom.readthedocs.io

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


Languages

Language:OCaml 91.6%Language:TeX 5.2%Language:Rust 2.4%Language:Makefile 0.4%Language:Vim Script 0.2%Language:Shell 0.1%