Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Latest commit

 

History

History
133 lines (91 loc) · 2.15 KB

README.md

File metadata and controls

133 lines (91 loc) · 2.15 KB

Steiner

Lang I'm making for fun

How to run locally

You first need to have purescript and spago installed locally.

  1. Clone the repo
  2. Run spago run

This will start the steiner repl.

Note: the first time you try and run it will take a while since spago will have to install all the dependencies and stuff.

Commands in the repl

Command Description
:ast expr print the ast an expression parses to
:t expr Infer the type of an expression
:check (expr) type Check if an expression has a type
:s type type Check if a type is at least as polymorphic as another
:u type type See the result of unifying 2 types
:q Quit the repl
:clear Clear the console

Syntax

Comments

  1. single line

    -- something
  2. multi line

    {-
        Something
    -}

Types

  • Constants:

    Constants can start with any uppercase letter

    Int
    String
    Bool
    ...
  • Variables:

    Variables need to start with a lowercase letter

    something
    otherVar
    ...
  • Lambdas

    type -> type
  • Rank N Types

    forall name. type -- this can reference name

Expressions

  • Int literals

    0
  • float literals

    0.0
  • string literals

    "something"
  • If expressions

    if condition then expression else expression
  • Lambdas

    \a -> expression -- this can reference a
  • Type annotations

    expression :: type
  • Application

    function argument
  • Let expressions

    let name = expression in body -- this can reference name
  • Assumptions

    assume name :: type in expression -- this can reference name