Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
This tutorial will walk you through the installation and initial project set-up.
The Eclipse plugin that supports Frege is called fregIDE. Don't ask how to pronounce that!
With the fregIDE, you can develop, build and run Frege programs. It supports the following:
- Enabling an existing java project to use the Frege Builder.
- Frege preferences
- Syntax/semantic coloring, including distinction between imported, top level and local names.
- Outline view
- Mouse over documentation (Mouse Over)
- Mouse over navigation (Mouse Over, Ctrl+CLick)
- Editor actions to support funny glyphs
- Live error markers in the editor
- Code completion (Ctrl+Space)
- Project build, i.e. compilation of Frege sources, takes dependencies into account.
- Compilation populates the problem view with errors, warnings and hints and the editor with persistent markers.
- Run programs through JDT Run Configurations. (Create a run configuration for a
- JRE 1.8 (no JDK required) or higher
- Eclipse 4.3.2 (Kepler), 4.4.1 (Luna), 4.5 (Mars), 4.5.1 (Mars.1), 4.7.2 (Oxygen.2) Different versions may also work, listed ones are known to work.
The Frege programs developed in Eclipse will not depend on any Eclipse libraries. To run them apart from Eclipse, you'll still need Frege runtime classes. You can either use the ones that come with the Eclipse plugin (they will be in a file named
fregec.jar located somewhere below the eclipse plugin directory) or download a binary compatible JAR from the Frege download page.
You should be able ...
- to start up eclipse.
- select the Java perspective
- create a fresh Java project
- create source files in the project
Eclipse should have the following minimum VM settings:
The stack space that is normally allocated by the JVM is not enough for serious work in a functional language like Frege. Hence, we require a substantial amount of stack space with
-Xss from the JVM.
4 megabytes are abundand, and chosen so that source files with some ten thousand lines can be compiled.
Here is the relevant section of my
eclipse.ini (the last six lines):
-vmargs -Dosgi.requiredJavaVersion=1.8 -Xss4m -Xms400m -Xmx2048m
For more help on configuring eclipse see the eclipse wiki.
Note that the
eclipse.ini settings are effective only on the next start of eclipse.
The workspace should be configured to have all text files in UTF-8 encoding by default. The frege plugin currently does not support other encodings for frege source files. To compile frege files in different encodings, one needs to use the command line compiler with the
-encoding option. However, as long as one restricts itself to ASCII, the encoding is of course immaterial.
To check this setting, click
Window in the main menu, then select
Preferences in the sub-menu. Expand the
General category, and select
Workspace (the last sub-item, usually). Check the
Text file encoding options in the lower left of the property sheet.
- Start up Eclipse.
- Open the preferences page
Preferences, and go to the
Install/Updatesection. Open the
Available Software Sitespage and
Add...the Frege Update Site with Location
http://www.frege-lang.org/fregide/(or, if that doesn't work
https://raw.githubusercontent.com/Frege/frege.github.com/master/fregide). Close the preferences page. (This must be done upon first install of fregIDE only.)
- Open the installation page
Install New Software
- From the drop down list near the top of the dialog window, select the Frege Update Site.
- In the list box expand the category
Frege IDE Supportand select the latest version of
Frege DevelopmentDo not use items from any other category, unless advised otherwise.
Next>to start the installation and confirm a few dialogs, license agreements and warnings because of unsigned content to complete it.
- When asked, restart Eclipse to activate the installed plugins.
Update from an earlier version (<= 3.23.343)
Follow the migration guide.
First, try replacing the fregec.jar
Most of the time you want to spare yourself the hassle of plugin-upgrading, when all you want are the latest Frege language features, bug fixes, etc.
As there is little, if any, actual change in the plugin code itself anymore, you may get away with replacing the
fregec.jar. For this, download the latest or build your own from HEAD, and copy it to
while eclipse is stopped and where ... denotes your eclipse installation directory. You may want to save the old one, in case something goes wrong. (To find out the exact path of the fregec.jar your eclipse plugin is using, look under Referenced Libraries in the Project Explorer.)
If the new
fregec.jar is not compatible with the eclipse plugin, you'll get strange errors in the Error Log, there is no syntax highlighting, building the project is not working, etc.
In this case, you may restore your previous fregec.jar, or go on with updating.
If that didn't work ....
An update is performed like an installation. Eclipse will recognize automatically that the plugin is updated. After Eclipse has completed and is restarted, the following must be done for each Frege Project:
before the update In the
Projectmenu, make sure
Build Automaticallyis turned off.
- In the Package Explorer, locate the old
fregec.jarlibrary shown under Referenced Libraries, right click and select menu item
Remove from Build Path.
- Enable the Frege Builder again, this will add the new library to the project.
- Do a
Clean Buildto address compatibility issues. Afterwards you may turn on
This is needed because the link to
fregec.jar under Referenced Libraries will still point to the previous
fregec.jar. As of recently, the plugin checks for this and will flag errors so that you can't compile with a bad setup, which has led to numerous errors and confusion in the past.
- Review the
Fregepage. Choose colors and fonts. If there is no
Fregepreferences page, your Eclipse instance most probably does not run with Java >= 1.8 or there were errors during installation of the Frege IDE.
- Create a Java project.
- From the context menu of the project, select
Enable Frege Builder. This will add the
fregec.jarto the Referenced Libraries of the project and enable the builder for Frege files.
Note that the order of Java and Frege builder is important for polyglot programming: If you have Java source code in the project that you are going to call from Frege, the Java builder should run first (this is the standard case). If, however, the java code calls into Frege, the build order should probaly be reversed. The build order can be changed in the project properties.
fregec.jar that comes with the fregIDE can also be used from the commandline.
- Create a source file (New File) with extension
.frand begin editing. Please make sure you don't mix tabs and spaces.
- Code completion and content proposals (invoked normally by CTRL+Space) work the better the fewer errors are currently flagged. Please find the details here.
- When you save your file (Ctrl+S), it will get compiled (unless you have turned off
Build Automaticallyfor the project). Check the
Problemsview for errors, warnings and hints. Most of the time when you don't have red marks in the editor window before saving, the compilation will succeed.
- To run your program from within Eclipse, create a Run Configuration of type Java Application. The name of the main class is the module name you used in the Frege file where the
mainfunction you want to run is located. (For some mysterious reason, Eclipse cannot find this name, so you have to type it.) You may also need to give appropriate values for
-Xssas VM arguments under the Arguments tab. Give the Run Configuration a meaningful name and run it from the Eclipse Run menu. Standard input and output will be done through the console view.
Not yet implemented, but planned:
- QuickCheck support
- Interpreter ("scrapbook")
Not implemented, unsure whether we need it:
- text folding
- text formatting
- When you get no syntax coloring, make sure in Windows -> Preferences -> General -> Editors -> File Associations that the file type
.fris associated with the "Impulse Editor". Close the editor tab and open it again.
- When opening a Frege file, the plugin will type check the source code. This may take a few seconds, especially when Eclipse was just started up and the frege compiler code is not "warm" yet. Later on, you wont even notice.
- When you feel that the GUI is getting too slow, you probably have several thousand lines of source code in the editor window. Time to think about modularization!
- When editing module A that imports module B, changes in the source code of B will not be recognized until B is recompiled and the editor of A is refreshed by clicking the
Refreshbutton in the task bar while A is active.
- Sometimes, it happens that some error markers persist even if you did correct everything. This is especially an issue with Build Path problems (i.e. wrong fregec.jar, etc.). If nothing else helps, open Navigator View, go to the output directory (most often
bin/), refresh it and then delete everything beneath. Restart Eclipse and do a clean build.