在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 6125|回复: 12

The Definitive ANTLR Reference

[复制链接]
发表于 2008-3-11 15:16:40 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
The Definitive ANTLR Reference

文法分析,语法分析利器
Antlr.jpg

The Definitive ANTLR Reference.pdf

2.43 MB, 下载次数: 262 , 下载积分: 资产 -2 信元, 下载支出 2 信元

发表于 2008-3-11 15:51:25 | 显示全部楼层
[size=120%]The Definitive ANTLR Reference: Building Domain-Specific Languages (Pragmatic Programmers)
By Terence Parr


Publisher:   Pragmatic Bookshelf
Number Of Pages:   376
Publication Date:   2007-05-17
ISBN-10 / ASIN:   0978739256
ISBN-13 / EAN:   9780978739256
Binding:   Paperback


Book Description:
ANTLR v3 is the most powerful, easy-to-use parser generator built to date, and represents the culmination of more than 15 years of research by Terence Parr. This book is the essential reference guide to using this completely rebuilt version of ANTLR, with its amazing new LL(*) parsing technology, tree construction facilities, StringTemplate code generation template engine, and sophisticated ANTLRWorks GUI development environment. Learn to use ANTLR directly from the author! ANTLR is a parser generator-a program that generates code to translate a specified input language into a nice, tidy data structure. You might think that parser generators are only used to build compilers. But in fact, programmers usually use parser generators to build translators and interpreters for domain-specific languages such as proprietary data formats, common network protocols, text processing languages, and domain-specific programming languages. Domain-specific languages are important to software development because they represent a more natural, high fidelity, robust, and maintainable means of encoding a problem than simply writing software in a general-purpose language. For example, NASA uses domain-specific command languages for space missions to improve reliability, reduce risk, reduce cost, and increase the speed of development. Even the first Apollo guidance control computer from the 1960s used a domain-specific language that supported vector computations. This book is the definitive guide to using the completely rebuilt ANTLR v3 and describes all features in detail, including the amazing new LL(*) parsing technology, tree construction facilities, StringTemplate code generation template engine, and sophisticated ANTLRWorks GUI development environment. You'll learn all about ANTLR grammar syntax, resolving grammar ambiguities, parser fault tolerance and error reporting, embedding actions to interpret or translate languages, building intermediate-form trees, extracting information from trees, generating source code, and how to use the ANTLR Java API.



Summary: Must read for anyone planning to do anything with parsers
Rating: 5
ANTLR is pretty much the de facto tool when it comes to writing parsers. In this book Terence Parr has given a really nice and detailed guide to ANTLR 3. Usually a reference book is pretty dry, but not this one. Terence has a nice, relaxed writing style which makes this a very easy read. Also it has lots of examples to guide you along the way.


A must read for anyone planning to work with ANTLR, write parsers or just wanting to get an insight into parsing theory.


Summary: A Perfectly Pragmatic Guide!
Rating: 5
If you have any interest in compiler design, building translators, building intelligent editors, code generation, understanding what goes into building your own computer language, or just how to use ANTLR v3 then you may want to get a copy of this book.

This book is all about ANTLR. ANTLR is a tool you can use to build compilers and interpreters for computer languages, but don't let that scare you off. With the increasing interest in domain specific languages, bulding intelligent editors, code generation, and model driven development books like this are becoming ever more important. Terence Parr has made the topic far more approachable than any other book I have read (or attempted to read) on the topic.

In the first few chapters the author walks readers through the phases of parser construction using language that is approachable and easy to understand. He explains the needed principles and demonstrates their application with well chosen examples.

This is followed by a quick tour of how one might use ANTLR. I love the approach taken in this chapter as it takes a small example and shows two different ways to approach the problem using ANTLR. This is coupled with explanations describing when you want to use one approach over another.

The middle section of the book goes into depth on the various aspects of ANTLR. This is the reference section. Don't expect to be able to read these chapters one after another in quick succession. There's just too much to take in all at once!

