Armor
No description available
Install / Use
/learn @OllieGGGG/ArmorREADME
Armor is toy-ish implementation of compiler for armV7 instruction set
C-like syntax, only few types, but implemented all stages of normal compiler
Can handle:
- Global and local variables
- Function calls
- Branching
- Simple type checking
CPU architecture specs:
- Use armV7 base arch
- r0 - r11 - free regs
- r12 - as frame pointer
Example:
int r = 2;
int f(int arg_1, int arg_2) {
int ll;
if (arg_1 > arg_2) {
ll = 2;
} else {
ll = 3;
}
return ll;
};
int m = 3;
void main() {
int loc = f(2, 3) + 1;
return loc;
};
Will generate:
.data
r: .word 2
m: .word 3
.text
.global _start
_start:
b main
f:
push {r12}
mov r12, sp
sub sp, sp, #8
ldr r0, [r12, #4]
ldr r1, [r12, #8]
cmp r0, r1
ble lable_else_1
ldr r0, =2
str r0, [r12, #-4]
b lable_end_0
lable_else_1:
ldr r0, =3
str r0, [r12, #-4]
lable_end_0:
ldr r0, [r12, #-4]
mov sp, r12
pop {r12}
bx lr
main:
push {r12}
mov r12, sp
sub sp, sp, #8
ldr r0, =2
ldr r1, =3
push {r0, r1}
bl f
add sp, sp, #8
ldr r1, =1
add r2, r0, r1
str r2, [r12, #-4]
ldr r0, [r12, #-4]
mov sp, r12
pop {r12}
bx lr
adr_r: .word r
adr_m: .word m
How to run:
python3 main.py m1.c -o out.asm
You could use emulator to run exactly this piece of code.
Related Skills
node-connect
350.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
