diff --git a/examples/if.slc b/examples/if.slc index 35ab44f..73eb679 100644 --- a/examples/if.slc +++ b/examples/if.slc @@ -60,3 +60,17 @@ gen(zero) branchcall ; + +// Alternatively I can just add a "branchskip" to the list of predefined words and way to just count words and geninline(..) +::builtin if + geninline() + genpush(_) + countwords{} + genpush(_) + countwords[] // returns 0 if there was no block (its SKIP to 'branchskip' 0) + genpush(_) + gen(branchskip) +; + +// This is not only simpler, but one can implement branchcall via a tiny bit of branchskip and a call to be honest... +// Also I feel like this results in bytecode with much better cache locality.