[antlr-interest] Parsing Snippets of Code

Raymi raymi at gmx.ch
Thu Jul 24 07:31:16 PDT 2008


Hi,

thanks for your reply. My intention is to build a kind of versatile 
syntax highlighing. It should be able to highlight code snippets as 
well. I am not very pleased with the syntax highlighting toolboxes that 
are available, either they are too restricted to some languages or to 
the output they generate (usually HTML). Usually they are also not able 
to properly format the output (e.g. indentation). I think that ANTLR 
could help me with this task.

Since performance is not really that important in this kind of 
application, probably one could just try a brute force approach and test 
all rules until one matches?

Greets,

Raymi

Edwards, Waverly schrieb:
> Let me start by saying, I don't know but...
> 
> I would think the surrounding information is needed in order to make a parse.
> You would have to make assumptions based on context of the identifiers.  Basically, you would end
> up with a best guess but not necessarily a verifiable parse.
> 
> I've desired to write a tool to translate snippets from one language to another.  It requires an
> intimate knowledge of the source language and the tendencies of use.  If something like this does
> exist using ANTLR I'd like to study it.  I've always found this type of tool fascinating.
> 
> 
> W.
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Dominik Raymann
> Sent: Thursday, July 24, 2008 8:29 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Parsing Snippets of Code
> 
> Hi there,
> 
> it is possible to parse Snippets of Code for a known languagewith ANTLR? In the FAQ example (http://www.antlr.org/wiki/pages/viewpage.action?pageId=789) for example what would I have to do to actually parse the given input (that represents a Java method), if I don't know whether it is a method, a method body, a class, a variable declaration or what else. Is this possible with ANTLR?
> 
> Cheers,
> 
> raymi
> --
> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
> 
> 


More information about the antlr-interest mailing list