CH
CharlesAverill/Purple
Purple standard language specification and compiler implementation
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.
Installation
View the source here.
Dependencies
clang-{10+}libclang-{10+}-dev
Purple may be built with cmake:
cmake -B build
cmake --build build
bin/purple example_file.prpGrammar
BNF-formatted grammar for Purple can be found here: Purple Grammar Documentation
Examples
Purple uses C-style syntax, although this may change as the compiler is built
void main(void) {
int bob;
int alice;
bob = 5;
alice = 10;
print bob + alice; // 15
print bob > alice; // 0
int 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.
On this page
Languages
C95.5%Shell2.3%GAP1.7%CMake0.5%
Contributors
GNU General Public License v3.0
Created September 8, 2022
Updated July 7, 2023