Compass
Disclaimer: This is a personal side-project
Compass 🧭 is a small programming language with strong inpiration from Esterel. It is a synchronous programming language meant to build finite state machines easily for your C code.
Unlike Esterel, Compass is very bare bones and uses a rather trivial compilation process, which can lead to very different behaviours for code that looks similar.
The ABRO code example adapted for Compass looks like:
module abro(input A, input B, input R, output O)
each R seq {
par {
await A;
await B;
};
emit O;
}
endmodule
Installation
The Compass compiler is distributed as a Python source package. To install it, one can run:
# Fetch the source code
git clone https://github.com/roadelou/compass.git
# Go into the repository
cd compass
# Install the python package
pip3 install .
A PyPi package is also available for the compiler, and it can be installed with pip3 install roadelou-compass 🎉
Usage
Once the compiler is installed, it can be used from the terminal through the compass command. Basic usage is:
# This will output a C file called abro_compass.c
compass abro.cmps
# To compile the header file to use the C code
compass --lang header abro.cmps
# To compile a CLI interface to test the module
compass --lang debug abro.cmps
Examples
Some examples of the language can be found in the examples folder.
Compass Builder
Compass Builder is a small tool provided by the package to automate the compilation of projects with submodules. It takes a JSON file describing the project as input and outputs a Makefile to automate the compilation of the project.
💡 For an example JSON description of a project, see cascade_abro.json.
Basic usage of compass-builder is:
# Creates a Makefile from the description given in project.json
compass-builder project.json Makefile
Features
The version of compass in the repository supports:
inputandoutputsignalslocalvariableseach,par,seq,awaitandemitstatements- Conditional tests with
if,elif,elseandendif - The ability to use submodules within a module with the
externandsubmodulekeywords - Many C-inspired operators for expressions, including bitwise, arithmetic and boolean operators
⚠️ Be careful about the syntax for end-of lines. The ; operator should only be used to separate several statements in a list of statements, i.e. only in seq and par blocks. The last ; is optional by the way.
METADATA
| Field | Value |
|---|---|
| 📝 Contributors | roadelou |
| 📧 Contacts | |
| 📅 Creation Date | 2021-03-12 |
| 💡 Language | Markdown Document |
EOF
Metadata
Release files for roadelou-compass 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| roadelou-compass-0.0.8.tar.gz | 29.7 kB | Without provenance | Details for roadelou-compass-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| roadelou_compass-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for roadelou_compass-0.0.8-py3-none-any.whl |
Total release size: 110.9 kB
Release files / roadelou-compass-0.0.8.tar.gz
| Download URL | roadelou-compass-0.0.8.tar.gz |
|---|---|
| Size | 29.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9dfa0ef5ab7e2961d20ad8ae3e1a61644136650e284425e1819c49fa3969c77c
|
|
BLAKE2b-256 checksum How to use checksums |
08466c4acac4b602b754a98796a85a40a79296bacbc0f7070f4ec911590fbc95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Release files / roadelou_compass-0.0.8-py3-none-any.whl
| Download URL | roadelou_compass-0.0.8-py3-none-any.whl |
|---|---|
| Size | 81.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3875839973663bdb8c84934d9b7096c3181b4e71659c9d52df97fb837a0f443
|
|
BLAKE2b-256 checksum How to use checksums |
dfd7be5dd84736015e10dfdff3636a941ee6154fc7e175f30a4605c10dddafb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Security for roadelou-compass 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.