Skip to content

Commit

Permalink
updated docs and demo
Browse files Browse the repository at this point in the history
  • Loading branch information
teverett committed Jan 8, 2019
1 parent 412b711 commit 98d6814
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 43 deletions.
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,30 @@ Notes on the implementation
* Math functions and string functions are implemented in the jvmBasic runtime jar "jvmbasicrt.jar"
* BASIC types are implemented by the class "Value" in jvmbasicrt.jar

Getting Started
Running an example
---------

Getting started
* build jvmBASIC: `mvn clean package install`
* use the script `run_bas.sh` to run an example:

<pre>
sh run_bas.sh hellojvmBASIC.bas
</pre>

The output should look very much like:
<pre>
shrek:jvmBASIC tom$ sh run_bas.sh hellojvmBASIC.bas
Running BASIC file hellojvmBASIC.bas
khubla.com jvmBASIC Compiler
Compiling: /Users/tom/projects/jvmBASIC/hellojvmBASIC.bas
added manifest
adding: hellojvmBASIC.class(in = 1402) (out= 740)(deflated 47%)
19:17:44.698 [main] INFO com.khubla.jvmbasic.jvmbasicrt.ExecutionContext - pushing String: '"hello from jvmBASIC"'
19:17:44.701 [main] INFO com.khubla.jvmbasic.jvmbasicrt.ExecutionContext - popping hello from jvmBASIC
hello from jvmBASIC
shrek:jvmBASIC tom$
</pre>

* cd to the "demo" directory
* Optionally edit the BASIC file "bottlesofbeer.bas"
* run "update.sh" to copy the jvmBasicc.jar and jvmBasicrt.jar files into the demo directory
* run "run.sh" to compile the BAS file, produce a jar and run the jar

Using jvmBASICC
---------
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions demo/manifest.txt

This file was deleted.

3 changes: 0 additions & 3 deletions demo/run.bat

This file was deleted.

5 changes: 0 additions & 5 deletions demo/run.sh

This file was deleted.

9 changes: 0 additions & 9 deletions demo/update.sh

This file was deleted.

2 changes: 2 additions & 0 deletions hellojvmBASIC.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
10 REM hello world
20 PRINT "hello from jvmBASIC"
18 changes: 0 additions & 18 deletions run.sh

This file was deleted.

35 changes: 35 additions & 0 deletions run_bas.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

BASFILE=$1
WORKDIR=$BASFILE.work

CLASSNAME=`echo $BASFILE | cut -d. -f1`

RUNTIME_JAR=jvmbasicrt/target/jvmbasicrt.jar
COMPILER_JAR=jvmbasicc/target/jvmbasicc.jar
MANIFEST=jvmbasicc/src/main/resources/manifest.txt

echo Running BASIC file $BASFILE

rm -rf $WORKDIR
mkdir $WORKDIR

cp $RUNTIME_JAR $WORKDIR/
cp $COMPILER_JAR $WORKDIR/

cd $WORKDIR

# compile the .bas to a class
java -jar jvmbasicc.jar -file ../$BASFILE

# make a jar
jar cvfme $CLASSNAME.jar ../$MANIFEST $CLASSNAME $CLASSNAME.class

#jar tf print.jar
#javap -p print

# run the jar
java -jar $CLASSNAME.jar

cd ..

0 comments on commit 98d6814

Please sign in to comment.