Skip to content

Commit c3afac5

Browse files
committed
chore: more documentation in README.md
1 parent 5952171 commit c3afac5

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

README.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,59 @@ This repository contains scripts that check the validity of instruction descript
4848

4949
This repository includes practical examples demonstrating how to use this specification:
5050

51-
- [Simple TVM Disassembler (Go)](examples/golang/tasm-go/) — Minimal implementation (200 lines of core deserialization logic) showing how to create a TVM bytecode disassembler using the specification.
51+
- [Simple TVM Disassembler (Go)](examples/golang/tasm-go/) — Minimal implementation (200 lines of core deserialization
52+
logic) showing how to create a TVM bytecode disassembler using the specification.
53+
54+
## Use cases
55+
56+
Currently, the specification is mainly used in two ways:
57+
58+
- Using human-readable instruction descriptions in interfaces (TxTracer on hover) or for
59+
autocompletion (Playground).
60+
- Using machine-readable instruction descriptions for tools such as TASM.
61+
62+
Let's briefly describe the main fields for each way of using the specification. If you want to read full documentation about
63+
each field, check out the [specification schema](src/types/specification-schema.ts).
64+
65+
### As Documentation
66+
67+
If you want to use this specification as documentation, the main source of information is the
68+
`description` field that exists for each instruction.
69+
70+
#### Required fields:
71+
72+
- `short` — brief mostly one-line description of the instruction. If non-empty, describes the short description of the
73+
instruction
74+
- `long` — detailed description of the instruction's functionality
75+
- `operands` — list of operand names for the instruction, their types and possible values are located in the root
76+
`layout` field
77+
78+
#### Optional fields:
79+
80+
- `tags` — list of tags for categorizing and searching instructions
81+
- `exit_codes` — list of possible exit codes and their trigger conditions
82+
- `other_implementations` — list of alternative implementations for this instruction using other instructions
83+
- `related_instructions` — list of instructions that are related or similar to this one
84+
- `examples` — list of examples showing how to use this instruction with stack state
85+
- `gas` — list of gas consumption entries with descriptions and formulas
86+
- `docs_links` — list of documentation links related to this instruction
87+
88+
If you also want to display the stack signature, use the root `signature` field and the `stack_string`
89+
field from it. This field contains a human-readable description of the input and output types on the stack.
90+
91+
#### Fift instructions
92+
93+
This specification also describes instructions that are only available in Fift and are aliases for existing
94+
instructions.
95+
96+
### For Tool Developers
97+
98+
When building tools that work with TVM bytecode (disassemblers, analyzers, debuggers, etc.), you need to decode
99+
complete instructions from the bytecode stream. The specification provides all the necessary information in the
100+
`layout` field of each instruction to implement this process.
101+
102+
Check out [examples/golang/tasm-go/tasm/decompile.go](examples/golang/tasm-go/tasm/decompile.go) for a minimal
103+
implementation of a TVM bytecode disassembler using the specification.
52104

53105
## Development
54106

examples/golang/tasm-go/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/xssnick/tonutils-go v1.15.5 h1:yAcHnDaY5QW0aIQE47lT0PuDhhHYE+N+NyZssdPKR0s=
2+
github.com/xssnick/tonutils-go v1.15.5/go.mod h1:3/B8mS5IWLTd1xbGbFbzRem55oz/Q86HG884bVsTqZ8=

0 commit comments

Comments
 (0)