Java Glossary : parser

CMP home Java glossary home Menu no menu Last updated 2004-06-28 by Roedy Green ©1996-2004 Canadian Mind Products

Java definitions: 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

You are here : home : Java Glossary : P words : parser.

parser
a program that analyses syntax. It might for example look at a piece of Java source code and find all the variable names, method names and operators in order to compile it into JVM byte code, or it might analyse HTML, or your own invented language. The original LEX/YACC/Bison generated C code. There are now variants that generate Java code. My personal favourite, based mainly on the accessible documentation is JavaCC. People who write parsers have a strange language all their own. The Parsifal glossary may help. The writers of these tools are academics, and are not interested in teaching you anything, just impressing you with how brilliant their programs are. This means the manuals are almost useless. You have to study examples, particularly the simple ones and gradually the manuals will begin to make sense. Another learning technique is to examine the Java code generated from some sample grammars. Authors took six years of university courses to get to their level of parser understanding, why should they make it any easier for you?
Roughly what happens is you describe your grammar in some Mickey Mouse syntax. Then a utility converts that into a Java program that will analyse text conforming to that grammar. I must admit I am shocked at how ugly the specification languages are. I would have thought they would be the most beautiful and regular of all languages, being composed by afficionados of language analysis.
Java has four simple built-in parsers, java.util.StringTokenizer, java.io.StreamTokenizer, java.text.BreakIterator. and java.regex.Pattern.
ANTLR (formerly PCCTS) ¤ Barat (parses Java source and byte code) ¤ BestCode Math Parser ¤ BYACC ¤ CUP ¤ grammar ¤ JavaCC (formerly Jack) ¤ JavaCUP ¤ JB (converts Bison to Java) ¤ JEP (Java Expression Parser) parses and evaluates mathematical expressions ¤ JFlex ¤ JLEX ¤ JTB ¤ Koala XSL (parses XML) ¤ lexer ¤ PCCTS ¤ Quiotix HTML parser (very easy to use. You just write a few visitor stubs) ¤ SableCC ¤ VisualParse++ ¤ XML ¤ YACC


CMP logo
CMP_home
home
Canadian Mind Products CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[24.87.56.253]
Your IP:[80.134.30.163]
You are visitor number 4563.
Please send errors, omissions and suggestions
to improve this page to Roedy Green.
You can get a fresh copy of this page from: or possibly from your local J: drive mirror:
http://mindprod.com/jgloss/parser.html J:\mindprod\jgloss\parser.html