Skip to content

This is a asbtract syntax tree for huff written in rust to facilitate conversion of solidity to huff

License

Notifications You must be signed in to change notification settings

malik672/huff-ast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Huff-AST

Huff-AST is basically a compiler that uses the Abstract Syntax Tree (AST) implementation for Huff, crafted in Rust to facilitate seamless conversion between Solidity and Huff. This project was born out of a compelling idea during the last Huff hackathon: a development tool capable of converting Solidity to Huff and vice versa. Faced with the challenge of choosing a feasible implementation method within a limited time frame, several approaches were considered.

Implementation Approaches

  1. Bytecode Reverse Engineering:

    • Initially contemplating bytecode extraction and reverse engineering, it was quickly dismissed due to the complexity and unreliability of converting bytecode to Solidity. The potential for inaccuracies and the considerable development time required led to the exploration of a more reliable solution.
  2. AST-Based Conversion:

    • Recognizing that both Huff and Solidity are Ethereum Virtual Machine (EVM)-compatible languages, the decision was made to generate ASTs for both and abstract away the language-specific details. The conversion process involves:
      • AST Generation: Parsing the source code of the input language (e.g., Solidity) to generate its AST.
      • IR Generation: Converting the AST into an intermediate representation that abstracts away language-specific details.
      • Language-Specific Transformation: Applying algorithms and rules to the IR to handle differences between the source and target languages.
      • Transformed IR: Producing a transformed IR that captures the essence of the program in the target language.
      • Code Generation: Finally, generating code in the target language using the transformed IR.

Rust Arc

Recently embarking on a Rust learning arc, I've come to appreciate that the best way to solidify language proficiency is through practical projects. As a developer, the desire to build unique, complex tools, and contribute to open-source projects is a driving force—an experience akin to an orgasm, but with programming. Thus, I present Huff-AST, representing the initial strides towards a tool capable of converting between Solidity and Huff. While the project's ultimate worth remains uncertain, your feedback is invaluable

thank you @filipviz for being a sponsor project still in works should be done by march

About

This is a asbtract syntax tree for huff written in rust to facilitate conversion of solidity to huff

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published