Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rofirrim/pasko
Pasko compiler
https://github.com/rofirrim/pasko
compiler cranelift pascal rust rustlang
Last synced: 26 days ago
JSON representation
Pasko compiler
- Host: GitHub
- URL: https://github.com/rofirrim/pasko
- Owner: rofirrim
- License: gpl-3.0
- Created: 2024-01-21T09:50:35.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-09-22T17:39:04.000Z (about 2 months ago)
- Last Synced: 2024-09-29T21:20:54.521Z (about 1 month ago)
- Topics: compiler, cranelift, pascal, rust, rustlang
- Language: Rust
- Homepage:
- Size: 280 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pasko compiler
This is a very simple compiler whose goal is to implement [ISO 7185:1990](https://archive.org/details/iso-iec-7185-1990-Pascal).
> ⚠️ This is still very much in MVP state, so don't expect much yet. ⚠️
It is implemented in [rust](https://www.rust-lang.org) and uses the following main crates as dependences:
- [lalrpop](https://crates.io/crates/lalrpop) for the syntactic parser
- [cranelift](https://cranelift.dev) for the code generation
- [clap](https://crates.io/crates/clap) for the command arguments handling of the driver
- [lazy_static](https://crates.io/crates/lazy_static) for global initialization of internal compiler state
- [paste](https://crates.io/crates/paste) for a macro that helps with code generation of visitor### Goals
- Implement all of ISO 7185:1990 up to level 1
### Non-goals
- Extensions to make it nicer, closer to Turbo Pascal or to ISO 10206:1990
### How to build
##### Requirements
- An x86-64 Linux machine
- more platforms may be added in the future- Rust (tested with 1.75)
- Meson (tested with 1.3.1)
- Used to build the runtime- GCC
- Used to build the runtime
- Used to link the pasko programs##### Compiler
1. Clone the repository
2. At the top level: `cargo build`
##### Runtime
1. Enter `pasko-runtime`
2. `meson setup builddir`
3. `cd builddir`
4. `make`
##### Tests
To run the tests you will need both LLVM's `FileCheck` and `lit` installed and available in your path.
`cargo test` will invoke the tests
The main testsuite is in `pasko-testing/testsuite`.
### How to use
**Note:** an installation procedure is not yet in place
From inside the build-directory
1. `cargo run -- myprogram.pas --pasko-runtime=/pasko-runtime/builddir`
2. If this succeeds you will have a `myprogram` file that you can execute
### Missing features
⚠️ Still many missing features! ⚠️
| Feature | State | Notes |
| ------------------------------------------------------ | ----- | ----------------------------------------------------------- |
| labels | ❌ | |
| with-statement | ❌ | |
| pack/unpack required procedures | ❌ | |
| Variant types | ⚠️ | Variant types including non-trivial types types are not supported |### Areas of improvement
- The required functions could be represented using a table.
- We could be using a more idiomatic representation for types.##### I found a bug / I want to contribute
Please send me an email.
In order to keep my sanity at bay, this project does not have issues enabled.
#### Licence
The pasko components are all GPLv3.