FlowLang
所属分类:编程语言基础
开发工具:Rust
文件大小:0KB
下载次数:0
上传日期:2023-06-27 14:02:29
上 传 者:
sh-1993
说明: [WIP]一种静态类型的函数式编程语言。
([WIP] A statically typed, functional programming language.)
文件列表:
Cargo.lock (14645, 2023-07-04)
Cargo.toml (39, 2023-07-04)
LICENSE (11357, 2023-07-04)
examples/ (0, 2023-07-04)
examples/math.fw (262, 2023-07-04)
lang/ (0, 2023-07-04)
lang/Cargo.toml (244, 2023-07-04)
lang/lib/ (0, 2023-07-04)
lang/lib/std.fw (176, 2023-07-04)
lang/src/ (0, 2023-07-04)
lang/src/evaluation/ (0, 2023-07-04)
lang/src/evaluation/builtin.rs (6407, 2023-07-04)
lang/src/evaluation/data.rs (1442, 2023-07-04)
lang/src/evaluation/display.rs (1021, 2023-07-04)
lang/src/evaluation/env.rs (2390, 2023-07-04)
lang/src/evaluation/error.rs (765, 2023-07-04)
lang/src/evaluation/mod.rs (5847, 2023-07-04)
lang/src/lib.rs (372, 2023-07-04)
lang/src/parsing/ (0, 2023-07-04)
lang/src/parsing/combinators.rs (9765, 2023-07-04)
lang/src/parsing/data.rs (6042, 2023-07-04)
lang/src/parsing/display.rs (2764, 2023-07-04)
lang/src/parsing/error.rs (658, 2023-07-04)
lang/src/parsing/mod.rs (1443, 2023-07-04)
lang/src/parsing/string.rs (3789, 2023-07-04)
lang/tests/ (0, 2023-07-04)
lang/tests/evaluation.rs (2241, 2023-07-04)
lang/tests/parsing.rs (5945, 2023-07-04)
repl/ (0, 2023-07-04)
repl/Cargo.toml (261, 2023-07-04)
repl/src/ (0, 2023-07-04)
repl/src/colors.rs (5484, 2023-07-04)
repl/src/error.rs (945, 2023-07-04)
repl/src/main.rs (1247, 2023-07-04)
repl/src/repl.rs (2290, 2023-07-04)
... ...
# FlowLang
[![Rust](https://github.com/luizgabriel/FlowLang/actions/workflows/rust.yml/badge.svg?branch=main)](https://github.com/luizgabriel/FlowLang/actions/workflows/rust.yml)
[WIP] A ~statically typed~, functional programming language.
## Example Syntax:
### Function Definition & Application
```hs
square x = x * x
hypotenuse x y = sqrt (square x + square y)
hypotenuse 3 4
```
### Operator Functions Definitions & Application
```hs
(**) x y = hypotenuse x y
3 + (5 ** 6) / 2
```
### Piping & Composing Operators
```hs
add5 = (+) 5
times2 = (*) 2
7 |> times2 |> add5
add5_and_times2 = add5 >> times2
add5_and_times2 10
```
### If Expressions
```hs
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
```hs
add1 = x -> x + 1
add1 5
```
### Import Modules
Loads module from `./examples/math.fw`
```hs
import examples::math
eq_root1 1.0 3.0 2.0
```
### Recursive Functions
```hs
fib n = if n < 1 then 1 else fib (n - 1) + fib (n - 2)
```
### Block Expressions
The last statement is the return value.
```hs
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](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:
```sh
cargo run -p repl -q
```
近期下载者:
相关文件:
收藏者: