Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nickgeek/lmc-to-c
Generates C code from LMC assembly
https://github.com/nickgeek/lmc-to-c
assembler assembly education lmc
Last synced: 28 days ago
JSON representation
Generates C code from LMC assembly
- Host: GitHub
- URL: https://github.com/nickgeek/lmc-to-c
- Owner: NickGeek
- License: mpl-2.0
- Created: 2018-01-14T09:00:22.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-15T09:32:54.000Z (about 7 years ago)
- Last Synced: 2024-11-17T12:48:43.267Z (3 months ago)
- Topics: assembler, assembly, education, lmc
- Language: C
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LMC to C
This program generates C code from [LMC assembly](http://www.vivaxsolutions.com/web/lmc.aspx). The script reads from stdin so you can run it and just start typing assembly, and leave a newline to generate the C code, or pipe in a script. Using shell magic you can even convert, compile, and run in one line:```bash
cat fib.asm | python3 parser.py | gcc -xc -; ./a.out
```You can also specify a memory size as a command line argument to `parser.py` like: `python3 parser.py 500` to have 500 cells of memory instead of the default 100.
## Extra Instructions
| Instruction | Op Code | Description |
| ----------- | ------- | ------------------------------------------------------------------------------------------- |
| `DBG` | 401 | Prints the current value in the register, the program counter value, and the data in memory |
| `IST` | 903 | Like `INP` but it accepts a character as input rather than a number |
| `OST` | 904 | Outputs the current value in memory as a character instead of a number |