?
Solved

Building a Text parser using lex/yacc

Posted on 2002-05-09
2
Medium Priority
?
371 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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 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