Ljzn / mini_forth

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

add special tag for Core OP_CODEs #4

Closed Ljzn closed 4 years ago

Ljzn commented 4 years ago

Many bitcoin OP_CODEs are implemented in MiniForth now. To generating the bitcoin script, we should tag out the core opcodes. The current solution is to compile an alternative version that does not include the definition file (core.fth) of the core word. The problem with this solution is can't evaluate the literal correctly, because of lacking core words definition.

example:

: main PKHASH ;

\ constants

: PKHASH
    [ "fakePubkey" hash160 ] literal ;

result:

The OP_HASH160 didn't be interpreted.

[RAW SCRIPT]
"OP_HASH160"
Ljzn commented 4 years ago

Fixed by load the core.fth before evaluating the compile time code.