Skip to content

Code documentation

Julian Konchunas edited this page Aug 18, 2020 · 2 revisions

Translation flow

Translation is split into a few phases usually separated by files. They go in the following order.

  • import_resolver - download files by urls in import statements and embeds them into one big file
  • ast_gen - figures best Solidity compiler version and downloads its executable
  • solidity_to_ast4gen - converts Solidity AST format into our internal AST format
  • ast_transform.pre_ti - applies transforms which are not relying on type information
  • type_inference.stage1 - infers types based on direct contextual information
  • type_inference.stage2 - infers types using bruteforcing by repetition
  • ast_transform.post_ti - applies transforms reliant on type information
  • translate_ligo - makes translation of AST nodes to textual code representation

Common abbreviations

jl - join list. A list of something to be joined later

ds - default state. Translation stage which generates default contract state needed for its origination

ti - type inference

sink_list - an array holding data to be prepended or, sometimes, to be placed at the top

Clone this wiki locally