An open API service indexing awesome lists of open source software.

https://github.com/abrams27/fibin-language

A simple functional language written using c++ templates
https://github.com/abrams27/fibin-language

cpp-templates interpreter language

Last synced: about 1 year ago
JSON representation

A simple functional language written using c++ templates

Awesome Lists containing this project

README

          

# fibin language
A simple functional language written using c++ templates.

---
coauthor: [@Pawel494](https://github.com/Pawel494)

# Semantics
* Literals `Lit` - only allowed Fibbonaci numbers (non negative): `Fib<0> = 0, Fib<1> = 1 ...`
or logic values: `True, False`, \
example:
```
Lit>, Lit
```

* Variables `Var`:
```
Var(const char*)
```
labels are string (1 to 6 signs) with letters (case insensitive) and digits, \
example:
```
Var("A"), Var("01234"), Var("Cdefg")
```

* Arithmetic operations `Sum, Inc1, Inc10`
- `Sum<...>` - multiple arguments sum (at least two),
- `Inc1` - adds `Fib<1>` to `Arg`,
- `Inc10` - adds `Fib<10` to `Arg`,

example:
```
Sum>, Lit>, Lit>>, Inc1>>
```

* Comparison `Eq` -
`Eq` compares value of Left with Right, \
example:
```
Eq>, Lit>>
```

* Refernce `Ref` -
`Ref` return the value of `Var`, \
example:
```
Ref
```

* Expression `Let` -
`Let` assigns `Value` to the `Var` and calculates given `Expression`, \
example:
```
Let>, Ref>
```

* Expression `If` -
`If` if `Condition` result is True then calculates value of `Then` otherwise value of `Else` is calculated, \
example:
```
If, Lit>, Lit>>
```

* Expression `Lambda` -
`Lambda` reprezents anonymous function with singe input argument `Var` and body `Body`, \
example:
```
Lambda>
```

* Function invocation `Invoke` -
`Invoke` calculates `Fun` result for the given input parameter `Param`, \
example:
```
Invoke>, Lit>>
```