Preliminary new compiler for java8

@Ingo60 Ingo60 released this Mar 6, 2016 · 650 commits to master since this release

The preliminary jars here are intended for community members who develop tools like REPL, IDEs and Builders.

A public release is planned to appear in a few weeks, but there are still some minor bugs to fix, issues to resolve, documentation to write and cleanup to do.

Note that except for small programs, you'll need a JAVA 9 SDK if you want to target Java8, since the javac in Java8 is broken.

The JARs with version numbers 3.24-7 are compiled for target 1.7 and allow Frege development with Java7.

It goes without saying that bug reports are welcome.

Patch Log

  • 61: compiler accepts code without module blabla where

  • 80: Syntax for generic type variables with bounds and wild cards.

  • 100: fixed Issues #270, #271, #272, Haskell compatibility rgd. braces in layout mode, experimental: show original code in error messages


Summer 2015

@Ingo60 Ingo60 released this Aug 19, 2015 · 811 commits to master since this release

The JARs offered here should run with JDK9, as they contain the fix for #165

Also, if you want to build "master", you will need to use one of those.

From 3.23.343 on, we use Haskell lambda syntax. There are a few cases where previously valid syntax won't compile any more (in the whole standard codebase, there were 5 corrections to make). So please recompile your sources to make sure you're up to date.

From 3.23.365 on, we use Haskell class/instance syntax.
Unfortunately, this means that most of your non-trivial class and instance declarations will fail the syntax check. Please adapt and recompile.

Version 3.23.370 contains some patches to show instance and class definitions in the new syntax in the eclipse plugin and doc tool.

Because of the radical syntax change in 365, earlier versions have been removed.

Version 3.23.401 includes the change to Haskell variable names due to @danielkroeni . Unfortunately, this results in changed class names in the binaries, as we had to replace heading underscores with $ signs. This means that this version is not binary backwards compatible with earlier ones, so you have to recompile your sources once.

Finally, 3.23.422 fixes a bug in code generation that has gone unnoticed since February.

The 3.23.888 is (hopefully) the latest 3.23 release before switching to 3.24.

Please read the release notes for more information.


Winter 2015

@Ingo60 Ingo60 released this Jan 10, 2015 · 1144 commits to master since this release

Please Note The JARs here will not run with JDK9. To run Frege with JDK9, use one of the preliminary releases under "Summer 2015".

Also, as of Aug 20, 2015 you can't build the master branch with those releases anymore.

See description in the wiki.
In certain cases it may be that code that compiled previously doesn't with the new compiler. Most of the time the reason is one of the following:

  • lexical errors with no longer supported regular expression literal syntax #foo#
  • lexical errors with operators
  • errors that can be traced back to problems with precedence and/or associativity of operators.

You should be able to solve these after having read the aforementioned wiki page. Or just ask on SO or in the news group.

Please report other errors as issues.

There is also a corresponding version of the eclipse plugin ready for upgrade from the upgrade site, see the fregIDE tutorial. Unless indicated otherwise, you can update your frege IDE 3.22 installation by replacing the fregec.jar with a more recent one from the series.


Final 21

@Ingo60 Ingo60 released this Apr 9, 2014 · 1474 commits to master since this release

This is the final release of the 3.21 branch, and serves as fallback (just in case ...), it is also the starting point for the 3.22 releases that will result in an overhauled compiler.

The goals are thus:

  • Scanner must not load classes. Because of this, precedence and associativity of operators will not be known to the parser.
  • Parser will not: desugar do-blocks and list comprehensions, translate expressions to patterns and will not resolve applications with binary operators. A new source expression type will be needed for this.
  • Benefit: Desugaring pass and instance derivation does not need to distinguish between expressions and patterns, which should reduce the support code by 50%.
  • Desugaring happens only after import pass, together with name resolution. At this point, the symbol tables of the imported modules are known, which contain operator information n the associated symbols. This will solve also the long standing problem that operator names appear "global", i.e. you can't have two operators with the same name but different associativity and precedence in different modules, without the compiler choosing silently one of the associativities/precedences. Also, these properties can be documented/shown in the IDE.
  • Every pass will be of type StateT IO Global. Most passes will not do IO, however. (Scanner, Import, and code generation, of course, must be able to do IO, as well as future plug-ins). Error messages are saved in the state and are printed at the end of the pass. (Trace output will use trace/traceLn, not IO)
  • The monolithic big source files (like, that contains 4 different passes) will get splitted up.
  • A better make facility will do a dependency analysis of the given source files and compile in parallel, if possible. We will cache the global state, not the annotations from the class files. The latter prooved to be buggy in the presence of certain changes: when B depended on A and A was changed, this loaded the old A.class, then compiled A, then tried to compile B. But in B's import pass, the old A class was still there, so compilation terminated with phantom errors: errors that went away by just restarting the compilation (because then, the new A.class could be loaded). This also makes the import independent with regard to the source of the global state of imported modules: if it was compiled or imported before, the available state can be used, and only if it was not imported before and not build in the same session will the class file get loaded and the global state reconstructed. This will make it possible to javac the produced java files in one go, which could again be faster than now.


Release 500

@Ingo60 Ingo60 released this Mar 26, 2014 · 1560 commits to master since this release

  • a [Char] is now printed as string, like in Haskell.
  • forkIO and forkOS are different now. The former submits a task in a fixed size thread pool executor which is provided by the runtime. The latter, as before, creates an OS thread.
  • In IDE mode, compiler will replace unresolved variables with undefined, and will continue working, up to and including type check. This makes it probable that unrelated code (and in many cases also code near the error, as undefined shouldn't introduce type errors) can still get typechecked, and IDE features like content assist will be able to do better work.
  • Syntactic sugar: _.foobar desugars to (\it -> it.fooBar). This will typecheck if and only if: the argument type of the lambda is not a type variable and the type of the argument has a foobar function or foobar is a class operation. A successful type check will rewrite the lambda like (\it -> T.fooBar it), where T is the type constructor of the type of it. Later, a simplifying compiler pass will un-eta-expand the lambda, and the result is just T.fooBar. This way, we can TDNR a function even if we have no actual syntactic argument it is applied to! This comes in handy in point free or monadic context:

    letters = packed . filter _.isLetter . unpacked
    foolines sss = openReader sss >>= _.getLines >>= return .  any (flip _.startsWith "foo")

    The first example filters the letters of a string. The second one tells if a named file contains lines that start with "foo". Apart form saving a few keystrokes, the _.foobar notation is immune against changes of the type name. Also, you do not even have to be able to name the type taht contains foobar.

  • Access to characters in strings doesn't work anymore with syntax str.[index]. Use charAt. The syntactic sugar is only valid for arrays.


Patch 440

@Ingo60 Ingo60 released this Mar 8, 2014 · 1620 commits to master since this release

Patch released especially for @mmhelloworld so he can proceed with the online REPL output handling.

Also for those who want to build the compiler, but get stuck on commit 90df590


  • Mar 7, 2014


    Make 'stdin', 'stdout' and 'stderr' thread local.
    NOTE: Because the java type of those items changed from
    PrintWriter/BufferedReader to ThreadLocal<PrintWriter>/ThreadLocal<BufferedReader>
    this change is binary backwards compatible. In particular,
    code compiled with an earlier version will try to access
    'stdout' as 'PrintWriter'.