LogicGate
Logic Gate
This language is inspired by logic gates, by using simple alphabet you could make a program.
It is designed as a way for manual encryption, which kinda failed
All you can do in this language is to make a program with logic gates, sounds difficult and indeed it is.
Startup
First, make a logic gate file.
The file extension should be lgeso
also you need the runner
Runner
The code for the runner is [1] here
Also most of the stuff is at the GitHub.
To use it, import the python file LogicGate.py in your python script, or just run the LogicGate.py
Remember for the run function, only the filename argument is needed.
The run function will return an exit code if you are using the run function, and outputs of the file will be printed(binary to ascii, and logical binary if enabled)
The compile function does the otherwise, it doesn’t return anything but it can write code into lgeso file.
syntax
For syntax it is very straight forward. It process each character in each line as each command For gates with multiple inputs (such as or, and) type like other syntax, the quota for the gate will automatically be processed. No linking between words, unless the syntax in the middle is invalid
Basic gates(gates that doesn’t require includes):
A (and gate): the next 2 results will be accepted as inputs. If both inputs are 1, output is 1, else 0
O (or gate): the next 2 results will be accepted as inputs. If one of the inputs are 1, output is 1, else 0
N (not gate): the next 1 result will be accepted as inputs. If the input is 1, output is 0, else 0
1 and 0 (True and False): NO result will be accepted as inputs. They are the results, self explanatory
special syntax
There are 2 special syntax
—-- (three hyphens): new word, used for the ascii output separating the binary for ascii translation
### (three hashes): comment the entire line
For any of the special syntax, they are not being interpreted as special syntax unless the entire syntax appears.
They can be anywhere in a line, and that line will act like what the syntax shows (if the special syntax appears in the same line, they will be scanned and processed according to here)
examples
This is a hello world in LogicGate
1
0
0
1
0
0
0
---
1
1
0
0
1
0
1
---
1
1
0
1
1
0
0
---
1
1
0
1
1
0
0
---
1
1
0
1
1
1
1
---
1
0
0
0
0
0
---
1
0
1
0
1
1
1
---
1
1
0
1
1
1
1
---
1
1
1
0
0
1
0
---
1
1
0
1
1
0
0
---
1
1
0
0
1
0
0
---
1
0
0
0
0
1