Skip to content

[WIP] A statically typed, functional programming language.

License

Notifications You must be signed in to change notification settings

luizgabriel/FlowLang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FlowLang

Rust

[WIP] A statically typed, functional programming language.

Example Syntax:

Function Definition & Application

square x = x * x
hypotenuse x y = sqrt (square x + square y)

hypotenuse 3 4

Operator Functions Definitions & Application

(**) x y = hypotenuse x y
3 + (5 ** 6) / 2

Piping & Composing Operators

add5 = (+) 5
times2 = (*) 2
7 |> times2 |> add5

add5_and_times2 = add5 >> times2
add5_and_times2 10

If Expressions

max x y = if x > y then x else y
min x y = if x < y then x else y

max 5 -7
min 6.8 2.7

Lambda Expressions

add1 = x -> x + 1
add1 5

Import Modules

Loads module from ./examples/math.fw

import examples::math

eq_root1 1.0 3.0 2.0

Recursive Functions

fib n = if n < 1 then 1 else fib (n - 1) + fib (n - 2)

Block Expressions

The last statement is the return value.

x = {
    a = 1;
    b = 2;
    a + b
}

some_function x y = {
    a = x * x;
    b = y * y;
    a + b
}

Getting Started

Install the Rust programming language:

https://www.rust-lang.org/pt-BR/learn/get-started

Clone this repository:

git clone git@github.com:luizgabriel/FlowLang.git
cd FlowLang

Run the REPL (Read Evaluate Parse Loop) with:

cargo run -p repl -q

About

[WIP] A statically typed, functional programming language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages