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.typeschocopy.typeschocopy0.1.0-SNAPSHOTorg.examplecpySDF3StatixThis will give you three directories in your gitlab repository:
chocopy.typeschocopy.types.examplechocopy.types.testBy 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.yamlchocopy.types/syntax/chocopy.sdf3: rename Start => Programchocopy.types/editor/Syntax.esv: Start => Programchocopy.types/trans/statics.stx:
Start => Program
imports signatures/chocopy-sigStart and Emptychocopy.types/trans/analysis.str: rename Start => Program- org.metaborg:dynsem:${metaborgVersion} from metaborg.yamltrans/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.