logicgate


Namelogicgate JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://replit.com/@s3D27ZHOU/LogicGate
Summaryan esolang designed for manual encryption with logic gates
upload_time2023-12-06 09:42:23
maintainer
docs_urlNone
authorTaokyle
requires_python>=3.10,<4.0
licenseMIT
keywords logic gate encrypt encryption
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            LogicGate
=========

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 but it depends.

Startup
-------

First, make a logic gate file. The file extension should be .lgeso

Functions
---------

*Note, 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, import **LogicGate** in your python script.

Remember for the decompile function, only the filename argument is needed.

The *decompile* function 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).


The *compile* function 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 module
----------------------
a special encrypt module is included in this package, which is **lgEncrypt**.

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 explainatory

*decrypt()* have 5 arguments, data file, key file, sause, debug, debug_ALL. 
the first 2 is very self explainatory, for *sause* parameter it determinates if the output text is shown or returned for further decryption, assuming the message through encrypt() is encrypted beforehand.
For *debug*, it shows the print output that is hidden, it can be enabled for you to check which bit is wrong. For *debug_ALL* it 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.

syntax
------

For 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 ignored

Basic gates:
~~~~~~~~~~~~

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 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 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 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 LogicGate

``1\n 0\n 0\n 1\n 0\n 0\n 0\n ---\n 1\n 1\n 0\n 0\n 1\n 0\n 1\n ---\n 1\n 1\n 0\n 1\n 1\n 0\n 0\n ---\n 1\n 1\n 0\n 1\n 1\n 0\n 0\n ---\n 1\n 1\n 0\n 1\n 1\n 1\n 1\n ---\n 1\n 0\n 0\n 0\n 0\n 0\n ---\n 1\n 0\n 1\n 0\n 1\n 1\n 1\n ---\n 1\n 1\n 0\n 1\n 1\n 1\n 1\n ---\n 1\n 1\n 1\n 0\n 0\n 1\n 0\n ---\n 1\n 1\n 0\n 1\n 1\n 0\n 0\n ---\n 1\n 1\n 0\n 0\n 1\n 0\n 0\n ---\n 1\n 0\n 0\n 0\n 0\n 1\n``

another version generated by LogicGate.compile():
``O1NNAANNNNA1AA1AO0AA1AO1NNANNAA1A1111111111\n NNANNAAAO0O000001\n OO0NNN10\n O1O1NNA1O01\n NNOONNA0O0000\n 0\n AA0NNANNOONNNNAO0A1O0000001\n ---\n OO1O1OAO1NNAO111111\n NNNNO0NNAA1O0N01\n OANNOA0O00000\n ANNNNA001\n NNA11\n NNANNA1ANNO0001\n NNAANNAOOA1NNAO10110111\n ---\n OA111\n A1OA1OO0A1O1NNA1O0ONNNNNNN0000\n A1O0A00\n A1O0NNAO0O0A111\n NNAO1NNONNNNA1O1111\n O0A1OANNA0NNOO0ON10000\n 0\n ---\n O0NNN0\n A1ANNNNNNNNNNO101\n O00\n NNA1OO1ONNAO10110\n OAA1110\n OO0AAO0AAONNO0O0NNO00001100\n NNO0A0ONNN10\n ---\n O0O1O0A1NNO1ANNO0AA1O1AA1A1A11111\n NNANNO1ONNNNNNNNNNO0AO11101\n O0OONNNNAAO0N11000\n A1O0N0\n OONNNNOA1ONNOO0AA11100100\n NNO0ON00\n O0OA1NNA1O100\n ---\n O0OO1OO1A1O1000\n NNOO0AONNONNO0A0NNA0NNA010010\n NNAA0OOOA0O000001\n A0NNNNN1\n AO0NNNNA1OO0001\n O0OA1O0O0OO0OA1O00000\n ---\n 1\n A0NNAO0A0OA0NNA1A0000\n NNO0NNA1NNOO011\n NNO0NNA0A0A0NNOO000\n ANNA1AA1NNNNNNNNAA1NNAA1A111111\n NNA1ANNA1OAO1O11111\n A1A1NNA1O1NNANNA1AA1111\n ---\n ONNNNAOO11110\n OANNOONNA1AA1110111\n AA0NNNNNNO0O0A0O0N10\n NNNNNNOA110\n O1OONNA1101\n A1NNNNA11\n ANNOONNAAO1A1ANNA11111011\n ---\n O0NNO0AO0A111\n NNNNNNA1O0ONNA1NNNNO0NNANNOOA1ANNNNAA11110111\n NNO11\n AO0AN101\n OAA1000\n 1\n O0A0NNO0O0NNA0A0NNA1ON10\n ---\n O0N0\n NNNNNNO0ONNA1N00\n O00\n O0AN01\n NNONNNNNNNNA111\n NNNNONNOO0000\n AONNO0ANNO00101\n ---\n O1ONNANNNNA1111\n NNNNOOOO0NNAA1NNONNO1011111\n NNA0A0A01\n AA1N10\n O1OANNNNNNA1ONNNNOO1AOOO1AAN0110111110\n 0\n OOAO0NNO0A0OAANNA0AONNO0001100000\n ---\n A1A1NNO0NNA11\n OA100\n NNANNOA1001\n 0\n NNO0OA0O000\n ANNO0OONNA1O11001\n ---``

