It depends on the language.

In my case, the dependencies would be circular and it was possible that 
the two modules referenced each other. What I did was, I parsed each 
module separately, made a hash table of modules and their identifier. In 
the second pass, I imported the symbols from modules that was imported 
into the hash table of the importing module and then issued errors if 
the references could not been resolved.

This does not work, if you want to do type checking on the fly, or in 
case of C imports that you need to know the type identifiers before hand.


---
Hello,

Currently I'm working on the implementation of a mark-up DSL using ANTLR.
This language makes use of module definitions and import constructs. What
would be the optimal approach to loading contents of dependent modules in my
AST?

The parser grammar is as follows:
module:         'module' moduleId ( imprt | site | function )* 'end' EOF ;
moduleId:      IDENTIFIER ( '.' IDENTIFIER )* ;
imprt:             'import' moduleId ';' ;

Thanks in advance!
Jeroen

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to