<commit_before>---
layout: page
title: "Milestone 1: Syntax Analysis"
excerpt: "Milestone 1: Syntax Analysis"
tags: ["assignment"]
context: assign
subcontext: ms1
---

{% include _toc.html %}

In the first milestone, an initial Spoofax project is extended to a basic MiniJava editor, that is able

* to report syntax errors,
* to assist the creation of MiniJava programs with code templates,
* to show the abstract syntax of a MiniJava program,
* to provide an outline view of a MiniJava program,
* to support code folding, and
* to pretty-print a MiniJava program.

## Prerequisites

### Spoofax Installation

The recommended way to install Spoofax is to [download a prebuilt package from our build farm](http://buildfarm.metaborg.org/job/spoofax-in4303/lastSuccessfulBuild/artifact/dist/eclipse/).
Choose a package for your operating system, architecture, and with `-jre` in the name.
This is a full Eclipse installation with the Spoofax plugin installed, and with a built-in Java 7 environment so that you do not have to install Java.

Unpack the archive somewhere on your computer, open Eclipse, and choose a location to store your workspace.
Do not store your workspace in your Git repository!

If for some reason the prebuilt package does not work, you can also install Spoofax manually by [following the instructions here](http://metaborg.org/download/).
You need to use the `http://download.spoofax.org/update/in4303/` update site instead of the one listed in the instructions though!

## Resources

You can find the *MiniJava Language Reference Manual* in the appendix of the book
*Modern Compiler Implementation in Java* (2nd edition).
The relevant pages are available on [Google books](http://books.google.com/books?id=JNs6fWkJZbAC&pg=PA484).

The [MiniJava project](http://www.cambridge.org/us/features/052182060X/)
by <NAME>, <NAME> and <NAME> provides some example programs
and an HTML version of the reference manual.<commit_msg>Update installation instructions.<commit_after>---
layout: page
title: "Milestone 1: Syntax Analysis"
excerpt: "Milestone 1: Syntax Analysis"
tags: ["assignment"]
context: assign
subcontext: ms1
---

{% include _toc.html %}

In the first milestone, we specify the syntax of MiniJava and build a MiniJava editor that is able

* to report syntax errors,
* to assist the creation of MiniJava programs with code completion,
* to show the abstract syntax of a MiniJava program,
* to provide an outline view of a MiniJava program,
* to format a MiniJava program.

## Prerequisites

### Spoofax

We will be building the MiniJava editor with the [Spoofax language workbench](http://spoofax.org).
The Spoofax Language Workbench supports the definition of all aspects of textual languages, such as syntax, static analysis, and compilation, using high-level, declarative meta-languages.
From a language definition using these meta-languages, Spoofax generates full-featured Eclipse and IntelliJ editor plugins, as well as a command-line interface.
The generated editors include syntax highlighting, syntax checking, parse error recovery, error markers for syntactic and semantic errors, and custom operations, such as invoking an interpreter or compiler.

In this lab, we will be using the Spoofax Eclipse plugin.
You can download an Eclipse installation with the Spoofax Eclipse plugin preinstalled from our build farm:

* [Windows 32-bits](http://buildfarm.metaborg.org/job/spoofax-in4303/lastSuccessfulBuild/artifact/dist/eclipse/spoofax-win32-x86-jre.zip)
* [Windows 64-bits](http://buildfarm.metaborg.org/job/spoofax-in4303/lastSuccessfulBuild/artifact/dist/eclipse/spoofax-win32-x86_64-jre.zip)
* [Linux 32-bits](http://buildfarm.metaborg.org/job/spoofax-in4303/lastSuccessfulBuild/artifact/dist/eclipse/spoofax-linux-x86-jre.tar.gz)
* [Linux 64-bits](http://buildfarm.metaborg.org/job/spoofax-in4303/lastSuccessfulBuild/artifact/dist/eclipse/spoofax-linux-x86_64-jre.tar.gz)
* [Mac OS X (Intel only)](http://buildfarm.metaborg.org/job/spoofax-in4303/lastSuccessfulBuild/artifact/dist/eclipse/spoofax-macosx-x86_64-jre.tar.gz)

Please note that the links above point to a special version of Spoofax, specifically prepared for this lab.
Do *not* use a regular version of Spoofax.

To get started with the absolute basics of Spoofax, follow our [Getting Started guide](http://spoofax.org/en/latest/source/langdev/start.html), but skip the downloading step and use the file you downloaded from one of the above links.

## Resources

You can find the *MiniJava Language Reference Manual* in the appendix of the book *Modern Compiler Implementation in Java* (2nd edition).
The relevant pages are available on [Google books](http://books.google.com/books?id=JNs6fWkJZbAC&pg=PA484).

The [MiniJava project](http://www.cambridge.org/us/features/052182060X/) by <NAME>, <NAME> and <NAME> provides some example programs and an HTML version of the reference manual.

Documentation on Spoofax can be found on the [Spoofax website](http://spoofax.org).
{'fraction_non_alphanumeric': 0.08497388509441543, 'fraction_numerical': 0.01828043390920048, 'mean_word_length': 5.027845036319612, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6780390', 'n_tokens_mistral': 1548, 'n_tokens_neox': 1415, 'n_words': 576}