A big part of Retro 11 is prefixes. As with Parable, these are single character prefixes that can be tacked on to a token to tell the compiler how to deal with them. Unlike Parable, Retro has traditionally allowed the user to implement custom prefixes as desired.
This is implemented through a custom error handler. If the token is not in the dictionary and is not a number, the first character is split off, appended to a string with two underscores, and searched for in the dictionary. If it exists, we have a token handler. This will then receive the rest of the token as a string on the stack to process. If not, an error is reported.
95 , 95 , 95 , 0 ,
prefix 2 + ! ;
prefix find 0 <> [ tib 1 + swap dup d->xt @ swap d->class @ withClass ] [ drop default: notFound ] if ;
tib @ prefix:set prefix:seek ;
' <notFound> is notFound
The above is not yet complete. In Retro 11, there was a special class of prefixes which could take over the parser (these were used to build strings, do vocabulary searches, etc). For now though this will make it possible to start building prefixes into the language again, while not requiring anything other than a minimal notFound handler in the kernel.
If you want to test this, try these snippets for a couple that are used a lot in the existing Retro sources:
find 0 <> [ d->xt @ .data ` @ ] [ drop default: notFound ] if ; immediate
find 0 <> [ d->xt @ .data ` ! ] [ drop default: notFound ] if ; immediate
@ .data ; immediate