Giter Club home page Giter Club logo

fcore's Introduction

F2J: A Compiler for FCore

License BSD 3 Build Status Stories in Ready

Building from Source

The following instructions should work on any platform, from OS X to Ubuntu. It builds the compiler from source, thus may take some time.

  1. Make sure you have installed the dependencies:

    • Java SDK (8 or newer)
    • Apache Ant (version 1.8 or above)
    • stack
  2. Clone the source with git:

    git clone https://github.com/hkuplg/fcore.git
    cd fcore
  1. Quick install with stack:

    make

    You may be prompted to run stack setup, which will automatically download the GHC compiler if needed.

  2. After the installation, invoking f2j in your console will show its usage. If not, you probably want to add ~/.local/bin to your $PATH.

Building on Windows

The above instructions should automatically work on Windows.

Documentation

See doc directory for more details.

Compilation Methods

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.

REPL

There is also a REPL at your service. Simply invoking f2ji will take you to the REPL.

Examples

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 record syntax, modules, type synonyms, etc.

Particularly, in examples/fractals, there is an interesting program that draws a fractal.

Troubleshooter

If you run into any problem, try to do

make clean

and then

make

If the problem persists, create an issue!

License

BSD 3

See LICENSE at the top-level directory for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.