https://github.com/crenshaw-dev/cpusim
A very simple CPU simulator in Python
https://github.com/crenshaw-dev/cpusim
compiler lexer
Last synced: 2 months ago
JSON representation
A very simple CPU simulator in Python
- Host: GitHub
- URL: https://github.com/crenshaw-dev/cpusim
- Owner: crenshaw-dev
- License: gpl-3.0
- Created: 2017-04-06T16:42:21.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-06T16:42:55.000Z (about 9 years ago)
- Last Synced: 2025-03-21T11:21:21.720Z (over 1 year ago)
- Topics: compiler, lexer
- Language: Python
- Size: 18.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: COPYING
Awesome Lists containing this project
README
= Simple CPU Simulator =
A project written by Michael Crenshaw to fulfill Honors
Petition requirements for CSIS 434-001, Spring 2016.
== Usage ==
CPU.py when run alone checks for a file named program.dat in the current working
directory. It then assembles that code, compiles it, and then runs it. It writes
output from the lexical analyser, assembler, and compiler to intuitively-named
output files, and it writes the CPU's register and memory data to cpu_output.txt
and prints it to the screen.
If no program.dat exists, a default program hard-coded in CPU.py will be
executed.
== Language Definition ==
->
-> | ;
-> |
-> :=
-> TO DO END
-> | ;
-> |
-> |
-> |
-> | |
-> + | - | * | /
-> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
-> a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q |
r | s | t | u | v | w | x | y | z
Two major limitations of this language are that it does not allow nested loops
and that it does not allow complex math operations (that is, they must occur one
at a time).