Parsing with Perl 6 Regexes and Grammars: A Recursive Descent into Parsing

Moritz Lenz

  • 出版商: Apress
  • 出版日期: 2017-12-11
  • 定價: $1,330
  • 售價: 9.0$1,197
  • 語言: 英文
  • 頁數: 220
  • 裝訂: Paperback
  • ISBN: 1484232275
  • ISBN-13: 9781484232279
  • 相關分類: Perl 程式語言
  • 立即出貨 (庫存 < 4)

商品描述

Write good regexes and parsers with the Perl 6 programming language. You’ll see how regexes are used for searching, parsing, and validation: in particular the grammar extension makes them uniquely suitable for parsing, the main focus of this book.  Written by Perl 6 expert Moritz Lenz, a core contributor of Rakudo, Parsing with Perl 6 Regexes and Grammars starts from the very basics of regular expressions, and then explores how they integrate with regular Perl 6 code. Then follows a deeper exploration of how regexes work under the hood and a discussion of common techniques for constructing regexes and exploring the data under scrutiny. Later material goes beyond relatively simple formats to reusable named regexes and grammars, which permit code reuse in grammars, and shows how to write parsers for more involved data formats. Error reporting and case studies wrap up the topic.
 
While regexes allow you to search for patterns in text and validate input, Perl 6 regexes advance that concept: you’ll see how they are easier to read, yet much more powerful, than the traditional "Perl-compatible regular expression". With improved reusability and backtracking control, you will be able to write complete parsers with the help of this book.
 
What You'll Learn
  • Discover the building blocks of Perl 6 regexes 
  • Handle regex mechanics and master useful regex techniques 
  • Extract data and work with patterns among these use cases 
  • Reuse named regexes and other grammars as components or templates 
  • Write full parsers, including advanced error reporting and data extraction 
  • Learn how to parse nested scopes and indention-based formats
 
Who This Book Is For
Those with at least some prior experience with Perl programming, but who may be new to Perl 6 as well as searching and parsing.
 

商品描述(中文翻譯)

使用Perl 6程式語言撰寫良好的正則表達式和解析器。您將看到正則表達式如何用於搜索、解析和驗證:特別是語法擴展使它們在解析方面獨具特色,這本書的主要焦點。《使用Perl 6正則表達式和語法進行解析》是由Perl 6專家Moritz Lenz撰寫的,他是Rakudo的核心貢獻者,從正則表達式的基礎知識開始,然後探索它們如何與常規Perl 6代碼集成。然後深入探討正則表達式在底層的工作原理,並討論構建正則表達式和探索受審查數據的常用技術。後面的內容超出了相對簡單的格式,介紹了可重用的命名正則表達式和語法,這些語法允許在語法中重用代碼,並展示了如何為更複雜的數據格式編寫解析器。錯誤報告和案例研究總結了這個主題。

儘管正則表達式允許您在文本中搜索模式並驗證輸入,但Perl 6正則表達式推進了這個概念:您將看到它們比傳統的“Perl兼容正則表達式”更易於閱讀,但功能更強大。通過改進的可重用性和回溯控制,您將能夠在本書的幫助下撰寫完整的解析器。

您將學到什麼

- 探索Perl 6正則表達式的基本結構
- 處理正則表達式的機制並掌握有用的技巧
- 提取數據並在這些用例中使用模式
- 將命名的正則表達式和其他語法作為組件或模板進行重用
- 編寫完整的解析器,包括高級錯誤報告和數據提取
- 學習如何解析嵌套作用域和基於縮進的格式

本書適合對象

對Perl編程至少有一些經驗,但對Perl 6以及搜索和解析可能還不熟悉的人。