Ludi is a language meant to express and compute boolean algebra expressions in the CLI.
| Operator | Description |
|---|---|
* |
Multiplication, which translates to and in boolean algebra |
+ |
Addition, which translates to or in boolean algebra |
! |
Negation, which translates to not in boolean algebra |
' |
alias for ! |
Expressions will print to the console as a boolean truth table.
A * BExpressions containing only constants will print as a single calculation
1 * 1Ludi allows for function definitions
def foo = A * B + CThe definition won't print to the console, but the call will.
There are two ways of calling functions.
Integral and Concrete function calls
Integral calls will print a truth table to the console
fooYou can also use different variables in the call, even if the function was defined with A B C.
foo(D, E, F)Concrete calls contain constants, and will print as a single calculation
foo(1, 0, 1)Nothing prevents you from using the functions in other functions
def bar = foo(A, B, C) * !(A + D)
bar(A, B, C, D)and in calls
def baz = A + B
foo(baz(E, F) * A, B, C)Attributes are options you can assign to format your CLI output
You can add them with the ~ identifier
Here is an example
A * B + C ~rHere is an example with multiple attributes
A * B + C ~tr7| Attribute | Description |
|---|---|
r |
Will reverse the labels in a truth table |
k |
Will print a karnaugh table |
t |
Will print a truth table (DEFAULT) |
ANY NUMBER |
Any numeric value will cap the truth table to the number you set |
Ludi features source file includes
You can include files with a local path
include "./bar"A global path
include "/home/vlev/myfile"Or use a library
include "std"Write comments by prefixing #
# Ludi is dope as hell yowPrint text by prefixing it with -
This is useful to add titles to tables or calculations, these will output in exported csv files
- Hello worldVim syntax highlighting for ludi is provided here
.vim/ludi.vim
More detailed documentation about the source code of Ludit/Ludi can be found here
MIT Licence 2022
@matiasvlevi