Skip to content

Add CLi option for PascaLIGO to JsLIGO syntax-level transpilation

Nicolas Phan requested to merge transpile_option into dev

Motivation and Context

Transpilation from PascaLIGO to JsLIGO at the syntactic level is available using the ParserMain toplevel.

This MR makes it available through a ligo CLI command (namely ligo transpile contract source.ligo jsligo)

Note :

There is already a ligo transpile command group, doing transpilation by compiling down to the AST-core and then decompiling up to the source.

This already existing command group has been renamed transpile-with-ast, so that the new ligo transpile means syntaxtic-level transpilation (only PascaLIGO to JsLIGO is supported as of now).

Note :

The JsLIGO transpilation module was attached to the ParserMain executable in the dune file.

In order to make it available to the ligo codebase too, this module has been moved to the Parsing_pascaligo library instead.

Description

This MR renames the transpile group and its associated Transpile to transpile-with-ast (resp. Transpile_with_ast).

It introduces the new transpile group (only transpile contract is available, not transpile expression).

This new command will parse the source file into a "source cst", and transpile it to the "destination cst", then pretty-printing it. (it copies the behaviour of src/passes/02-parsing/pascaligo/ParserMain.ml)

Errors have been added for unsupported transpilation syntaxes.

Component

  • compiler
  • website
  • webide
  • vscode-plugin
  • debugger

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement (non-breaking change that improves performance)
  • None (change with no changelog)

Changelog

Checklist:

  • Changes follow the existing coding style (use dune @fmt to check).
  • Tests for the changes have been added (for bug fixes / feature).
  • Documentation has been updated.
  • Changelog description has been added (if appropriate).
  • Start titles under ## Changelog section with #### (if appropriate).
  • There is no image or uploaded file in changelog
  • Examples in changed behaviour have been added to the changelog (for breaking change / feature).
Edited by Nicolas Phan

Merge request reports