Sources
-------

| gitbub: `<https://github.com/TaokyleYT/LogicGate/>`__

| Esolang seldom outdated wiki: `LogicGate <https://esolangs.org/wiki/LogicGate>`__

| Replit up-to-date version: `replit <https://replit.com/@s3D27ZHOU/LogicGate>`__


Roadmap
=======
| Version 1.2:
| First release on PyPi

| Version 1.3:
| Introduced enhanced module `lgEncrypt`
| Bug fix

| Version 2.0:
| Improved comment function
| updated readme
| updated code description
| slight performance improve

| Version 2.1:
| Added tests
| added functions output type recommendation

| Version 2.5
| Added ascii message detections on encryption/compilation functions
| Slighly improved file extension detection

| Version 2.6
| improved file read system where all functions can be used while target file is already opened
| improved formatting of the source code

| Version 2.7
| revamped source code comments, functions descriptions
| overhauled readme
| renamed function `run` to `compile`
| kept the old `run` function and left a 3-version gap for all old programs to change the function name

| Version 2.8
| INFO LOST

| Version 2.9
| updated readme
| added printing supression feature to all functions
| provided 2 debug options for `decrypt` functon in `lgEncrypt` module

| Version 3.0
| Revamped the entire file read system, now rely on binary instead of texts (rejected)
| **Nothing changed**
| removed the old `run` function in `LogicGate` module
| If nothing goes wrong, this project is now abandoned
            

