Dylan program structure and macro parsing 
Author Message
 Dylan program structure and macro parsing

On closer examination of the DRM, I am now convinced that it is not
possible to scan arbitrary Dylan code that calls macros whose definitions
are not previously known, because it isn't possible to find the end of some
macro calls without knowing their definitions. For example:

  define definer-macro-name foo;

and

  define definer-macro-name
    foo;
    bar;
  end;

are both possible macro calls, but the parser can't tell whether "foo;" is
the end of the macro without the definition.

On the other hand, "define" and "macro" are reserved words. Therefore, an
implementation could assume all definitions begin with "define", and
attempt to find all macro definitions before compiling the rest of the
code.

In any case, it seems clear to me that Apple Dylan TR doesn't have this
problem as long as source records contain only one definition, and I would
recommend that implementations follow this example and provide a means for
users to structure their code this way (if not enforce it).

As a final note, Apple Dylan TR can import interchange files and place
definitions into separate source records, although it can't compile a
definition that calls a macro it hasn't compiled yet.

...........................................................................
Chris Page                                       define module mail-message
Dylan Hacker                                       use dylan;
Harlequin, Inc.                                    use standard-disclaimer;
< http://www.*-*-*.com/ ~page/>                     end module mail-message;



Fri, 11 Jun 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Dylan program structure and macro parsing

2. MVS Assmbler Structured Programming Macros

3. Dylan Programming Book and Apple Dylan

4. are dylan macros Turing-complete?

5. C++ Templates used like Dylan Macros

6. C++ Templates used like Dylan Macros

7. Simple Reader Macros for Dylan

8. Simple Reader Macros for Dylan

9. dylan parser: Macros

10. Simulating call-by-reference with Dylan macros

11. Simulating call-by-reference with Dylan macros

12. The power of Dylan macro's

 

 
Powered by phpBB® Forum Software