Skip to content
Dierk König edited this page Feb 27, 2015 · 22 revisions

This document gets you started with the command line version of the Frege compiler. If you prefer an IDE, you may want to read the wiki of the Eclipse plugin. Limited support is also available for IntellijIDEA.

There is also special support for build systems like maven, leinigen, and gradle. See the related projects.

Prerequisites

  • computer with 256MB memory available to user processes. For compiling very large programs (like the yacc generated parser of the frege compiler, approx. 1800 functions on 40000 lines), 3 to 4 times more memory will be needed.
  • 50MB disk space for the unpacked downloads.
  • a Java 7 compatible JDK
  • Compiler developers will need perl, make and berkeley yacc - look for byacc, pbyacc or byaccj.

##Compile, run and document Frege programs

  • Download the latest frege3.xx.vvv.jar from the releases page, and rename it to fregec.jar
  • Use your preferred editor. There is some support for Frege in UltraEdit and jEdit, see the examples/ source directory.
  • In the examples/ subdirectory of the source tree you also find some small programs to play with.
  • Customize your command-line window so that it can display unicode characters. (on Windows, try: chcp 65001)
  • Make sure the JDK7 java compiler is in the path: javac -version
  • Make sure the JDK7 java launcher is in the path: java -version
  • Display usage page of the Frege compiler: java -jar fregec.jar -help
  • Make a subdirectory to hold Frege generated classes: mkdir build
  • Compile your program (the -Xss1m protects us from getting stack overflow exceptions and should be sufficient even for large source programs):

java -Xss1m -jar fregec.jar -d build test.fr

  • Neither the source code file nor the fregec.jar have to reside in the current directory. Of course, if they don't, the compile command above must be adapted accordingly.
  • Unlike in java, the source path does not have to match the module name. However, when the module name is x.y.Z, the class file goes into build/x/y/Z.class, where build is the (already existing) directory specified with the -d option, which is the current directory by default. You'll also find the intermediate java file in build/x/y/Z.java, just in case you're interested to see really incomprehensible java code - please protect children and young programming adepts from looking at it.
  • If your program contained a main function, you can now run it with the following command where Test is the package or module name. Under Linux, write : instead of ; to separate class path components:

java -cp build:fregec.jar Test

  • If your program contains QuickCheck properties, you can now check them:

java -cp build:fregec.jar frege.tools.Quick Test

  • Generate a documentation for your module or for any other module from the fregec.jar:

java -cp build:fregec.jar frege.tools.Doc Test

Clone this wiki locally