The Definitive ANTLR 4 Reference, 2/e (Paperback)

Terence Parr

買這商品的人也買了...

商品描述

Programmers run into parsing problems all the time. Whether it's a data format like JSON, a network protocol like SMTP, a server configuration file for Apache, a PostScript/PDF file, or a simple spreadsheet macro language--ANTLR v4 and this book will demystify the process. ANTLR v4 has been rewritten from scratch to make it easier than ever to build parsers and the language applications built on top. This completely rewritten new edition of the bestselling Definitive ANTLR Reference shows you how to take advantage of these new features.

Build your own languages with ANTLR v4, using ANTLR's new advanced parsing technology. In this book, you'll learn how ANTLR automatically builds a data structure representing the input (parse tree) and generates code that can walk the tree (visitor). You can use that combination to implement data readers, language interpreters, and translators.

You'll start by learning how to identify grammar patterns in language reference manuals and then slowly start building increasingly complex grammars. Next, you'll build applications based upon those grammars by walking the automatically generated parse trees. Then you'll tackle some nasty language problems by parsing files containing more than one language (such as XML, Java, and Javadoc). You'll also see how to take absolute control over parsing by embedding Java actions into the grammar.

You'll learn directly from well-known parsing expert Terence Parr, the ANTLR creator and project lead. You'll master ANTLR grammar construction and learn how to build language tools using the built-in parse tree visitor mechanism. The book teaches using real-world examples and shows you how to use ANTLR to build such things as a data file reader, a JSON to XML translator, an R parser, and a Java class->interface extractor. This book is your ticket to becoming a parsing guru!

What You Need:

ANTLR 4.0 and above. Java development tools. Ant build system optional (needed for building ANTLR from source)

商品描述(中文翻譯)

程式設計師經常遇到解析問題。無論是像 JSON 這樣的資料格式、SMTP 這樣的網路協議、Apache 的伺服器配置檔案、PostScript/PDF 檔案,還是簡單的試算表巨集語言,ANTLR v4 和這本書將揭開這個過程的神秘面紗。ANTLR v4 從頭重新撰寫,使構建解析器和基於其之上的語言應用程式變得比以往更容易。這本暢銷書的全新修訂版《ANTLR 完全參考手冊》將向您展示如何利用這些新功能。

使用 ANTLR v4,使用 ANTLR 的新進階解析技術來構建自己的語言。在本書中,您將學習 ANTLR 如何自動構建表示輸入的資料結構(解析樹)並生成可以遍歷該樹的程式碼(訪問者)。您可以使用這個組合來實現資料讀取器、語言解釋器和翻譯器。

您將首先學習如何在語言參考手冊中識別語法模式,然後逐漸構建越來越複雜的語法。接下來,您將通過遍歷自動生成的解析樹來構建基於這些語法的應用程式。然後,您將通過解析包含多種語言的檔案(如 XML、Java 和 Javadoc)來解決一些棘手的語言問題。您還將看到如何通過將 Java 動作嵌入到語法中來完全控制解析過程。

您將直接向著名的解析專家 Terence Parr 學習,他是 ANTLR 的創建者和項目負責人。您將掌握 ANTLR 語法構建的技巧,並學習如何使用內建的解析樹訪問者機制來構建語言工具。本書使用真實世界的例子教學,並向您展示如何使用 ANTLR 構建資料檔案讀取器、JSON 到 XML 轉換器、R 解析器和 Java 類別->介面提取器等工具。本書將助您成為解析大師!

所需工具:
ANTLR 4.0 及以上版本。Java 開發工具。Ant 建置系統(用於從源碼建置 ANTLR)為選用項目。