Skip to content
Toy programming language and compiler
Rust
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
Cargo.toml
LICENSE
README.md

README.md

chiya

Toy programming language and compiler.

Language design

// This is a comment.

ptr += 123; // add 123 to the data pointer
ptr -= 123; // subtract 123 from the data pointer

*ptr += 123; // add 123 to the value that 'ptr' points to
*ptr -= 123; // subtract 123 from the value that 'ptr' points to

putchar(); // writes *ptr to stdout
getchar(); // reads the next character from stdin and stores it to *ptr

// while loop
while *ptr {
    // ...
}

Example

$ cargo run -q <<EOS > ex.ll
*ptr += 65;
putchar();
*ptr += 1;
putchar();
*ptr += 1;
putchar();
ptr += 1;
*ptr += 10;
putchar();
EOS

$ llc ex.ll
$ clang ex.s

$ ./a.out
ABC

License

MIT

You can’t perform that action at this time.