ludit

Ludi Documentation

Ludi is a language meant to express and compute boolean algebra expressions in the CLI.

Table of contents


Operators

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 !

Simple Expressions

Expressions will print to the console as a boolean truth table.

A * B

Expressions containing only constants will print as a single calculation

1 * 1

Functions

Defining Functions

Ludi allows for function definitions

def foo = A * B + C

The definition won't print to the console, but the call will.


Calling Functions

There are two way of calling functions. There are Integral and Concrete function calls

Integral calls will print a truth table to the console

foo

You 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

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 ~r

Here is an example with multiple attributes

A * B + C ~tr7

Here are all the possible attributes

Attributes 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


Includes

Ludi allows you to include files

You can include files with a local path

include "./bar"

A global path

include "/home/vlev/myfile"

Or use a library

include "std"

Helpful Syntax

You can write comments by prefixing #

# Ludi is dope as hell yow

You can print text by prefixing it with - This is useful to add titles to tables or calculations

- Hello world

Use proper syntax highlighting

Vim 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

Generated using TypeDoc