LogicGate
Designed by | User:Taokyle |
---|---|
Appeared in | 2023 |
Computational class | Unknown |
Major implementations | Original |
File extension(s) | .lgeso |
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.
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)
Running
A program is a text file which extension is .lgeso
. To execute it, you will need a LogicGate interpreter. The only know one was made by User:Taokyle himself and is available on Github. Most of the documentation is on Github (as for the example program below).
Here is a quick break down of the interpreter and its inner working:
To use it, import the python file LogicGate.py
in your python script, or just run LogicGate.py
Remember for the run
function, only the filename argument is needed.
The run
function will return an exit code, and an outputs of the file will be printed (binary to ascii, and logical binary if enabled)
On the contrary, the compile function doesn’t return anything. But it can write code in .lgeso
file.
Examples Program
Here is a hello world program 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