For the course project and for some of the homework assignments we will use the Spoofax Language Workbench.
Follow the instructions from Lab 1(a) for using Spoofax.
Create a new language project using File ‣ New ‣ Project ‣ Spoofax Language Project
for the type checking assignment with the following parameters:
chocopy.types
chocopy.types
chocopy
0.1.0-SNAPSHOT
org.example
cpy
SDF3
Statix
This will give you three directories in your gitlab repository:
chocopy.types
chocopy.types.example
chocopy.types.test
By default, the start symbol for a project is set to Start
. We want to change that to Program
, the start symbol of the ChocoPy grammar. This requires changes in a couple of files:
language.sdf.jsglr-version: layout-sensitive
in metaborg.yaml
chocopy.types/syntax/chocopy.sdf3
: rename Start
=> Program
chocopy.types/editor/Syntax.esv
: Start => Programchocopy.types/trans/statics.stx
:
Start
=> Program
imports signatures/chocopy-sig
Start
and Empty
chocopy.types/trans/analysis.str
: rename Start
=> Program
- org.metaborg:dynsem:${metaborgVersion}
from metaborg.yaml
trans/analysis.str file
, change pre-analyze = explicate-injections-chocopy-Start
to pre-analyze = explicate-injections-chocopy-Program
and change post-analyze = implicate-injections-chocopy-Start
to post-analyze = implicate-injections-chocopy-Program
.<relativePath />
in the <parent></parent>
section of the types projects pom filesCopy the syntax definition from your chocopy.syntax
project to the syntax/
directory of the new language project.
Improve the syntax definition where necessary.
Back-port the changes to the syntax project.
We will grade your syntax again in the final milestone of the project.
In the files /trans/statics.stx
define the Statix rules that define the static semantics of ChocoPy. Statix is a modular language. It is probably a good idea to distribute your Statix definition over multiple modules.