26 lines
438 B
Nim
26 lines
438 B
Nim
|
type
|
||
|
Node = ref object of RootObj
|
||
|
value: string
|
||
|
active: bool
|
||
|
|
||
|
type
|
||
|
NumNode = ref object of Node
|
||
|
|
||
|
type
|
||
|
BinOp = ref object of Node
|
||
|
left, op, right: string
|
||
|
|
||
|
var numnum = NumNode(value: "3", active: true)
|
||
|
|
||
|
echo numnum[]
|
||
|
# > (value: "3", active: true)
|
||
|
|
||
|
var add = BinOp(
|
||
|
left: "7",
|
||
|
op: "+",
|
||
|
right: "9",
|
||
|
active: true
|
||
|
)
|
||
|
|
||
|
echo add[]
|
||
|
# > (left: "7", op: "+", right: "9", value: "", active: true))
|