LineUp
LineUp is a pseudo-code interpreter that allows you to write and run a code with a limited action set by the language.
The language is designed to be simple and easy to modify, and add actions to it. But it will be a little complex to write a code with it.
Installation
pip install lineup-lang
from lineup_lang import Language, luexec, lucore
Usage
# Create a new language
# Add here the default actions that your language will have
core_object = [lucore.Variables({"a": 0, "b": -1})]
# You need an executor to run the code, it's the object that will iterate over the code
# Default executor, it will run the code line by line
executor = luexec.DefaultExecutor(core_object)
# Jumper executor, it will run the code line by line, but it will also allow you to jump to a specific line
executor = luexec.JumperExecutor(core_object)
# Create the language object, it's the object that will read the code, split it and send it to the executor
language = Language(executor)
# Run the code
language.run('''
VAR c USE VAR a GET
IF *+2 VAR c GET
ELSE *+2
EXIT VAR a GET
EXIT VAR b GET
''')
Default core objects
-
Variables: It's a object that will store variables and their values. It's a dictionary that will store the variables and their values.Variables({"a": 0, "b": -1}): It will create a new object with the variablesaandbwith the values0and-1respectively.VAR x: Execute an action on a variable.GET: Get the value of a variable.SET y: Set the value "y" of a variable.COPY y: Copy the value of the variable y to the variable.USE ACTION: Execute a core action and store the result in the variable x.EXEC ACTION: Execute an action on a variable. The variable need to be aLanguageObject.ACTION: Execute an action on a variable. The variable need to be aLanguageObject.
-
ConditionsJumpObject: An object that will store the conditions and the lines to jump.IF x CONDITION: If the condition is true, go to the line x, else go to the next line.ELSE JUMP x: Go to the line x.NOTIF x CONDITION: If the condition is false, go to the line x, else go to the next line.- Condition:
ACTIONExecute a core action, if the result is true, the condition is true."ACTION" SIGN "ACTION": Compare two actions with the sign.- SIGN:
- Equal:
EQ,== - Not equal:
NE,!= - Greater:
GT,> - Greater or equal:
GE,>= - Less:
LT,< - Less or equal:
LE,<=
- Equal:
Metadata
Release files for lineup-lang 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lineup_lang-0.2.0.tar.gz | 22.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lineup_lang-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 47.9 kB
Release files / lineup_lang-0.2.0.tar.gz
| Download URL | lineup_lang-0.2.0.tar.gz |
|---|---|
| Size | 22.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03ad5fbfc01a516133f4ebace4ab9865f43d222b7c1efb123f8a090dac35d017
|
|
BLAKE2b-256 checksum How to use checksums |
ea08609ce63e91358f1d147cddd6c4e4721a5ba0ec1c069d5e59c60db332bca3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Release files / lineup_lang-0.2.0-py3-none-any.whl
| Download URL | lineup_lang-0.2.0-py3-none-any.whl |
|---|---|
| Size | 25.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cfac246639df9739cf0253aebe2583175613c4d5d42b476e0aa54ac7fe325264
|
|
BLAKE2b-256 checksum How to use checksums |
2b6df864c011dc59e60ffb3764dcb388574f01fcf450d1471cbf4ff05870525c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|