Solved

Building a Text parser using lex/yacc

Posted on 2002-05-09
2
364 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

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