- C 97.1%
- Makefile 2.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .gitignore | ||
| history.txt | ||
| main.c | ||
| makefile | ||
| README.fr.md | ||
| README.md | ||
Assert checker
This is a simple assertion checker written in C.
Installation
This is the english version of the documentation. Go to README.fr.md to get the french version)
Follow the installation steps for your platform :
MacOS is not listed here, because I never tried it. Please propose changes if you tested the installation on MacOS
Linux
- Install dependencies, that are :
git,gccandmake. For example, on debian-based distributions :sudo apt install git gcc make - Get source code (using git) :
git clone https://git.greensky.tf/Greensky/assert-checker && cd assert-checker - Compile the code to an executable :
make - You can now use the
main.exefile, by following the usage instructions
Run the command listed above in a terminal
Windows
- Install dependencies :
git,gccandmakethrough regular installation, or using winget :
winget install -e --id Arm.GnuArmEmbeddedToolchain
winget install -e --id GnuWin32.Make
winget install -e --id Git.Git
- Get source code (using git) :
git clone https://git.greensky.tf/Greensky/assert-checker && cd assert-checker - Compile the code to an executable :
make - You can now use the
main.exefile, by following the usage instructions
Use the above commands in a terminal (windows + R, type
cmdand enter)
Usage
Once you have the main.exe file executable, you can use it by launching the script. It will ask you to enter an expression. An expression is composed of :
- Variables, represented by single letters
- Operators
- Parenthesis, that create groups
Operators list
| Operator | Symbol | Syntax |
|---|---|---|
| Logical and | & |
X&Y |
| Logical or | | |
X|Y |
| Logical not | ! |
!X |
| Logical implication | - |
X-Y |
| Group of expression | ( and ) |
(X) |
In the above syntax description, a X, Y means a valid assertion, so it is at least a variable, and at most one or two assertions, joined by operator
Examples
All the below examples are valid expressions to the program to parse (one per line)
a
B&c
(a&c)-d
(a|(b&d))|c-d
(a|b)-(c&(d|v)|a)
(((!p&s)|(g|!s))|(!t&!g))&((s|!g)&(r|s))
Program complexity
If n is the number of different variables, the program has a complexity of O(2^n).
Since it is written in native C, it is very fast anyway.