由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Do you guys use lex to parsing input?
相关主题
JavaCC/SableCC/otherCC ?can someone recommend an html parser lib?
Design thought.. Sugguestions?关于Runtime.getRuntime().exec的问题
简单算法问题xml to PDF的package
Java XML parser的问题java & XML 2 example problem
Java HTMLEditorKit 中取得html的text?A regular expression question
Question about tab这个是JSP的什么技术
[转载] a question on XML parser[ZT] choose your java xml parser
Java.Net初学: 我的简单问题, 寻求简单方案math expression
相关话题的讨论汇总
话题: java话题: do话题: use话题: ll话题: regex
进入Java版参与讨论
1 (共1页)
c*****t
发帖数: 1879
1
Just curious. Assume that there is a very simple Lexical / Parser
generator for Java, will you use it over Pattern/Regex lib provided
by Sun?
b******y
发帖数: 9224
2
I've used javacc before, but a bit complicated. You need to come up with the
grammar, left recursion only, I think.
So, normally I would just use Pattern/Regex, since it is standard and easy
to use.
h**j
发帖数: 2033
3
used antlr before, not bad...
or you can check javacc out

【在 c*****t 的大作中提到】
: Just curious. Assume that there is a very simple Lexical / Parser
: generator for Java, will you use it over Pattern/Regex lib provided
: by Sun?

k***r
发帖数: 4260
4
regex只能做很简单的。有时候不得不用lex之类。或者javacc/antlr

【在 c*****t 的大作中提到】
: Just curious. Assume that there is a very simple Lexical / Parser
: generator for Java, will you use it over Pattern/Regex lib provided
: by Sun?

b******y
发帖数: 9224
5
or, you can write your own java based parser/compiler, LL based.
I've read a book called "let's write a compiler" before, it is good and
tells you how to roll your own.
In fact, java compiler is LL (recursive decent), so you can hand-code a java
compiler yourself ;-)
c*****t
发帖数: 1879
6
The problem with LL is well known though, although there are work
arounds. For example:
expr + expr
expr * expr
type, in LALR with precedence is really easy to do, about 20x more
work for LL.
Sun's Java compiler is slow. It also has quite a bit limitations
and some artifacts.
Try this in your code:
String str = "\u000a";
It also fails on several other codes.
Antlr has some problems too. It directly generates Java code.
IMO, this is actually bad due to several reasons: lots of
function calls,

【在 b******y 的大作中提到】
: or, you can write your own java based parser/compiler, LL based.
: I've read a book called "let's write a compiler" before, it is good and
: tells you how to roll your own.
: In fact, java compiler is LL (recursive decent), so you can hand-code a java
: compiler yourself ;-)

1 (共1页)
进入Java版参与讨论
相关主题
math expressionJava HTMLEditorKit 中取得html的text?
java and javascript 问题请教,有包子Question about tab
java compilation question[转载] a question on XML parser
help on this scope questionJava.Net初学: 我的简单问题, 寻求简单方案
JavaCC/SableCC/otherCC ?can someone recommend an html parser lib?
Design thought.. Sugguestions?关于Runtime.getRuntime().exec的问题
简单算法问题xml to PDF的package
Java XML parser的问题java & XML 2 example problem
相关话题的讨论汇总
话题: java话题: do话题: use话题: ll话题: regex