Skip to content

[#1762] Implement dumping CST in the compiler

Motivation and Context

Adds a ligo info dump-cst command which is useful for the debugger.



In the debugger we still use tree-sitter parsers for LIGO contracts. It's not good because we need to update them when LIGO adds/changes something in its syntax. It would be better to get CST directly from the compiler.


Derive yojson_of functions, convert Yojson.Safe.t into Msgpck.t, and parse it on the adapter's side. Also, strip redundant things like Product and tree-sitter related.

Resolved: #1762 (closed)


  • 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)


Adds a ligo info dump-cst command which is useful for the debugger. It prints contracts CST in JSON format (supported only for CameLIGO and JsLIGO).


  • 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 Leonid Vasilev

Merge request reports