The text is littered with references both forward and back to other sections and topics of interest. You can tell the author has spent a lot of time working with compiler construction by the breadth and depth of information presented. I really liked the motivating examples he gives for certain ANTLR features such as the need to emit imaginary tokens when lexing python (see page 94 in chapter 4).

The first chapter of part three of the book delves into the depths of the parsing algorithm used in ANTLR since you will need to understand it when you run into parsing errors and need to make sense of them.

The remaining chapters are devoted to ways to deal with the problems you may run into when trying to parse various language constructs.

This book has left a very lasting impression on me. I can visualize what goes into an editor like eclipse more fully. I no longer feel that the topic of abstract syntax trees is above my head and I feel I am better equipped to tackle the dragon book. I also understand why lisp programmers say that lisp has no syntax (take a look at the serialized form of the AST from chapter 3 on page 62, it looks like a bunch of s-expressions!).

One more note: ANTLR itself is a domain specific language (DSL) and serves as a prime example of how a DSL can greatly increase the clarity of the solution to a problem if the solution is described in terms native to the problem domain. (I think that's what the folks in the lisp camp have been saying for a long time.) ANTLR helps show the value of having DSLs and this book shows how easy it can be to write one!


Summary: Can't do without this one
Rating: 4
You may have decided to use the Parser Generator ANTLR because it can generate code in many different languages like CSharp, Python and of course Java.
In this case you have to get this book. The current online documentation is minimal. But beware that despite the title
there are some points that the author forgets to define (such as the EOF token, which can be important). However a more important quible is that
we are far from the quality of writing of the famous "Dragon Compiler Book".
If you are looking for pithy clear definitions like me you will be disappointed. You may waste a lot of time trying to understand error messages when they arise while generating code from a grammar.
The space devoted to Antlworks is very limited .
Hopefully this will be fixed up in future printings of this book.




Summary: Another Gem From the Pragmatic Programmers
Rating: 5
The always-excellent Pragmatic Programmers have done it again. "The Definitive ANTLR Reference" is an important book, and not just for language designers/implementers, but for anyone who is serious about getting better at computer science/programming. I am a graduate student and a working programmer, and I know I will be using what I learn from this book to become better at both. Thanks to Dr. Terence Parr, not only for developing ANTLR, a world-class parser generator, but for motivating and teaching us how to use it with a relaxed, gently humorous writing style that makes you forget that there is some pretty hardcore computer science behind all this stuff. And thanks to the Prags (Dave Thomas and Andy Hunt) for giving Dr. Parr this forum.


Summary: A major comp-sci milestone
Rating: 5
The release of ANTLR version 3 represents a major milestone in compiler-compiler technology. LALR and LL(k) parsers, useful as they are, are difficult to master, and often require significant effort to overcome simple problems. Not only does ANTLR's LL(*) parser technology allows one to churn out problem-specific parsers with amazing speed, it also provides an arsenal of tools not found in other compiler-compiler tools: easy AST generation, tree parsers, rewrite rules, multiple language backends, templating. The scope and breadth of ANTLR puts it in a category all by itself.

I'm convinced that ANTLR will become an indispensible tool in any programmer's toolbox. And, by extension, the Definitive ANRL Reference will become an indispensible part of serious programmers' bookshelf.

Breathtaking.
发表于 2008-6-25 13:15:39 | 显示全部楼层
thanks
发表于 2008-8-29 10:35:00 | 显示全部楼层
thanks,正需要
发表于 2009-1-3 21:44:02 | 显示全部楼层
呵呵 也有人需要啊
发表于 2009-1-3 21:45:38 | 显示全部楼层
Verilog 2005 synthesizable subset parser built on ANTLR framework.
发表于 2009-1-3 21:47:54 | 显示全部楼层
The second most well-known compiler compiler, Terence Parr's Antlr,
发表于 2009-3-26 10:07:04 | 显示全部楼层
看看!
发表于 2009-11-11 15:23:52 | 显示全部楼层
好书,多谢!!!
发表于 2010-4-11 21:58:56 | 显示全部楼层
很强大,谢谢分享了。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

×

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-3-29 08:04 , Processed in 0.038143 second(s), 9 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表