The following instructions should work on any platform, from OS X to Ubuntu. It builds the compiler from source, thus may take some time.
-
Make sure you have installed the dependencies:
- Install the Haskell Platform
- Java SDK (8 or newer)
- Apache Ant (version 1.8 or above)
-
git clone https://github.com/hkuplg/fcore.git cd fcore
-
Build and install:
cabal update make
-
After the installation, invoking
f2jin your console will show its usage. If not, you probably want to add.cabal/binto your$PATH.
-
Software preparation
- Java SDK (8 or newer)
- Apache Ant (version 1.8 or above)
- git
- minGHC, which includes GHC, Cabal, MSYS
- Have a make. There is a make in minghc\msys\bin. Or one can use GNU Make
-
Then the same as above.
See doc directory for more details.
F2j has a few built-in compilation methods (by default, it doesn't
use any optimization), namely apply, stack and unbox.
- Apply: multi-argument optimization
- Stack: tail call elimination
- Unbox: auto-unboxing optimization
To use one or more of them, simply append the compilation methods you want to use as the command line arguments.
For example, say you want to use the apply method, running the
following command:
f2j -m apply some_file
If you want to combine different methods (say, apply and stack),
just type:
f2j -m apply -m stack some_file
Finally, passing -r flag will make the compiler compile and run the
generated Java code.
There is also a REPL at your service. Simply invoking f2ji will take
you to the REPL.
In the example directory, you will see a lot of example programs
written in FCore. You may want to take a look at them to get familiar
with the syntax. These examples demonstrate different features of our
compiler, such as call-by-name, record syntax, modules, thunk, type
synonyms, etc.
Particularly, in examples/fractals, there is an interesting program
that draws a fractal.
If you run into any problem, try to do
make clean
and then
make
If the problem persists, create an issue!
BSD 3
See LICENSE at the top-level directory for details.
