Skip to content

Commit fc237ec

Browse files
committed
doc(README): update
1 parent 09ac444 commit fc237ec

File tree

4 files changed

+86
-1
lines changed

4 files changed

+86
-1
lines changed

README.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,74 @@
11
# simple-assembler
2-
Simple assembler for my custom cpu
2+
3+
![lint-workflow](https://github.com/benoitlx/simple-assembler/actions/workflows/ci.yml/badge.svg)
4+
5+
Simple assembler for my custom cpu.
6+
7+
You should not be interested in this project unless you're curious about making your own assembler or you want to test out my [cpu](https://benoitlx.github.io/simple-cpu-wiki/Assembler/Assembler) (wip).
8+
9+
## Installation
10+
11+
It's only possible to install it from source for now.
12+
13+
Clone this repository and `cd` into it. Then run `cargo build --release` to build the binary.
14+
You can place the binary `simple-assembler` located in `target/release` in your `PATH` in order to access it from everywhere.
15+
16+
## Usage
17+
18+
```
19+
Usage: simple-assembler [OPTIONS] <FILE_PATH>
20+
21+
Arguments:
22+
<FILE_PATH> assembly file path
23+
24+
Options:
25+
-c, --color whether to colorize the bit stream output
26+
-d, --debug whether to print debug messages
27+
-s, --sep <SEP> separator between each words in the bit stream [default: ]
28+
--w-off whether to turn off warnings
29+
-W, --Warn whether to output the bit stream if warnings are encountered
30+
-o, --output <OUTPUT_PATH> save output in designated file
31+
-h, --help Print help
32+
```
33+
34+
## Example on a simple program
35+
36+
```asm
37+
DEFINE foo 0x7fff
38+
DEFINE unused_var 42 ; warning here
39+
40+
main:
41+
A = foo
42+
D = *A
43+
A = 5
44+
D = D & A
45+
46+
A = A ~ A ; error here
47+
48+
A = main
49+
JMP
50+
```
51+
52+
Running `simple-assembler prog.asm -c` on the code above gives us this output :
53+
54+
![Errors](/examples/output_with_error.png)
55+
56+
Commenting the error and the warning outputs the following :
57+
58+
![out](/examples/output.png)
59+
60+
61+
62+
## TODO
63+
64+
- [ ] Handle more error with miette (tokenization errors, ...)
65+
- [ ] Integration test for parser
66+
- [ ] Benchmark
67+
68+
## Acknowledgments
69+
70+
Here are the amazing crates I used to make this small project :
71+
- [logos](https://github.com/maciejhirsz/logos) for tokenization
72+
- [miette](https://github.com/zkat/miette) for error report
73+
- [clap](https://github.com/clap-rs/clap) for parsing cli arguments
74+
- [colored](https://github.com/colored-rs/colored) to colorize the output of the program

examples/output.png

24.9 KB
Loading

examples/output_with_error.png

63.7 KB
Loading

examples/prog.asm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DEFINE foo 0x7fff
2+
; DEFINE unused_var 42 ; warning here
3+
4+
main:
5+
A = foo
6+
D = *A
7+
A = 5
8+
D = D & A
9+
10+
; A = A ~ A ; error here
11+
12+
A = main
13+
JMP

0 commit comments

Comments
 (0)