Re: [retro-language] Factor

116 views
Skip to first unread message

Michal Wallace

unread,
Jan 20, 2013, 5:29:12 PM1/20/13
to retr...@googlegroups.com

On Sat, Jan 12, 2013 at 11:35 PM, Leonard P <leonar...@gmail.com> wrote:
Is it possible to add some of the high-level features of Factor, to RetroForth?


Sure. The nice thing about concatenative languages is that you just have to port one word at a time.

Ideally, there would be a tool that would scan all the definitions, figure out the dependencies between words, and then use a topsort to figure out which ones need to be ported first.

The topsort is readily available via the tsort command in posix environments. So in factor, you'd want to take the word you're interested in, and recursively dump all the words in the definition, without comments. Then pipe the output through tsort, and it'll give you the order to tackle the words in.

FOR word IN dependencies DO
  IF there's already a translation THEN
     EITHER wrap the translation to look like factor,
     OR replace the factor word with the corresponding retro word.
ELSE implement word in retro.

If you apply this recursively, you should get to a set of primitive words in factor every time, and after porting a few words, you will probably have ported all the primitives, at which point you can just automate the translation of the other words.

Reply all
Reply to author
Forward
0 new messages