Skip to content

Commit

Permalink
Updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rigel-star committed Feb 7, 2024
1 parent 66c24ac commit 04e594b
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,43 @@

## Poor C-like language Compiler in Rust.

### Run
```shell
$ cargo run
```

### Test
```shell
$ cargo test
```

### Example Input
```c
global int c;
c = 5;
global int a;
a = 4 + 5;
global int b;
b = 4;
```

### Output
```asm
.data
c: .word 0 // int c;
.align 2
.L2:
.word 0
.word 0
.text
.global _main
_main:
mov x0, 5
ldr x3, =c
str x0, [x3]
mov x4, 4
mov x3, 5
add x4, x4, x3
adrp x3, .L2+0@PAGE
add x3, x3, .L2+0@PAGEOFF
str x4, [x3]
mov x1, 4
adrp x8, .L2+4@PAGE
add x8, x8, .L2+4@PAGEOFF
str x1, [x8]
mov x0, 0
mov x16, 1
svc 0x80
Expand Down

0 comments on commit 04e594b

Please sign in to comment.