/boolang

A language for boolean algebra

Primary LanguagePython

boolang

Boolang is a language meant for doing boolean algebra. I am making it to help me with my digital logic homework.

Boolang is implemented in python using PLY (Python Lex-Yacc).

Not to be confused with boo-lang

Instructions

Dependencies

You will need python3 and the "ply" module. You can install "ply" from requirements.txt

Setup

Clone the repository and cd into it.

git clone https://github.com/rpshukla/boolang.git
cd boolang

Install dependecies:

pip install -r requirements.txt

Source setup.bash. This will add src to PYTHONPATH and bin to PATH:

source setup.bash

You will have to do this setup every time you open a new bash prompt. If you want to make the changes to your environment variables permanent, add the following line to your .bashrc. Replace PATH_OF_BOOLANG_REPO with the absolute path of ../boolang on your system.

source PATH_OF_BOOLANG_REPO/setup.bash

Usage

Once you have done the setup. You should be able to type "boolang" from any directory in a bash prompt to be dropped into a boolang REPL. If you want to run some boolang code in a file, run:

boolang filename

A Tour of the Syntax

Define a function.

Note: spaces and newlines are not significant.

\def \my_funct [x, y] {
    x'y + xy'
}

Print a truth table for my_funct:

\truth \my_funct