[comp.lang.forth] Data Translation in Forth & Smalltalk-80

andrea@cs.Colorado.EDU (Boyd Hays) (06/05/91)

Hello,

The problem:
    I'm working on a CASE tool written in Smalltalk-80 that allows one
    to describe data translators. From the specification C is produced
    that when linked with a runtime library carries out the translation.
    Note that the requirements are increased by the fact that one can 
    "simulate" the specification from within the Smalltalk environment.
    The rules are translated to Smalltalk blocks and operate on representative 
    data.

    The generated translators are becoming more complex with creaping
    featurism. I'm considering simplifying the system by replacing the
    C generated code with either Smalltalk or Forth. What I'd really like
    to do is keep the OO model of Smalltalk in the runtime as this would
    simplify the way in which translation rules are generated. The current
    rule language has a functional notation. My intent is to construct 
    either a subset of smalltalk's bytecode interpreter for runtime and just 
    export the bytecode specification or emit Forth and bolt in a Forth 
    interpreter into the Smalltalk environment. 

    Another alternative would be to put the C translation runtime into the
    Smalltalk-80 as a user defined primitives. At least I would have to
    maintain only one body of code.


The questions:

    (I should point out that I have less than 4 hours experience with Forth
    and that was with NEON circa 1986 so the questions may be odd.)

    1) I tried running Yerk 3.3.2 on a Mac SE/30 with System 7 and it hangs
       my machine. I tried Mops, it seems to work but there is no menu bar
       and I don't know the word to quit.

    2) Are the Neon/Yerk/Mops OO extensions available on other implementations?
       I'm looking for something that could be used without royalties.

    3) Are there any data translation words that are in common usage? I
       would like to "table drive" the parsing of a binary input stream
       into tokens of arbitray bit-lengths e.g. I need to define what a
       float/int/records looks like or how to "suck-up" a word from a 
       byte-swaped stream.
    
    4) Are there any Forth tools that allow you to create lexers/parsers
       as in Lex/Yacc? There are times when it is necessary to specify
       the form of the input stream as a grammar. I would prefer EBNF and
       don't really care whether the generated code is LL/LR.

    5) Where does a neophyte go to learn about Forth? I'm currently reading
       the following:
	   - The Yerk Documentation
	   - Brodie's "Starting Forth"
	   - Winfield's "The Complete Forth"
	   - Pountain's "object-oriented forth"
       Are there any other references that are a "must read"?


BTW,
    The reason I'm looking at Forth is because of the Neon OO extensions
    and the fact that I suspect the generated code will have close to the
    execution sped of the currently compiled C. Some of the files that
    need translation are quite large and complex.

    The best research I've seen on this problem comes from the University
    of Michigan and the University of Pittsburgh circa 1972 .. 1976. Does
    anyone have any other pointers to relevent work (I know about Extract,
    and Nan C. Shu's work).

Thanks in advance,
Boyd Hays