diff --git a/build_the_compiler.sh b/build_the_compiler.sh index 447a16817..e633614f3 100755 --- a/build_the_compiler.sh +++ b/build_the_compiler.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash echo "Compiling the parser..." -java -jar ./parser/antlr/lib/antlr-4.7.2-complete.jar -o ./parser/src/prog8/parser -Xexact-output-dir -no-listener -no-visitor -package prog8.parser ./parser/antlr/prog8.g4 +java -jar ./parser/antlr/lib/antlr-4.7.2-complete.jar -o ./parser/src/prog8/parser -Xexact-output-dir -no-listener -no-visitor ./parser/antlr/prog8.g4 PARSER_CLASSES=./out/production/parser diff --git a/docs/source/building.rst b/docs/source/building.rst index b6b2ac404..27ff4566c 100644 --- a/docs/source/building.rst +++ b/docs/source/building.rst @@ -2,8 +2,33 @@ Writing and building a program ============================== -What is a "Program" anyway? ---------------------------- +First, getting a working compiler +--------------------------------- + +Before you can compile Prog8 programs, you'll have to build the compiler itself. +First make sure you have installed the :ref:`requirements`. +Then you can choose a few ways to create the compiler: + +**Using the shell script:** + +#. run the "build_the_compiler.sh" shell script +#. it will create a "prog8compiler.jar" file which contains everything. +#. run the compiler with "java -jar prog8compiler.jar" to see how you can use it. + +**using the Gradle build system:** + +#. run the command "./gradlew installDist" +#. it will create the commands and required libraries in the "./compiler/build/install/p8compile/" directory +#. run the compiler with the "./compiler/build/install/p8compile/bin/p8compile" command to see how you can use it. + +**download a precompiled version from github:** + +#. download a recent "prog8compiler.jar" from `the releases on Github `_ +#. run the compiler with "java -jar prog8compiler.jar" to see how you can use it. + + +What is a Prog8 "Program" anyway? +--------------------------------- A "complete runnable program" is a compiled, assembled, and linked together single unit. It contains all of the program's code and data and has a certain file format that diff --git a/docs/source/index.rst b/docs/source/index.rst index ec47eeef4..4f912c9fd 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -130,11 +130,16 @@ of the `Vice emulator `_. packaged jar file. .. note:: - To build the compiler from source, Kotlin SDK version 1.3 or newer is needed. + Building the compiler itself: + + (re)building the compiler itself requires a Kotlin SDK version 1.3. The compiler is developed using the `IntelliJ IDEA `_ IDE from Jetbrains, with the Kotlin plugin (free community edition of this IDE is available). But a bare Kotlin SDK installation should work just as well. - A shell script is provided to build and package the compiler from the command line. + A shell script (``build_the_compiler.sh``) is provided to build and package the compiler from the command line. + You can also use the Gradle build system to build the compiler (it will take care of + downloading all required libraries for you) by typing ``gradle installDist`` for instance. + The output of this gradle build will appear in the "./compiler/build/install/p8compile/" directory. .. note:: Development and testing is done on Linux, but the compiler should run on most diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 67224ceca..c93ec39c7 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -29,11 +29,22 @@ Add more compiler optimizations to the existing ones. - on the language AST level - on the StackVM intermediate code level - on the final assembly source level +- can the parameter passing to subroutines be optimized to avoid copying? Also some library routines and code patterns could perhaps be optimized further +Eval stack redesign? (lot of work) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The eval stack is now a split lsb/msb stack using X as the stackpointer. +Is it easier/faster to just use a single page unsplit stack? +It could then even be moved into the zeropage to greatly reduce code size and slowness. + +Or just move the LSB portion into a slab of the zeropage. + + Misc ^^^^ diff --git a/prog8.iml b/prog8.iml new file mode 100644 index 000000000..3951498fb --- /dev/null +++ b/prog8.iml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file