mirror of
https://github.com/RoBaertschi/tt.git
synced 2025-04-18 23:13:29 +00:00
34 lines
423 B
Go
34 lines
423 B
Go
package ttir
|
|
|
|
type Program struct {
|
|
Functions []Function
|
|
}
|
|
|
|
type Function struct {
|
|
Name string
|
|
Instructions []Instruction
|
|
}
|
|
|
|
type Instruction interface {
|
|
String() string
|
|
instruction()
|
|
}
|
|
|
|
type Ret struct {
|
|
op Operand
|
|
}
|
|
|
|
func (r *Ret) String() {}
|
|
func (r *Ret) instruction() {}
|
|
|
|
type Operand interface {
|
|
String() string
|
|
operand()
|
|
}
|
|
|
|
type Constant struct {
|
|
Value int64
|
|
}
|
|
|
|
func (c *Constant) operand() {}
|