//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2010, 2026 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// This program and the accompanying materials are made available
// under the terms of the MIT License which is available at
// https://opensource.org/licenses/MIT
//
// SPDX-License-Identifier: MIT
//////////////////////////////////////////////////////////////////////////////

include::_part_attributes.asciidoc[]

:leveloffset: -2

[[dev-lang-modify]]
== CIF language modification

For each change to the CIF language, follow these steps:

* Update textual syntax:
** Update `cif.setext` syntax (`org.eclipse.escet.cif.parser/src/org/eclipse/escet/cif/parser`).
** Update `cif.bnf` syntax (`org.eclipse.escet.cif.documentation/images/language-reference/syntax`).
** Update `cif.min.js` syntax (`org.eclipse.escet.releng.configuration/highlightjs-assets/escet/languages/cif.min.js`).
* Update metamodel (`org.eclipse.escet.cif.metamodel`).
** Update Ecore diagrams (open `model/cif.aird` and unfold _Design_ and then _Entities in a Class Diagram_).
** Update diagram images.
*** Remove all `*.png` files in the `model/images` folder of the CIF metamodel project.
*** Right click the `cif.aird` file in the _Package Explorer`_ and choose menu:Export representations as images[].
*** Set _To directory_ to the `model/images` folder of the CIF metamodel project.
*** Set _Image Format_ to _PNG_.
*** Set _Image Size_ to _Nominal_.
*** Click btn:[OK].
** Update genmodel.
*** Delete `model/cif.genmodel`.
*** Right click `model/cif.ecore` and select menu:New[Other...].
*** Select _Eclipse Modeling Framework_ and _EMF Generator Model_ and click btn:[Next].
*** The parent folder and the file name should already be filled, click btn:[Next].
*** Select _Ecore model_ and click btn:[Next].
*** Click btn:[Load] and then btn:[Next].
*** For _Root packages_, select _cif_, for _Referenced generator models_, select _Position_, and click btn:[Finish].
*** Run `model/autofix.py` to update the newly created `cif.genmodel`.
** Generate metamodel code.
*** Remove the generated model code (contents of `src-gen`).
*** Open `model/cif.genmodel`.
*** Right click _Cif_ and click menu:Generate Model Code[].
* Update generated Java constructors and walker code (`org.eclipse.escet.cif.metamodel.java`).
** Remove the generated code (contents of `src-gen`).
** Right click `gen-cif-constructors.launch` and click menu:Run As[gen-cif-constructors].
** Right click `gen-cif-walker.launch` and click menu:Run As[gen-cif-walker].
* Update LaTeX documentation (`org.eclipse.escet.cif.metamodel`).
** Right click `gen-cif-docs-ecore-latex-skeleton.launch` and click menu:Run As[gen-cif-docs-ecore-latex-skeleton].
** Right click `gen-cif-docs-ecore-latex-skeleton-detail.launch` and click menu:Run As[gen-cif-docs-ecore-latex-skeleton-detail].
** Update `docs/cif_ecore_doc.tex` based on the changes in `docs/cif_ecore_doc_generated.tex`.
** Update `docs/cif_ecore_doc_details.tex` based on the changes in `docs/cif_ecore_doc_details_generated.tex`.
** Run `docs/build.bash` to generate a new PDF.
* Update parser (`org.eclipse.escet.cif.parser`).
** Right click `gen-cif-scanner-parser.launch` and click menu:Run As[gen-cif-scanner-parser].
** Implement new AST classes if needed.
** Update `CifParserHooks.java` such that it implements `CifParser.Hooks`.
** Verify the implementation by running `chk.bash`.
* Update keywords and syntax highlighting for the text editor (`org.eclipse.escet.cif.texteditor`).
* Update type checker (`org.eclipse.escet.cif.typechecker`).
** Add new constraints to the error and problem messages (`ErrMsg.java`).
** Verify the implementation by running `chk.bash`.
* Update example and benchmark models for changed syntax and constraints (`org.eclipse.escet.cif.models`).
* Update pretty printer including set of keywords (`org.eclipse.escet.cif.prettyprinter`).
* Update common methods (`org.eclipse.escet.cif.common`).
* Update CIF to CIF transformations and other tools.
* Update CIF documentation.
** Update CIF language reference manual with lexical syntax and grammar.
** Update CIF developers documentation with the <<dev-lang-extract-information>> section.
*** A `.cifx` model is shown.
*** It links to the metamodel packages and detailed PDF documentation.
*** Example XML queries are shown and explained that demonstrate getting information from the CIF model tree.
* Update CIF syntax highlighting definition for LaTeX (`org.eclipse.escet.cif.misc/latex/cif_listing.sty`).
