Understanding the architecture of Linea 2
The Linea 2 has updated and revamped codebase, the old Linea 1.x was a single file interpreter, however the problem was that because it was single-file interpreter, it was large (around 75 MB), which took a lot of time to load, so I thought to split the core functions of Linea to a library/module called `liblinea`. Initially in Linea 2 v2.0, the library was only limited to basic core functionalities, however in it's second update, v2.1.0, I added two more sub-libraries, `liblinea_math` and `liblinea_weblet` (initially, `liblinea.math` and `liblinea.weblet`). The separation of main interpreter and it's standard library improved loading time by 7 seconds (1.x took around 16 seconds to load, while 2.x takes 9 seconds approx.*). I'm trying hard to make it even more faster to load.
Architecture in Linea 1.x
Linea (Interpreter with libraries linked) + Source Code (<file>.ln) --> 16 seconds (Load) + Output
Architecture in Linea 2.x
Linea (Interpreter) + LibLinea (Standard Library) + Source Code (<file>.ln) --> 9 seconds (Load) + Output + (Optional) Weblet + Math --> 2 seconds (Load) + Output
Downloading and Installing Linea 2
There are 2 options (3 technically) on which format you need Linea in:
- Source Code (Clone or download from GitHub repo)
- Binaries (Compiled standalone .exe and a compiled .exe with core library in Installer)
Source Code
⚠️ I recommend you to have latest version of Python installed.
If you choose to use it directly from source code, you can clone or download the
Linea repository from GitHub, then open the `
linea.py` file and install the required dependencies through pip.
After downloading and installing all necessary libraries, you're good to go.!
Binaries (Windows Only)
⚠️ Binary releases (standalone (portable) and installer) have some issues with 3rd party libraries, as it's not compiled with the source itself.
Download the latest
Linea Installer from GitHub, then run the installer and install it in your desired location.
After installation you'll find `linea.exe`, you're good to go, next part tells you how to run your Linea code.
Running your Linea Code
Running your Linea code is easy, just run the script or executable with name of the source file as argument as mentioned below:
If running from source code
On Linux
python3 linea.py <sourceCode>
On Windows
python linea.py <sourceCode>
Binary (Windows Only)
Through Comand Prompt (CMD)
linea <sourceCode>
Through Powershell (PS)
./linea <sourceCode>
Hurray! you just ran a Linea 2 code..!!
Comments