You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes! Great to have this for teaching how to think about architecture too. What if we added an instruction that did X? Well, now you can just add it and teach the compiler to emit it and find out!
Which got me thinking about implementing the interpreter's core functionality in such a way that additional instructions can be implemented later on. I think this would also involve providing the Instruction supertype from ast.rkt.
I'm not totally sure how best to go about this. Xsmith had extensible grammars and such implemented through a (highly complicated) macro system (that I did not fully understand)... perhaps something like that would work? Or else the step function could be made such that its wildcard case calls a function stored in a parameter (from make-parameter) which can be overridden or something.
Or maybe... there could be a macro provided to define-new-instruction that requires a clause to be defined, which can be inserted into the match? Perhaps this is just a wrapper around the parameter idea? Unsure. Need to think on it more.
The text was updated successfully, but these errors were encountered:
Via
@stephentyrone
on Twitter:Which got me thinking about implementing the interpreter's core functionality in such a way that additional instructions can be implemented later on. I think this would also involve providing the
Instruction
supertype fromast.rkt
.I'm not totally sure how best to go about this. Xsmith had extensible grammars and such implemented through a (highly complicated) macro system (that I did not fully understand)... perhaps something like that would work? Or else the
step
function could be made such that its wildcard case calls a function stored in a parameter (frommake-parameter
) which can be overridden or something.Or maybe... there could be a macro provided to
define-new-instruction
that requires a clause to be defined, which can be inserted into thematch
? Perhaps this is just a wrapper around the parameter idea? Unsure. Need to think on it more.The text was updated successfully, but these errors were encountered: