Solved

Building a Text parser using lex/yacc

Posted on 2002-05-09
2
360 Views
Last Modified: 2012-08-13
I am trying to build a text parser in Java and hope to find a lex/yacc combo.  I have found JLex that looks like a good lexer but I am having trouble finding yacc.

Any suggestions?  Examples would be good to.

Thanks
0
Comment
Question by:whitej8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
Jim Cakalic earned 50 total points
ID: 6999185
Having experience myself with lex/yacc, I found JavaCC to be reasonably intuitive. The original implementation was by Sun, subsequently moved to Metameta which is now a wholly owned subsidiary of WebGain. However JavaCC is still legally owned by Sun -- WebGain is referred to as the "caretaker".
    http://www.webgain.com/products/java_cc/

One great thing about it (perhaps about JLex too?) is that the generated code does not rely on any external runtime libraries or jars that would have to be deployed with your code. Just the code and nothing but the code.

Here are links to a few JavaCC articles:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-cooltools.html
    http://www.javaworld.com/javaworld/jw-12-1996/jw-12-jack.html

And here is a "big" list of java compiler construction tools (but I have only used JavaCC):
    http://catalog.compilertools.net/java.html

Best regards,
Jim Cakalic
0
 
LVL 6

Expert Comment

by:gadio
ID: 6999980
I can also recommend using javaCC. Its simple and I like the fact that its input is a superset of java (all of the definitions are in the same file). It can also generate the jjtree - a code that deals directly with the tree structure of the parsed expression.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question