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 ;-)
|
|