Package: logicgate
LogicGateThis 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 failedAll you can do in this language is to make a program with logic gates,
sounds difficult but it depends.StartupFirst, make a logic gate file. The file extension should be .lgesoFunctionsNote, this README may sometimes be outdated due to how lazy and busy the dev is, for the most updated description of the function arguments please use “help({func})” and replace {func} with the function you want to check, thank you.To use it, importLogicGatein your python script.Remember for the decompile function, only the filename argument is needed.Thedecompilefunction will return the incorrect bits if check, gate and ascii is True, decompiled result if ascii is True, and 0 if otherwise.Outputs of the file will be printed(binary to ascii, and logical binary if enabled) if out is True (true by default).Thecompilefunction does the otherwise, it normally doesn’t return anything but it can write code into lgeso file, or if write is False(default True) then the compiled result will be returned instead of writing into file.Special encrypt modulea special encrypt module is included in this package, which islgEncrypt.it contain two functions, encrypt() and decrypt().encrypt()generates a key file and a data file, they are pure random string when transfered to ascii, but shows message when both being processed by decrypt().
encrypt() have 4 arguments, data file name, key file name, message, output. They are very self explainatorydecrypt()have 5 arguments, data file, key file, sause, debug, debug_ALL.
the first 2 is very self explainatory, forsauseparameter it determinates if the output text is shown or returned for further decryption, assuming the message through encrypt() is encrypted beforehand.
Fordebug, it shows the print output that is hidden, it can be enabled for you to check which bit is wrong. Fordebug_ALLit purposely enable everything that is coded with printing(output) except warnings and errors, this will definatly cause massive lag so it is not recommended to enable.syntaxFor syntax it is very straight forward. It process each character in
every line as individual command.For gates with multiple inputs (such as or,
and) type like other syntax, the quota for the gate will automatically be processed. invalid gate and missing input for gate will raise an error. In almost all scenarios, the case of the gate does not matter.If the code on the same line have more than 1 final outputs, the first one will be used and the rest will be ignoredBasic gates:A (and gate): the next2results will be accepted as inputs. If both
inputs are 1, output is 1, else 0O (or gate): the next2results will be accepted as inputs. If one
of the inputs are 1, output is 1, else 0N (not gate): the next1result will be accepted as inputs. If the
input is 1, output is 0, else 01 and 0 (True and False):NOresult will be accepted as inputs. They are the results, self explanatoryspecial syntaxThere is 1 special syntax— (three hyphens): new word, used for the ascii output separating the binary for ascii translation. Everything else on the line with this syntax will be ignored.### three hashes: comment, anything after this syntax will be ignored until a new lineFor 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 more tham one special syntax appears in the same line, they will be scanned and processed with the priority according to here) (NOT USEFUL CURRENTLY)examples (for version 1.2 -> 3.0)This is a hello world in LogicGate1\n 0\n 0\n 1\n 0\n 0\n 0\n---\n1\n 1\n 0\n 0\n 1\n 0\n 1\n---\n1\n 1\n 0\n 1\n 1\n 0\n 0\n---\n1\n 1\n 0\n 1\n 1\n 0\n 0\n---\n1\n 1\n 0\n 1\n 1\n 1\n 1\n---\n1\n 0\n 0\n 0\n 0\n 0\n---\n1\n 0\n 1\n 0\n 1\n 1\n 1\n---\n1\n 1\n 0\n 1\n 1\n 1\n 1\n---\n1\n 1\n 1\n 0\n 0\n 1\n 0\n---\n1\n 1\n 0\n 1\n 1\n 0\n 0\n---\n1\n 1\n 0\n 0\n 1\n 0\n 0\n---\n1\n 0\n 0\n 0\n 0\n 1\nanother version generated by LogicGate.compile():O1NNAANNNNA1AA1AO0AA1AO1NNANNAA1A1111111111\n NNANNAAAO0O000001\n OO0NNN10\n O1O1NNA1O01\n NNOONNA0O0000\n 0\n AA0NNANNOONNNNAO0A1O0000001\n---\nOO1O1OAO1NNAO111111\n NNNNO0NNAA1O0N01\n OANNOA0O00000\n ANNNNA001\n NNA11\n NNANNA1ANNO0001\n NNAANNAOOA1NNAO10110111\n---\nOA111\n A1OA1OO0A1O1NNA1O0ONNNNNNN0000\n A1O0A00\n A1O0NNAO0O0A111\n NNAO1NNONNNNA1O1111\n O0A1OANNA0NNOO0ON10000\n 0\n---\nO0NNN0\n A1ANNNNNNNNNNO101\n O00\n NNA1OO1ONNAO10110\n OAA1110\n OO0AAO0AAONNO0O0NNO00001100\n NNO0A0ONNN10\n---\nO0O1O0A1NNO1ANNO0AA1O1AA1A1A11111\n NNANNO1ONNNNNNNNNNO0AO11101\n O0OONNNNAAO0N11000\n A1O0N0\n OONNNNOA1ONNOO0AA11100100\n NNO0ON00\n O0OA1NNA1O100\n---\nO0OO1OO1A1O1000\n NNOO0AONNONNO0A0NNA0NNA010010\n NNAA0OOOA0O000001\n A0NNNNN1\n AO0NNNNA1OO0001\n O0OA1O0O0OO0OA1O00000\n---\n1\n A0NNAO0A0OA0NNA1A0000\n NNO0NNA1NNOO011\n NNO0NNA0A0A0NNOO000\n ANNA1AA1NNNNNNNNAA1NNAA1A111111\n NNA1ANNA1OAO1O11111\n A1A1NNA1O1NNANNA1AA1111\n---\nONNNNAOO11110\n OANNOONNA1AA1110111\n AA0NNNNNNO0O0A0O0N10\n NNNNNNOA110\n O1OONNA1101\n A1NNNNA11\n ANNOONNAAO1A1ANNA11111011\n---\nO0NNO0AO0A111\n NNNNNNA1O0ONNA1NNNNO0NNANNOOA1ANNNNAA11110111\n NNO11\n AO0AN101\n OAA1000\n 1\n O0A0NNO0O0NNA0A0NNA1ON10\n---\nO0N0\n NNNNNNO0ONNA1N00\n O00\n O0AN01\n NNONNNNNNNNA111\n NNNNONNOO0000\n AONNO0ANNO00101\n---\nO1ONNANNNNA1111\n NNNNOOOO0NNAA1NNONNO1011111\n NNA0A0A01\n AA1N10\n O1OANNNNNNA1ONNNNOO1AOOO1AAN0110111110\n 0\n OOAO0NNO0A0OAANNA0AONNO0001100000\n---\nA1A1NNO0NNA11\n OA100\n NNANNOA1001\n 0\n NNO0OA0O000\n ANNO0OONNA1O11001\n---Sourcesgitbub:https://github.com/TaokyleYT/LogicGate/Esolang seldom outdated wiki:LogicGateReplit up-to-date version:replitRoadmapVersion 1.2:First release on PyPiVersion 1.3:Introduced enhanced modulelgEncryptBug fixVersion 2.0:Improved comment functionupdated readmeupdated code descriptionslight performance improveVersion 2.1:Added testsadded functions output type recommendationVersion 2.5Added ascii message detections on encryption/compilation functionsSlighly improved file extension detectionVersion 2.6improved file read system where all functions can be used while target file is already openedimproved formatting of the source codeVersion 2.7revamped source code comments, functions descriptionsoverhauled readmerenamed functionruntocompilekept the oldrunfunction and left a 3-version gap for all old programs to change the function nameVersion 2.8INFO LOSTVersion 2.9updated readmeadded printing supression feature to all functionsprovided 2 debug options fordecryptfuncton inlgEncryptmoduleVersion 3.0Revamped the entire file read system, now rely on binary instead of texts (rejected)Nothing changedremoved the oldrunfunction inLogicGatemoduleIf nothing goes wrong, this project is now abandoned