Simple synchronous programming language
Project description
Compass
Disclaimer: This is a personal side-project
Compass :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
:tada:
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.
:bulb: 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:
input
andoutput
signalslocal
variableseach
,par
,seq
,await
andemit
statements- Conditional tests with
if
,elif
,else
andendif
- The ability to use submodules within a module with the
extern
andsubmodule
keywords - Many C-inspired operators for expressions
:warning: 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 |
---|---|
:pencil: Contributors | roadelou |
:email: Contacts | |
:date: Creation Date | 2021-03-12 |
:bulb: Language | Markdown Document |
EOF
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file roadelou-compass-0.0.6.tar.gz
.
File metadata
- Download URL: roadelou-compass-0.0.6.tar.gz
- Upload date:
- Size: 28.1 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd622d8f9cb1f23ec1153eceb56e1a3b3b9b283b49dcd1f341c7291f127b9517 |
|
MD5 | 4ed0336852dedb10e53509dd76033f40 |
|
BLAKE2b-256 | 7995301f0f28f1eaa67956d909e8beaf74ba9138cd0894455825d0ca4cfc2126 |
File details
Details for the file roadelou_compass-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: roadelou_compass-0.0.6-py3-none-any.whl
- Upload date:
- Size: 73.6 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42751ee9f260c04a7cc113f461e650c3d43c405993c37660f46b318951095943 |
|
MD5 | 873218fab2738b5afd0b7b218e3a340a |
|
BLAKE2b-256 | 8ba5da5a54a0cc255692c729451409b9b24dd9ce07e3e3beffdecea025a0c5a4 |