catala/syntax_highlighting
Louis Gesbert 4ae392c900 AST refactoring
Many changes got bundled in here and would be too tedious to separate.

Closes #330

See changes in `shared_ast/definitions.ml` to check the main point.

- the biggest change is a modification of the struct and enum types in
  expressions: they are now stored as `Map`s throughout passes, and no longer
  converted to indexed lists after scopelang. Their accessors are also changed,
  and tuples only exist in Lcalc (they're used for closure conversion).

  This implied adding some more information in the contexts, to keep the mapping
  between struct fields and scope output variables. It should also be much more
  robust (no longer relying on assumptions upon different orderings).

- another very pervasive change is more cosmetic: the rewrite of the main AST to
  use inline records, labelling individual subfields.

- moved the checks for correct definitions and accesses of structures from
  `Scope_to_dcalc` to `Typing`

- defining some new shallow iterators in module `Shared_ast.Expr`, and
  factorising a few same-pass rewriting functions accordingly (closure
  conversion, optimisations, etc.)

- some smaller style improvements (ensuring we use the proper compare/equal
  functions instead of `=` in a few `when` closes, for example)
2022-11-17 18:16:09 +01:00
..
emacs AST refactoring 2022-11-17 18:16:09 +01:00
en Remove division durations 2022-08-19 15:21:29 +02:00
fr Remove division durations 2022-08-19 15:21:29 +02:00
gnu_gedit Remove chinese language support as it is not yet supported by the compiler 2022-09-20 10:44:46 +02:00
pl Remove division durations 2022-08-19 15:21:29 +02:00
dune Add a (very simple) syntax highlighting mode for Emacs 2022-05-13 17:42:03 +02:00
README.md Moved doc around 2022-09-20 10:50:43 +02:00

Syntax highlighting

The Catala language also comes with syntax highlighting to ease program development. The syntax highlighting is done, among other techniques, with the Iro compiler that allows writing the syntax only once, and then export it to formats understood by various IDE.

DISCLAIMER:

The maintenance of the various syntax highlighting plugins is BEST-EFFORT. Indeed many of the plugins were developed by the community and their creators did not commit to long-term maintenance.

Atom

To get Catala syntax highlighting in Atom, simply enter from the root of the repository, depending on the language you want to use :

make atom_fr

or

make atom_en

You can now reload Atom and check that you have syntax highlighting on any .catala file.

VSCode

To get Catala syntax highlighting in VSCode, simply enter from the root of the repository, depending on the language you want to use :

make vscode_fr

or

make vscode_en

You can now reload VSCode and check that you have syntax highlighting on any .catala file.

Pygments

Pygments is a Python-based versatile lexer for various programming languages. To use a version of Pygments augmented with the Catala plugin, simply enter from the root of the repository

sudo make pygments

This will execute the script syntax_highlighting/fr/pygments/set_up_pygments.sh, syntax_highlighting/pl/pygments/set_up_pygments.sh and syntax_highlighting/en/pygments/set_up_pygments.sh.

The scripts patch your pigmentize executable, used for instance by the minted LaTeX package. It will now point to the Catala-enabled version with the appropriate catala_* lexer.

GNU gedit

Copy the file catala.lang to the directory below (create if it does not exist) and then restart GEdit.

~/.local/share/gtksourceview-4/language-specs