Skip to content

planklang/grammar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

PlankLang grammar

Plank (or PlankLang) is a new programming language to perform easily math expressions. It aims to be simple, straightforward, readable, intuitive and modular.

Example

This is a simple Plank script.

# define a variable
let x = 2

# function with two args
let f: x, y -> x^y

# recursive fibonacci
let fib: x
| when x = 0 -> 0
| when x = 1 -> 1
| when x > 1 -> fib(x-1) + fib(x-2)

# display the results
1+x # prints 3
f(x,x) # prints 4
fib(3) # prints 2

You can oneline easily this script. Plank uses ;; to separe two instructions.

let x = 2;; 1+x

is equivalent to

let x = 2
1+x

You can also oneline functions!

let fib: x when x = 0 -> 0 | when x = 1 -> 1 | when x > 0 -> fib(x-1) + fib(x-2)

Specification

We are currently working on this.

The EBNF file describing the grammar is available here.

Learn

We are currently working on this.

Releases

Packages

Contributors