broom-lang / broom

A programming language with first-class modules and algebraic effects.
https://broom.readthedocs.io
BSD 3-Clause "New" or "Revised" License
10 stars 1 forks source link
algebraic-effects broom compiler generalized-algebraic-data-type implicit modules programming-language row-polymorphism type-class type-inference

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

(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.