Software Architecture

Figure 1 shows the three containers of the Frege IDE:

Container Diagram of the Frege Integrated Development Environment
Figure 1. Container Diagram of the Frege Integrated Development Environment
Container Diagram Key
Figure 2. Diagram Key for Figure 1
Frege Language Server

reads Frege project configurations from the Frege Gradle plugin container, receives language server protocol (LSP) requests and notifications from the Frege language extension, extracts the requested language feature from the Frege compiler, transforms it to an LSP type and sends the result back to the Frege language extension, as shown in Figure 1. The core components are written in Frege, while the LSP component is written in Java.

Frege Gradle Plugin

adds both Frege project support and the Tooling API to the Gradle build tool. It follows the official Gradle plugin development guidelines to add Frege specific tasks to Gradle and uses the official Tooling API to expose configuration to the Frege language server container. It is written in Java.

Frege Language Extension

Currently, there only exists the Visual Studio Code Extension, which adds Frege language support to the Visual Studio Code (VS Code) text editor. It follows the official VS Code language server extension guidelines and is written in Typescript.

Frege Language Server

The Frege language server is the core container of the Frege IDE.

Components Diagram of the Frege Language Server
Figure 3. Components Diagram of the Frege Language Server
Components Diagram Key for <<img-frege-server-components>>
Figure 4. Diagram Key for Figure 3

Figure 3 zooms into the Frege Language Server container and shows its components.

LSP

The LSP component is the gateway to incoming and outgoing LSP requests and notifications. It delegates language feature requests and notification to the responsible component. On activation of the Frege language extension it queries the project component to recognise a Frege project. It uses the LSP4J language binding library and is therefore written in Java.

Project

The project component extracts relevant Frege project configuration with the help of the Frege Gradle plugin. If the developer has setup his Frege project without any build tool, sane defaults are provided. The configuration is forwarded as compiler options to the compile component. Written in Java.

Compile

Runs the Frege compiler, extracts all available compiler information called global and saves them in memory. Impure Frege Module.

Diagnostics

Responsible for the diagnostics language feature. Extracts all available errors and warnings from the compiler global and transforms them to the LSP diagnostics type. Pure Frege module.

Hover

Responsible for the hover language feature. Extracts all available type signatures of functions and variables from the compiler global and transforms them to LSP hover type. Pure Frege module.

Frege Gradle Plugin

Figure 5 zooms into the Frege Gradle plugin container and shows its components.

Components Diagram of the Frege Gradle Plugin
Figure 5. Components Diagram of the Frege Gradle Plugin
Components Diagram Key for <<img-frege-gradle-plugin-components>>
Figure 6. Diagram Key for Figure 5

The tasks component adds the following tasks to Gradle:

setupFrege

Downloads the specified version of the Frege compiler.

initFrege

Creates a default HelloFrege.fr example file under mainSourceDir/examples/HelloFrege.fr. Alternatively, you can specify the location on the command line with --mainModule=my.mod.HelloFrege.

compileFrege

Compiles all your *.fr files in mainSourceDir to outputDir. Alternatively, you can also specify the compile items by with the compileItems property. Then only the specified compile items and its dependencies get compiled. E.g.: compileItems = [ 'my.mod.Mod1', my.mod.Mod2' ].

compileTestFrege

Same as compileFrege but compiles all your *.fr files in mainSourceDir to testOutputDir. Used by the testFrege task.

runFrege

Runs the Frege module specified by mainModule. Alternatively you can also pass the main module by command line, e.g: gradle runFrege --mainModule=my.mod.Name.

testFrege

Tests all QuickCheck properties defined in the specified testModules. You can pass test args on the command line, e.g: gradle testFrege --args="-v -n 1000 -p pred1. Run gradle testFrege --args=-h to see all options.

replFrege

Takes care of all project dependencies of the specified replModule and prints the command to start the Frege REPL and load the replModule. E.g.: (echo :l <path to replModule.fr> && cat) | java -cp <your-correct-classpath-with-all-dependencies> frege.repl.FregeRepl. On Unix you can even further automate starting the repl and loading the module with the following one-liner: eval $(./gradlew -q replFrege).

The tooling component exposes configuration relevant for the Frege compiler through the Gradle Tooling API. The exposed configuration parameters are declared in the FregeProjectInfo class.

See the Github repository for how to install, use it and more details.

Frege Language Extension

The VS Code Frege language extension adds Frege support to the Visual Studio Code editor. It is activated as soon as you open a .fr file, starts the included Frege language server and visualises supported language features. See the Functional Overview page for all supported features and the corresponding Github repository for how to install, use it and more details.