[antlr-interest] about antlr3 lexer output file size(C target)

miao miao_ly at hotmail.com
Wed Dec 2 20:01:40 PST 2009


hi,all
I  want to make a html parser( and lexer )with ANTLR.
My .g file size is 47k,when I use ANTLR3.1.3, the lexer(C target) size is
about 7M,but when I change to ANTLR3.2,the created lexer file become
35M.although the parser size reduce from 670k to 640k

Is it a bug of 3.2?
why?and how i can reduce the file size?
Maybe my .g file have too many tokens?
Maybe i use fragments and  predicates?

some lexer code below
===========================
//only accept "HTML" in '<' & '>' but not between '"' & '"'
HTML		:{true==ctx->m_bTagMode&&false==ctx->m_bStringMode}?=>(H T M L)
		;
//lex both ansi and unicode and utf8 input
fragment	A
			:{ctx->m_eEncodingType==ET_UNICODE_LITTLE}?=>('a'|'A')('\u0000')
			|{ctx->m_eEncodingType==ET_UNICODE_BIG}?=>('\u0000')('a'|'A')
			|('a'|'A')
			;
===========================

Regard, 
miao
-- 
View this message in context: http://n2.nabble.com/about-antlr3-lexer-output-file-size-C-target-tp4104034p4104034.html
Sent from the ANTLR mailing list archive at Nabble.com.


More information about the antlr-interest mailing list