Raw data

            {
    "_id": null,
    "home_page": "https://replit.com/@s3D27ZHOU/LogicGate",
    "name": "logicgate",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "logic,gate,encrypt,encryption",
    "author": "Taokyle",
    "author_email": "taokyle415@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/16/34/e0a8dd778a73fcc855f42cf545246eee1edc05168ced7a09fb5dba29ad1b/logicgate-0.3.0.tar.gz",
    "platform": null,
    "description": "LogicGate\n=========\n\nThis language is inspired by logic gates, by using simple alphabet you could make a program.\n\nIt is designed as a way for manual encryption, which kinda failed\n\nAll you can do in this language is to make a program with logic gates,\nsounds difficult but it depends.\n\nStartup\n-------\n\nFirst, make a logic gate file. The file extension should be .lgeso\n\nFunctions\n---------\n\n*Note, 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.*\n\nTo use it, import **LogicGate** in your python script.\n\nRemember for the decompile function, only the filename argument is needed.\n\nThe *decompile* function will return the incorrect bits if check, gate and ascii is True, decompiled result if ascii is True, and 0 if otherwise.\n\nOutputs of the file will be printed(binary to ascii, and logical binary if enabled) if out is True (true by default).\n\n\nThe *compile* function 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.\n\nSpecial encrypt module\n----------------------\na special encrypt module is included in this package, which is **lgEncrypt**.\n\nit contain two functions, encrypt() and decrypt().\n\n*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(). \nencrypt() have 4 arguments, data file name, key file name, message, output. They are very self explainatory\n\n*decrypt()* have 5 arguments, data file, key file, sause, debug, debug_ALL. \nthe first 2 is very self explainatory, for *sause* parameter it determinates if the output text is shown or returned for further decryption, assuming the message through encrypt() is encrypted beforehand.\nFor *debug*, it shows the print output that is hidden, it can be enabled for you to check which bit is wrong. For *debug_ALL* it 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.\n\nsyntax\n------\n\nFor syntax it is very straight forward. It process each character in\nevery line as individual command.\n\nFor gates with multiple inputs (such as or,\nand) 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.\n\nIf the code on the same line have more than 1 final outputs, the first one will be used and the rest will be ignored\n\nBasic gates:\n~~~~~~~~~~~~\n\nA (and gate): the next **2** results will be accepted as inputs. If both\ninputs are 1, output is 1, else 0\n\nO (or gate): the next **2** results will be accepted as inputs. If one\nof the inputs are 1, output is 1, else 0\n\nN (not gate): the next **1** result will be accepted as inputs. If the\ninput is 1, output is 0, else 0\n\n1 and 0 (True and False): **NO** result will be accepted as inputs. They are the results, self explanatory\n\nspecial syntax\n~~~~~~~~~~~~~~\n\nThere is 1 special syntax\n\n--- (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.\n\n### three hashes: comment, anything after this syntax will be ignored until a new line\n\nFor 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)\n\nexamples (for version 1.2 -> 3.0)\n=================================\n\nThis is a hello world in LogicGate\n\n``1\\n 0\\n 0\\n 1\\n 0\\n 0\\n 0\\n ---\\n 1\\n 1\\n 0\\n 0\\n 1\\n 0\\n 1\\n ---\\n 1\\n 1\\n 0\\n 1\\n 1\\n 0\\n 0\\n ---\\n 1\\n 1\\n 0\\n 1\\n 1\\n 0\\n 0\\n ---\\n 1\\n 1\\n 0\\n 1\\n 1\\n 1\\n 1\\n ---\\n 1\\n 0\\n 0\\n 0\\n 0\\n 0\\n ---\\n 1\\n 0\\n 1\\n 0\\n 1\\n 1\\n 1\\n ---\\n 1\\n 1\\n 0\\n 1\\n 1\\n 1\\n 1\\n ---\\n 1\\n 1\\n 1\\n 0\\n 0\\n 1\\n 0\\n ---\\n 1\\n 1\\n 0\\n 1\\n 1\\n 0\\n 0\\n ---\\n 1\\n 1\\n 0\\n 0\\n 1\\n 0\\n 0\\n ---\\n 1\\n 0\\n 0\\n 0\\n 0\\n 1\\n``\n\nanother version generated by LogicGate.compile():\n``O1NNAANNNNA1AA1AO0AA1AO1NNANNAA1A1111111111\\n NNANNAAAO0O000001\\n OO0NNN10\\n O1O1NNA1O01\\n NNOONNA0O0000\\n 0\\n AA0NNANNOONNNNAO0A1O0000001\\n ---\\n OO1O1OAO1NNAO111111\\n NNNNO0NNAA1O0N01\\n OANNOA0O00000\\n ANNNNA001\\n NNA11\\n NNANNA1ANNO0001\\n NNAANNAOOA1NNAO10110111\\n ---\\n OA111\\n A1OA1OO0A1O1NNA1O0ONNNNNNN0000\\n A1O0A00\\n A1O0NNAO0O0A111\\n NNAO1NNONNNNA1O1111\\n O0A1OANNA0NNOO0ON10000\\n 0\\n ---\\n O0NNN0\\n A1ANNNNNNNNNNO101\\n O00\\n NNA1OO1ONNAO10110\\n OAA1110\\n OO0AAO0AAONNO0O0NNO00001100\\n NNO0A0ONNN10\\n ---\\n O0O1O0A1NNO1ANNO0AA1O1AA1A1A11111\\n NNANNO1ONNNNNNNNNNO0AO11101\\n O0OONNNNAAO0N11000\\n A1O0N0\\n OONNNNOA1ONNOO0AA11100100\\n NNO0ON00\\n O0OA1NNA1O100\\n ---\\n O0OO1OO1A1O1000\\n NNOO0AONNONNO0A0NNA0NNA010010\\n NNAA0OOOA0O000001\\n A0NNNNN1\\n AO0NNNNA1OO0001\\n O0OA1O0O0OO0OA1O00000\\n ---\\n 1\\n A0NNAO0A0OA0NNA1A0000\\n NNO0NNA1NNOO011\\n NNO0NNA0A0A0NNOO000\\n ANNA1AA1NNNNNNNNAA1NNAA1A111111\\n NNA1ANNA1OAO1O11111\\n A1A1NNA1O1NNANNA1AA1111\\n ---\\n ONNNNAOO11110\\n OANNOONNA1AA1110111\\n AA0NNNNNNO0O0A0O0N10\\n NNNNNNOA110\\n O1OONNA1101\\n A1NNNNA11\\n ANNOONNAAO1A1ANNA11111011\\n ---\\n O0NNO0AO0A111\\n NNNNNNA1O0ONNA1NNNNO0NNANNOOA1ANNNNAA11110111\\n NNO11\\n AO0AN101\\n OAA1000\\n 1\\n O0A0NNO0O0NNA0A0NNA1ON10\\n ---\\n O0N0\\n NNNNNNO0ONNA1N00\\n O00\\n O0AN01\\n NNONNNNNNNNA111\\n NNNNONNOO0000\\n AONNO0ANNO00101\\n ---\\n O1ONNANNNNA1111\\n NNNNOOOO0NNAA1NNONNO1011111\\n NNA0A0A01\\n AA1N10\\n O1OANNNNNNA1ONNNNOO1AOOO1AAN0110111110\\n 0\\n OOAO0NNO0A0OAANNA0AONNO0001100000\\n ---\\n A1A1NNO0NNA11\\n OA100\\n NNANNOA1001\\n 0\\n NNO0OA0O000\\n ANNO0OONNA1O11001\\n ---``\n\nSources\n-------\n\n| gitbub: `<https://github.com/TaokyleYT/LogicGate/>`__\n\n| Esolang seldom outdated wiki: `LogicGate <https://esolangs.org/wiki/LogicGate>`__\n\n| Replit up-to-date version: `replit <https://replit.com/@s3D27ZHOU/LogicGate>`__\n\n\nRoadmap\n=======\n| Version 1.2:\n| First release on PyPi\n\n| Version 1.3:\n| Introduced enhanced module `lgEncrypt`\n| Bug fix\n\n| Version 2.0:\n| Improved comment function\n| updated readme\n| updated code description\n| slight performance improve\n\n| Version 2.1:\n| Added tests\n| added functions output type recommendation\n\n| Version 2.5\n| Added ascii message detections on encryption/compilation functions\n| Slighly improved file extension detection\n\n| Version 2.6\n| improved file read system where all functions can be used while target file is already opened\n| improved formatting of the source code\n\n| Version 2.7\n| revamped source code comments, functions descriptions\n| overhauled readme\n| renamed function `run` to `compile`\n| kept the old `run` function and left a 3-version gap for all old programs to change the function name\n\n| Version 2.8\n| INFO LOST\n\n| Version 2.9\n| updated readme\n| added printing supression feature to all functions\n| provided 2 debug options for `decrypt` functon in `lgEncrypt` module\n\n| Version 3.0\n| Revamped the entire file read system, now rely on binary instead of texts (rejected)\n| **Nothing changed**\n| removed the old `run` function in `LogicGate` module\n| If nothing goes wrong, this project is now abandoned",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "an esolang designed for manual encryption with logic gates",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://replit.com/@s3D27ZHOU/LogicGate",
        "Repository": "https://replit.com/@s3D27ZHOU/LogicGate",
        "github": "https://github.com/TaokyleYT/LogicGate",
        "outdated esolang wiki": "https://esolangs.org/wiki/LogicGate",
        "up-to-date source code(replit)": "https://replit.com/@s3D27ZHOU/LogicGate"
    },
    "split_keywords": [
        "logic",
        "gate",
        "encrypt",
        "encryption"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ffaa0203eb9af9a82d4e945b7cbca62eb8561cbb797a76de753ffc2ecb4de1f5",
                "md5": "e08eb8c5b078a97e6718b3211d9cd943",
                "sha256": "a8246dbe68cc1481a9d59879d6f51ac4c92494bee9dda52833f9e4987fd40afb"
            },
            "downloads": -1,
            "filename": "logicgate-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e08eb8c5b078a97e6718b3211d9cd943",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 11036,
            "upload_time": "2023-12-06T09:42:22",
            "upload_time_iso_8601": "2023-12-06T09:42:22.703364Z",
            "url": "https://files.pythonhosted.org/packages/ff/aa/0203eb9af9a82d4e945b7cbca62eb8561cbb797a76de753ffc2ecb4de1f5/logicgate-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1634e0a8dd778a73fcc855f42cf545246eee1edc05168ced7a09fb5dba29ad1b",
                "md5": "38cfcd3d0c9585ed049aaf91cb7788f8",
                "sha256": "c8cb8ed155c846701bbe0e7c03e96e09f2e9f4358f6f248961f9d44ba10044e6"
            },
            "downloads": -1,
            "filename": "logicgate-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "38cfcd3d0c9585ed049aaf91cb7788f8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 11182,
            "upload_time": "2023-12-06T09:42:23",
            "upload_time_iso_8601": "2023-12-06T09:42:23.955245Z",
            "url": "https://files.pythonhosted.org/packages/16/34/e0a8dd778a73fcc855f42cf545246eee1edc05168ced7a09fb5dba29ad1b/logicgate-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-06 09:42:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TaokyleYT",
    "github_project": "LogicGate",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "logicgate"
}
        
Elapsed time: 0.14980s