Skip to content

bricked-archive/pure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

pure

license

A programming language with a pure syntax.

Warning

This language is still WIP. The following sections are just a proposal and subject to change.

Syntax

Pure uses forward polish notation, i.e. function names are followed by their arguments. Arguments are matched by the amount of return values a function provides.

let a int 1
let b int 2
let c add a b

Arguments are parsed depending on their type.

int 1
float 0.1
str "Hello!"
# "Comments are actually just expressions with no return value."

Variables

Variables make it possible to refer to a value and override it. They can only be accessed after the first assignment.

set a int 1
set a add a 1

Aliases

Aliases make it possible to refer to a value, but not override it. Thus, they can only be set once. However, they can be accessed from anywhere.

let b a
let a int 1

Functions

Functions can be declared by creating an anonymous function and creating an alias for it.

let inc fn a fn b
  set a add a b

Type Guards

Type guards can be used to limit the types of a function's parameters. They can be any function that has a specific type of parameter types. Usually, all possible parameter types are inferred.

let inc fn a fn b
  num ref a
  num b
  set a add a b

Types

Atomic

  • ref
  • int
  • flt
  • str
  • fn

Compound

  • struct
  • union

Monads

  • opt
  • res

About

A pure and uniform programming language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published