[antlr-interest] [C Target]: comment processing

Hong-Thai NGUYEN Hong-Thai.Nguyen at imag.fr
Thu Jan 24 02:41:23 PST 2008


Hi,
I'm using ANTLR for creating a compiler in linguistic processing  
(système-Q). The target language is ANSI C.
We'd keep all comments in code source and attach them to related  
items (like JavaDoc, i got example of sub-parser to process JavaDoc  
type comment from Ter, thanks).
But, we'd try to keep ANTLR grammar as clear as possible, we wouldn't  
pollute with "comment"  rule every where. So, we're using Channel to  
identify comment-liked Tokens, then calculate which items are related  
to which comments by line number. It's a good solution ? Even that,  
antlr3c don't give API (ex. getTokens(), ...) like in Java Target.

I've an other issue, if ANTLR support some kind of "global" rule like:
global_rule:
item comment;
where item = ALL matching rule, so that i can grant directly comment  
to every propriety items. How could we implement that in ANTLR ?

Thanks,

============================
Hong-Thai NGUYEN
PhD Student
Email: Hong-Thai.Nguyen at imag.fr
GETALP-LIG
385 rue de la Bibliothe`que
38041 Grenoble cedex
France
Tel.:   + 33 4 7651 4817
Fax.:  + 33 4 7644 6675
GSM.: + 33 6 27 04 86 22
IM (Yahoo): thaichat04, (Sky): thaichat04
Page: http://www-clips.imag.fr/geta/User/hong-thai.nguyen/Welcome.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080124/1fd9829c/attachment.html 


More information about the antlr-interest mailing list