|
Leonardus
|
Leonardus is licensed under the GNU General Public License v3.0.
See the LICENSE file for more details.
Leonardus is an open source project. It is a minimalist, stack-based
programming system designed as a flexible framework for implementing and
exploring algorithms. The syntax and semantics of its scripting language,
LeoScript, are inspired by PostScript and Forth. It is extended with
a prototype-based, object-oriented paradigm, has seamless integration into
JupyterLab and Docker, and provides a concise and expressive environment
for learning and experimentation.
The project name is a nod to Leonardus Pisanus, who was named and
became known as Fibonacci.
There are three main ways to get started with Leonardus:
For more details, see USING.
Consult the project's GitLab Pages for documentation.
There you can find the latest user and developer information including content
generated from the source code files.
Type lc -h and lb -h to get command line help, either within the Docker
image or after building the project. You can also use the UNIX man page system.
Pull the image hagenbund2/leonardus and run it with:
The CLI applications lc and lb will be available in the opening shell.
lb runs LeoScripts. lc serves as command line calculator.
Follow the hints on the welcome screen.
As Docker feature you could even execute lc in one line with e.g.:
Pull the image hagenbund2/leojupyter
and run the X Application JupyterLab with the command line given in the
Docker hub "Overview".
Install, if not already on your system:
To build the CLI artifacts and run all end2end tests:
Optionally install Doxygen, LaTeX, Drawio and cloc to generate the HTML
documentation and the man pages in ./public/ with:
To run an example from your own build:
To run all examples:
For your convinience make install creates an installation in your
$HOME/.local
You can use Leonardus as a calculator. For example:
This project leverages the following core technologies:
Optional tools:
Recommendations:
Tools from the GitLab pipeline:
The Examples directory contains sample code. The build process generates
an overview of its contents in EXAMPLES.md.
For a detailed description of LeoScript, the Leonardus scripting language,
see LANGUAGE.
The Leonardus documentation on architecture and coding is divided into two parts:
There are three build types for different software processes
and environments: DEVELOP PRODUCTION PROFILE
If a LeoScript operator is coded directly in C++, it is referred to as core code.
Project Jupyter is a project to develop open-source software, open standards,
and services for interactive computing across multiple programming languages.
Leonardus integrates with the JupyterLab app.
The second interpreter pass reads and interprets its leon-format input.
The exchange format between the first interpreter pass called "parser"
und the second interpreter pass called "leon". Stored leon-format files
use the file name extension .leon.
The stack-based scripting language and its file format of project Leonardus.
Each line of code can contain commands, which are short, case-sensitive
keywords, and operands, which are pushed onto a data stack and
manipulated by operators. The language supports various data types,
including integers, real numbers, booleans, strings, arrays, stacks and
dictionaries, and follows a reverse Polish notation (RPN) syntax, where
operators follow their operands.
Most of the core code operators are referenced as values in the dictionaries
at start up time. They are called registered.
There are other core code operators for internal use. These are called
unregistered.
A subspecies of semantic objects, that operates on other semantic
objects, the stacks or the interpreter itself. Some of the operators are
LeoScript procedures and the others are core code.
A one character code for each SO class. The virtual ot() member function
of all SO classes return this code and allows explicit type-based decisions
beside the C++ language poylmorphisms.
See: object types
Optimzes LeoScript procedures as part of the bind operator.
The first interpreter pass checks the syntax and converts the program
into leon-format.
The procedure level counts the nesting level of curly braces in the
program code.
For the classes Interpreter and Context there are attributes, together with
setters and getters, which change the behaviour. These properties can be set
with LeoScript operators.
To distinguish them from semantic objects (SOs), the objects at the LeoScript
level are referred to as prototype-based objects (PTBOs). They provide the
features of inheritance and encapsulation.
The PostScript Red Book, officially titled "PostScript Language Reference,"
is the authoritative manual for the PostScript programming language,
detailing its syntax, semantics, and graphics operators.
We use it as a reference for the LeoScript operators, for which we have
explicitly established full compatibility in behavior.
In LeoScript, the following elements form the semantic building blocks
of the language:
In the interpreter’s C++ source code, these elements correspond to
C++ objects of the SO* classes. Additionally, the interpreter represents
composite objects for dictionaries, arrays, and stacks. These are also
considered Semantic Objects.
In the programming language Forth, such elements are referred to as "words".
See: object types
We use IDEA:, TODO: and FIXME: as Task Tags
All tools support a -v option to generate more run time information.
A subdirectory as container of LeoScript files which creates one or more
functional related dictionaries if executed.
| Extension | Description |
|---|---|
| 7 | man page from section 7 |
| cloc | CLOC configuration |
| cpp, h | C++ source |
| Dockerfile | Docker configuration |
| drawio, pdf | drawio XML diagram and its export |
| gcda | profiling run data |
| gcno | profiling structure information |
| gitignore | git ignore |
| html, css | mostly generated HTML page |
| ipynb | Jupyter nootbook |
| js, map, md5 | generated HTML page helper |
| png, svg | more generated HTML page helper |
| in | template with @XYZ@ placeholders |
| info | lcov data |
| json | JSON configuration for development tools |
| kdev4 | Kdevelop configuration |
| leo | LeoScript source |
| leon | leon-format, the parser output |
| l, c | flex source and generated C code |
| md | Markdown documentation |
| o, d | compiler object and dependency |
| out | end-2-end test reference output |
| py | Python script |
| sh, inc | Bash script |
| yml, yaml | YAML data for CI/CD |
| none | executable and some Bash script |
| Single Files | Description |
|---|---|
| compile_flags.txt | clang configuration |
| .dockerignore | Docker ignores this at building |
| Doxyfile | Doxygen configuration |
| formula.repository | generated HTML page helper |
| index.db | man page index |
| LICENSE | License ASCII text |
| makefile | central build configuration |
| post-commit | git configuration proposal |
./AuxDoc
To store auxiliary documentation.
./Coverage
Test coverage data.
./Docker
Dockerfiles to build the images used in GitLab CI/CD.
./drawio
diagrams.net aka drawio diagrams.
./Examples
Example programs.
./Jupyter
Notebooks and support files for the Jupyter integration.
./.git
That's the git Repository.
./Index
Source for the documentation main page.
./.kdev4
Is a living propsal for a KDevelop configuration.
./man
The Doxygen-generated man pages.
./public
Location for GitLab Pages web server files.
The Doxygen-generated HTML documentation can be found in ./public/doxygen/
The test coverage results in ./public/lcov/
The PDF versions of drawio diagrams in ./public/pdf/
./TS/[0-9][0-9]*
Each 'TS/*' directory contains a test suite = a collection of test cases.
./tmp
Exists for temporary files e.g. for testing purposes.
./Tools
Contains TOOLS for the development, e.g. git hooks.
./vocabularies
Is only a container for its subdirectories.
These subdirecories are called vocabularies and the names of the
subdirectories are used to identify the vocabularies.
./.vscode
Is a living propsal for a Visual Studio Code configuration.
This make target creates symbolic links to the artifacts and project files
from the Git directory used to build Leonardus. It is designed for
convenient access to the project's tools and resources.
$HOME/.local/bin
Contains the links to the commands: parser leon lb lc
$HOME/.local/lib/leonardus/
Links to files boot.leo and dry.inc and to the directory vocabularies
$HOME/.local/man/
Contains a link to the generated man pages.
$HOME/.local/share/jupyter/kernels/leoscript
A true copy of the Jupyter kernel configuration.
It is a minimal Ubuntu installation with:
/usr/local/bin
Contain the user programs: parser leon lb lc
/usr/local/lib/leonardus/
System files: boot.leo dry.inc
/usr/local/lib/leonardus/vocabularies/
The location for the vocabularies.
/usr/local/lib/leonardus/Examples/
Example *.leo LeoScripts
/usr/local/share/doc/leonardus/public/
Help and documentation HTML pages.
/usr/local/man/man7/
Generated man pages.
/usr/sbin/
Contains dockerstart.sh.
Contains the same files as "leonardus" and additionally:
/usr/local/share/jupyter/kernels/leoscript/
Jupyter kernel configuration.
/opt/JupyterLab/
The JupyterLab application.
/usr/share/icons/hicolor/512x512/apps/jupyterlab-desktop.png
/usr/share/doc/jupyterlab-desktop/changelog.gz
/usr/share/applications/jupyterlab-desktop.desktop
Support files for JupyterLab.