tonindexer / anton

Indexing for TON blockchain
https://anton.tools
Apache License 2.0
105 stars 25 forks source link

Parse TL-B descriptors #14

Open iam047801 opened 1 year ago

iam047801 commented 1 year ago

Some contracts already have TL-B descriptions for its messages. For example, Telemint or STON.FI. Anton should be able to understand TL-B constructors to make adding new contracts as easy as Ctrl+C / Ctrl+V. Tongo library has already implemented TL-B parser and code generation of structs for messages, it can be used as a reference.

iam047801 commented 1 year ago

Some possible tools to use for schema generation from TL-B description:

  1. ANTLR (Another Tool for Language Recognition): https://www.antlr.org
  2. PEG (Parsing Expression Grammar): https://github.com/mna/pigeon
  3. Yacc (Yet Another Compiler-Compiler): https://pkg.go.dev/golang.org/x/tools/cmd/goyacc
  4. Parsec: https://github.com/prataprc/goparsec
  5. Participle: https://github.com/alecthomas/participle
iam047801 commented 1 year ago

It is possible to just use tongo.tlb.Parser.Parse function to generate abi definitions.