https://github.com/bwsix/marspp
MARS++ adds C-like "function calls" to MIPS assembly language (targeting MARS system call)
https://github.com/bwsix/marspp
Last synced: over 1 year ago
JSON representation
MARS++ adds C-like "function calls" to MIPS assembly language (targeting MARS system call)
- Host: GitHub
- URL: https://github.com/bwsix/marspp
- Owner: BWsix
- Created: 2025-03-21T20:33:31.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-27T14:40:21.000Z (over 1 year ago)
- Last Synced: 2025-03-27T14:47:08.996Z (over 1 year ago)
- Language: C++
- Homepage:
- Size: 32.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## What is MARS++?
MARS++ adds C-like "function calls" to MIPS assembly language (targeting MARS system call). Currently, the following "function"s are supported:
- print_string(label)
- print_string("string literal")
- exit()
## Example
Given an input file named `input.asm`:
```asm
.text
print_string("Hello world!")
exit()
```
After running the following command:
```bash
marspp input.asm output.asm
```
MARS++ will generate an `output.asm` with the corresponding assembly code:
```asm
.text
la $a0, label_marspp_0 # load "Hello world!"
li $v0, 4 # specify print string service
syscall # print "Hello world!"
li $v0, 10 # specify exit service
syscall # exit
.data
label_marspp_0: .asciiz "Hello world!"
```
## Getting Started
Usage:
```bash
marspp
```
## References
- c_lexer - [stb_c_lexer.h](https://github.com/nothings/stb/blob/master/stb_c_lexer.h)
- Dynamic array - [stb_ds.h](https://github.com/nothings/stb/blob/master/stb_ds.h)