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 :arrow_down_small:
module abro(input A, input B, input R, output O) {
each R {
seq {
par {
await A;
await B;
};
emit O;
}
}
}
Installation
The Compass compiler is distributed as a Python source package. To install it, one can run :arrow_down_small:
# 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 :arrow_down_small:
# 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.
Features
This section details what language features are currently available in compass :compass: and which ones are planned.
Current features
The version of compass in the repository supports:
- Input and output signals
each
,par
,seq
,await
andemit
statements- 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
Hashes for roadelou_compass-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89f18d2294b4ba922256b66e01c0ab9caa6a8e405897610f1436062116310652 |
|
MD5 | 2a47a3c168abc7aedf2397a56bc209f3 |
|
BLAKE2b-256 | e929a81c149a63ab1164283273e810c3144a84f6da976e69ceda8257a6c7e07f |