Skip to content

Commit 9981da8

Browse files
author
Louis Jenkins
committed
Moving this stuff to distribution branch because unfortunately it breaks ghc-mod and friends entirely, making development near impossible
1 parent 6d3bf36 commit 9981da8

35 files changed

+378
-3
lines changed

ChangeLog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Revision history for Minimal-JVM
22

3-
## 0.1.0.0 -- YYYY-mm-dd
3+
## 1.0.0.0 -- YYYY-mm-dd
44

55
* First version. Released on an unsuspecting world.

Examples/HelloWorld$.class

671 Bytes
Binary file not shown.

Examples/HelloWorld.class

608 Bytes
Binary file not shown.

Examples/HelloWorld.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object HelloWorld {
2+
def main(args: Array[String]): Unit = {
3+
println("Hello, world!")
4+
}
5+
}

Main.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ module Main where
66

77
main :: IO ()
88
main = do
9+
let debug = False
910
setLocaleEncoding utf8
10-
r0 <- BS.readFile "Examples/ArithmeticTest.class"
11+
r0 <- BS.readFile "Examples/HelloWorld$.class"
1112
putStrLn $ "Starting Bytes: " ++ show (BS.length r0)
1213
let classFile = parseClassFile r0
1314
print classFile
1415
putStrLn "Initializing Runtime Environment..."
15-
env <- VirtualMachine.Environment.init False
16+
env <- VirtualMachine.Environment.init debug
1617
putStrLn "Loading bootstrap class..."
1718
loadClass env classFile
1819
putStrLn "Starting Virtual Machine..."

Minimal-JVM.cabal

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
-- Initial Minimal-JVM.cabal generated by cabal init. For further
2+
-- documentation, see http://haskell.org/cabal/users-guide/
3+
4+
-- The name of the package.
5+
name: Minimal-JVM
6+
7+
-- The package version. See the Haskell package versioning policy (PVP)
8+
-- for standards guiding when and how versions should be incremented.
9+
-- https://wiki.haskell.org/Package_versioning_policy
10+
-- PVP summary: +-+------- breaking API changes
11+
-- | | +----- non-breaking API additions
12+
-- | | | +--- code changes with no API change
13+
version: 1.0.0.0
14+
15+
-- A short (one-line) description of the package.
16+
synopsis: A 'toy' Java Virtual Machine interpreter written in Haskell (Educational)
17+
18+
-- A longer description of the package.
19+
-- description:
20+
21+
-- URL for the project homepage or repository.
22+
homepage: github.com/LouisJenkinsCS/Minimal-JVM
23+
24+
-- The license under which the package is released.
25+
license: BSD3
26+
27+
-- The file containing the license text.
28+
license-file: LICENSE
29+
30+
-- The package author(s).
31+
author: Louis Jenkins
32+
33+
-- An email address to which users can send suggestions, bug reports, and
34+
-- patches.
35+
maintainer: [email protected]
36+
37+
-- A copyright notice.
38+
-- copyright:
39+
40+
-- category:
41+
42+
build-type: Simple
43+
44+
-- Extra files to be distributed with the package, such as examples or a
45+
-- README.
46+
extra-source-files: README.md, ChangeLog.md
47+
48+
-- Constraint on the version of Cabal needed to build this package.
49+
cabal-version: >=1.10
50+
51+
52+
executable Minimal-JVM
53+
-- .hs or .lhs file containing the Main module.
54+
main-is: Main.hs
55+
56+
-- Modules included in this executable, other than Main.
57+
-- other-modules:
58+
59+
-- LANGUAGE extensions used by modules in this package.
60+
other-extensions: UnicodeSyntax
61+
62+
-- Other library packages from which modules are imported.
63+
build-depends: base >=4.9 && <4.10, bytestring >=0.10 && <0.11, containers >=0.5 && <0.6, array >=0.5 && <0.6, ansi-terminal >=0.6 && <0.7, data-binary-ieee754 >=0.4 && <0.5, mtl >=2.2 && <2.3, base16-bytestring >=0.1 && <0.2
64+
65+
-- Directories containing source files.
66+
hs-source-dirs:
67+
68+
-- Base language which the package is written in.
69+
default-language: Haskell2010
70+

Minimal-JVM.rar

1.5 MB
Binary file not shown.

OPL_README.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
##################################
2+
## Instructions:
3+
##################################
4+
5+
Main.hs can be modified to run the '.class' files specified in the Examples folder.
6+
To include your own, you must compile it with your JVM compiler of choice. Currently, either Scala
7+
or Java will work (Scala must use the '*$.class' file, meaning the identical class file with the same
8+
file name but with a dollar sign as a suffix). Theoretically, this should work with any JVM language
9+
which only has basic operations that do not invoke the Runtime, which makes this Virtual Machine all the
10+
more fun.
11+
12+
It is recommended that you use some kind of text editor with syntax highlighting. I use 'Atom', but 'Visual Studio Code' and 'Sublime' should suffice.
13+
14+
To Install: 'cabal build && cabal install'
15+
To run (from root of project): './dist/build/Minimal-JVM/Minimal-JVM.exe'
16+
17+
Notes: This is a very early build of the program, and as such, isn't really flexible.
18+
It requires that the program be called from the directory in which the test file is
19+
located in 'Examples' subdirectory. It should be fixed soon, but you never know what might come up.
20+
21+
Documentation is rather premature, but you can open it by viewing 'Documentation/index.html'

Setup.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain
21.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)