Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aceinetx/bat_c
A High-level language for matt's redstone computer
https://github.com/aceinetx/bat_c
Last synced: 4 days ago
JSON representation
A High-level language for matt's redstone computer
- Host: GitHub
- URL: https://github.com/aceinetx/bat_c
- Owner: aceinetx
- Created: 2024-08-25T13:14:59.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-02T18:10:17.000Z (4 months ago)
- Last Synced: 2024-11-08T05:29:27.578Z (about 2 months ago)
- Language: C++
- Homepage: https://aceinetserv.000webhostapp.com/batc/
- Size: 55.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bat_c
A High-level language for [matt's redstone computer](https://github.com/mattbatwings/BatPU-2) with C-Like syntax
## Features implemented
- Variables
- Define
- Functions
- Compare expressions
- If statements
- Scopes
## WIP Features
- While loops
- Else statements
## Get started
Your first option is to download the .exe from latest release and run it (under linux use wine), second option is to use bat c [online](https://aceinetserv.000webhostapp.com/batc/)
## Known issues
- You can call functions like this: ```func(``` and not like this: ```func();```
- If you try to compile this under a linux machine, when ran you'll get segmentation fault (but I think you can run it under wine)
- Expressions can only be 3-4 operators long (i'm lazy to implement more)
## Example programs
Math operations (Division is not currently supported)
```
main {
x; y;x = 20;
y = 5 * x;
}
```
While loop
```
x;
loop {
increment x;
loop();
}
main {
loop();
}
```
If statements
```
main {
x;
increment x;cmpexpr x == 1;
if;
x = 69;
endif;
}
```
References
references are basically variables with the same variable mapping
```
a; b;main {
b = ref a;
increment a;
increment b;
}
```
Fill screen
```
x; y;x_loop {
increment x;
cmpexpr x < 32;
if;
port pixel_x x;
port pixel_y y;port draw_pixel;
port buffer_screen;
x_loop();
endif;
}loop {
x = 255;
increment y;
cmpexpr y < 32;
if;
x_loop();
loop();
endif;
}main {
port clear_screen_buffer;decrement x;
decrement y;loop();
}
```
Inline assembly
```
main {
asm
ldi r5 42
ldi r6 69;
}
```