Compiler that compiles ST source code to proprietary IL
Node.JS based module fully written in TypeScript to verify and compile ST source code into a proprietary assembler dialect called IL.
The IL is used to run on a proprietary runtime environment.
It does and will not support all language features of ST because of limitations on the target platform. All supported features will be described in the associated wiki pages.
As this project is work in progress, the supported language features will increase in future iterations.
The motivation behind this project is to basically write a compiler as a learning experience.
TypeScript is probably not the best language to write a compiler in, but I chose it because I wanted to gain more experience with it.
The project is also used to provide a way to write code for a proprietary runtime environment in a more modern high-level language like ST.
Maybe I do something similar in another language in the future.
Why ST?
Because it is a language that is widely used in the automation industry and is a good candidate for a compiler project.
The language is simple and still has a lot of features that are common in other languages.
Why IL?
Because it is a assemble dialect I'm very familiar with and besides that it is in some parts a very simple dialect.
But the simplicity of the dialect is also a challenge because it lacks some features that are common in other dialects or CPU architectures.
And at the end of the day, it provides me a way to write complex code for that proprietary runtime environment, which is easier to read and maintain.
yarn global add @sheepcs/st-to-il-compiler
Commands are following this format:
st-to-il-compiler <command> [options]
Get a full list of commands
st-to-il-compiler --help
st-to-il-compiler --version
You can verify the ST source code without compilation by running the following command:
st-to-il-compiler verify -f "path/to/st-file.st"
# or
st-to-il-compiler verify --file "path/to/st-file.st"
You can compile (this includes verification) the ST source code to IL by running the following command:
st-to-il-compiler compile -f "path/to/st-file.st"
# or
st-to-il-compiler compile --file "path/to/st-file.st"
The language documentation is still in progress and will be available in the wiki pages.
The reference documentation for ST is based on the IEC 61131-3 standard and the PLCopen standard. As well as on the document Structured Text (ST) Programming.
The reference documentation for IL is based on the Instruction List (IL) manual.
Copyright (c) 2024 Marina Egner (sheepcs.de). This is free software and may be redistributed under the terms specified in the LICENSE file.