Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "TCS/Language Project"

< TCS
(Adding the Language Builder)
Line 33: Line 33:
 
**** ''MyLanguage''.tcs (you can copy and paste SampleLanguage.tcs and rename it)
 
**** ''MyLanguage''.tcs (you can copy and paste SampleLanguage.tcs and rename it)
 
** build.properties (you can copy and paste /SampleLanguage/build.properties and modify it)
 
** build.properties (you can copy and paste /SampleLanguage/build.properties and modify it)
 
Once you finish, your project looks like te one below (the .externalToolBuilders/ folder is created by Eclipse)
 
 
[[Image:ProjectTreeLanguageProjectConfig.PNG]]
 
  
 
===Adding the Language Builder===
 
===Adding the Language Builder===
Line 61: Line 57:
 
** In the "Classpath" tab:
 
** In the "Classpath" tab:
 
*** Add all the jars from the "/AMMAScripts/libs/" folder
 
*** Add all the jars from the "/AMMAScripts/libs/" folder
 +
[[Image:LanguageBuilderConfig.ClasspathTab.png]]
 +
 
** In the "JRE" tab:
 
** In the "JRE" tab:
 
*** Check "Run in the same JRE as the workspace"
 
*** Check "Run in the same JRE as the workspace"
 
** Click "OK"
 
** Click "OK"
 
* Set the language builder before any other builder
 
* Set the language builder before any other builder

Revision as of 09:20, 11 October 2007

A TCS Language Project is an Eclipse project (typically with the ATL nature), which contains:

  • A KM3 metamodel defining the abstract syntax of the language.
  • A TCS model defining the concrete syntax of the language.
  • Optionally, such a project may also contain:
    • Constraints (e.g., in OCL, as part of an ATL transformation).
    • A compiler (e.g., in ATL, or in ACG).

Creating a Language Project

This section details the steps required to create a language project. Whenever the name of the language appears, we use MyLanguage.

Checking out the Required Projects

The first step is to check out the AMMAScripts, and AMMACore projects in your workspace, if you do not have them already.

To do this, you can connect anonymously by CVS to repository /cvsroot/technology on server dev.eclipse.org using the pserver protocol. Then, you can checkout the two projects available in org.eclipse.gmt/org.eclipse.gmt.tcs/scripts/.

NB: Some external libraries are required, please refer to the README.txt file in the AMMAScripts project for more details.

Creating the Directory Structure

  • Create an ATL project:
    • Open: File->New->ATL Project
    • Name the project like your language (e.g., MyLanguage)
  • Create the following folders and files in your project:
    • MyLanguage/ (this is the project we just created)
      • Metamodel/
        • MyLanguage.km3 (you can copy and paste SampleLanguage.km3 and rename it)
      • Samples/
        • <sample programs written in your language, with the corresponding file extension>
      • Syntax/
        • MyLanguage.tcs (you can copy and paste SampleLanguage.tcs and rename it)
    • build.properties (you can copy and paste /SampleLanguage/build.properties and modify it)

Adding the Language Builder

Building a language involves:

  • Compiling its KM3 metamodel to Ecore.
  • Compiling its TCS model into a parser.
  • Optionally compiling its ACG compiler.

Here are the steps to follow to add the Language Builder to the project:

  • Creating the builder:
    • Right-click on your language project (e.g., MyLanguage) and select "Properties".
    • Go to the "Builders" section.
    • Click "New..."
    • Select "Ant Build"
    • Click "OK"
  • Configuring the builder:
    • Set the name of the builder to "MyLanguage Language Builder"
    • In the "Main" tab:
      • Set "Buildfile" to "${workspace_loc:/AMMAScripts/build.dsl.xml}"
      • Set "Base Directory" to "${workspace_loc:/MyLanguage}"
    • In the "Targets" tab:
      • Set "During a Clean" to target "clean"
    • In the "Classpath" tab:
      • Add all the jars from the "/AMMAScripts/libs/" folder

LanguageBuilderConfig.ClasspathTab.png

    • In the "JRE" tab:
      • Check "Run in the same JRE as the workspace"
    • Click "OK"
  • Set the language builder before any other builder

Copyright © Eclipse Foundation, Inc. All Rights Reserved.