Ljzn / mini_forth

https://mini-forth.vercel.app
BSD 2-Clause "Simplified" License
17 stars 5 forks source link

make "Record" data structure #15

Open Ljzn opened 4 years ago

Ljzn commented 4 years ago
record R a b c ;

: R1 1 2 3 R ;
\ get an encoded binary stands for R{a: 1, b: 2, c: 3}

: main R1.a ;
\ 1

It is running the encode and decode code at runtime, so we can make a record at runtime (but only define a record at compile time).