[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Grammars for JSP, ASP, HTML...
Hello Gary,
you wrote [a long time ago ;-)]:
> I'm working on a tool for source code analysis and modification.
> I have a very beta version working for Java. For better or worse
> though much of the source I need to work with is JSP, ASP, HTML...
>
> This is source from clients so anything is possible, JSP, ASP, HTML
> combined with any combination of: Javascript, DHMTL, CSS, etc...
>
> I've heard of people having problems writing such grammars but no
> successes. Anyone out there silently successful?
>
There is a grammar for HTML 3.2 under ANTLR, but it should be not too
difficult to transform it to SableCC.
> Oppinions: one big parser vs. many smaller parsers working in tandem?
>
I have not yet used SableCC for a reasonable project [, so cannot say
anything about possible practical hurdles], but for stylistic reasons,
the flexibility you need seems to call for a collaborating parser
collection.
> Probably need to clean the code first (balance tags etc...). Maybe a
> seperate util maybe
> a preparser parser.
>
May be, ``tidy'' can do [at least a part of] the job for you. For me,
it works well as a pre-processor for the [antlr-based] html parser.
Hoping, a late answer is better than none,
Markus
--
http://www.dfki.de/~mp