|
1 | 1 | # Minimal-JVM |
2 | 2 |
|
3 | | -A fun project to not only further my understanding of Java, but also teach myself a new paradigm (functional) and langauge (Haskell). The virtual machine will be minimal, in that it should be able to handle basic class loading, execute bytecode, and maintain a basic runtime environment (stack + heap + method area). |
| 3 | +## What is it? |
| 4 | + |
| 5 | +A 'toy' JVM interpreter written in Haskell. Currently, it is considered a 'toy' in that it is not |
| 6 | +the intention of the author for this to be used as a viable JVM compared to others such as Hotspot |
| 7 | +or Oracle's implementations. This is being developed purely for educational purposes, and as such, |
| 8 | +I may or may not diverge from the JVM specification. |
| 9 | + |
| 10 | +## Why Haskell |
| 11 | + |
| 12 | +Mind you that this is purely educational, and while I do admit that Haskell may NOT be the best |
| 13 | +language for an interpreter, I chose Haskell because I love challenges. Haskell is infamous for |
| 14 | +being difficult to learn, and so I figured it would be fun to do so. |
| 15 | + |
| 16 | +There is no particular logical reasons for as to why I chose Haskell beyond this. However, I would |
| 17 | +say that Haskell would definitely be better for a JIT Compilation virtual machine instead of an |
| 18 | +interpreter, and as such I plan to make those overhauls in the future (given the time). |
| 19 | + |
| 20 | +## How did this project come to be? |
| 21 | + |
| 22 | +This project originally was for a computer science course, called the "Organization of Programming Languages", |
| 23 | +and so I figured, why not knock out two birds with one stone by not only teaching myself a new language, a new |
| 24 | +paradigm, and to learn more about how languages are implemented? |
4 | 25 |
|
5 | 26 | ## Progress |
6 | 27 |
|
7 | | -The below list is very premature, and will undoubtedly grow to become more verbose in the future. |
| 28 | +### Class Files |
| 29 | + |
| 30 | +- [x] Parse `.class` file into data structure representation |
| 31 | +- [x] Implement support for minimal attributes, (I.E: `Code` attribute) |
| 32 | +- [ ] Implement support for all attributes |
| 33 | + |
| 34 | +### Runtime Environment |
| 35 | + |
| 36 | +- [x] Create a stack frame representation |
| 37 | +- [ ] Create a heap with minimal garbage collection |
| 38 | +- [ ] Implement bootstrap class loader for runtime |
| 39 | + |
| 40 | +### ByteCode |
| 41 | + |
| 42 | +- [x] Implement load and store operations |
| 43 | +- [x] Implement arithmetic operations |
| 44 | +- [x] Implement conditionals + `goto` jumps |
| 45 | +- [ ] Implement all instructions |
| 46 | + |
| 47 | +## Misc. Details |
8 | 48 |
|
9 | | -- [x] Basic `.class` file parser |
10 | | -- [ ] Implement and execute ByteCode instructions |
11 | | -- [ ] Implement a basic heap with minimal garbage collection |
| 49 | +The Virtual Machine implements small stubs for certain method calls that simulate |
| 50 | +the runtime, such as `System.out.println`, and as well as appending to a `StringBuilder`. |
0 commit comments