Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/charlesaverill/purple
Purple standard language specification and compiler implementation
https://github.com/charlesaverill/purple
c compiler programming-language programming-language-development
Last synced: about 2 months ago
JSON representation
Purple standard language specification and compiler implementation
- Host: GitHub
- URL: https://github.com/charlesaverill/purple
- Owner: CharlesAverill
- License: gpl-3.0
- Created: 2022-09-08T19:18:24.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-22T15:50:21.000Z (over 1 year ago)
- Last Synced: 2024-04-20T00:54:42.721Z (9 months ago)
- Topics: c, compiler, programming-language, programming-language-development
- Language: C
- Homepage: http://charles.systems/Purple/
- Size: 23.2 MB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Purple Language Documentation
The standard language specification and compiler for Purple, a general-purpose, C-like language intended to introduce higher-level functionality and lower-level memory access.
[Original Implementation](https://github.com/CharlesAverill/purple_archive/)
## Installation
View the source here.
### Dependencies
- `clang-{10+}`
- `libclang-{10+}-dev`Purple may be built with cmake:
```bash
cmake -B build
cmake --build buildbin/purple example_file.prp
```## Grammar
BNF-formatted grammar for Purple can be found here: [Purple Grammar Documentation](purple.g)
## Examples
Purple uses C-style syntax, although this may change as the compiler is built
```c
void main(void) {
int bob;
int alice;bob = 5;
alice = 10;print bob + alice; // 15
print bob > alice; // 0int bob_alice;
bob_alice = 10 + 10 + bob + alice; // 35
if(bob_alice > 30){
print bob_alice;
}int i;
i = 0;
while (i < 20) {
print i;
i = i + 1;
} else {
print i == 0 or true; // true
}
}
```More examples can be viewed here.