Solved

Building a Text parser using lex/yacc

Posted on 2002-05-09
2
330 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
2 Comments
 
LVL 19

Accepted Solution

by:
Jim Cakalic earned 50 total points
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now