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)
Cited By
- Saha S, Sandha S, Aggarwal M, Wang B, Han L, Briseno J and Srivastava M (2024). TinyNS: Platform-aware Neurosymbolic Auto Tiny Machine Learning, ACM Transactions on Embedded Computing Systems, 23:3, (1-48), Online publication date: 31-May-2024.
- Sargsyan S (2023). Improving Fuzzing Using Input Data Offsets Comparison Information, Programming and Computing Software, 49:Suppl 2, (S122-S127), Online publication date: 1-Dec-2023.
- Ríos-Vila A, Rizo D, Iñesta J and Calvo-Zaragoza J (2023). End-to-end optical music recognition for pianoform sheet music, International Journal on Document Analysis and Recognition, 26:3, (347-362), Online publication date: 1-Sep-2023.
- Christakis M, Eniser H, Hoffmann J, Singla A and Wüstholz V Specifying and testing k-safety properties for machine-learning models Proceedings of the Thirty-Second International Joint Conference on Artificial Intelligence, (4748-4757)
- Nenzi L, Bartocci E, Bortolussi L, Silvetti S and Loreti M (2023). MoonLight: a lightweight tool for monitoring spatio-temporal properties, International Journal on Software Tools for Technology Transfer (STTT), 25:4, (503-517), Online publication date: 1-Aug-2023.
- Kurian E, Braione P, Briola D, D'Avino D, Modonato M and Denaro G Automated Test Case Generation for Safety-Critical Software in Scade Proceedings of the 45th International Conference on Software Engineering: Software Engineering in Practice, (483-494)
- Lanotte R, Merro M and Munteanu A (2022). Industrial Control Systems Security via Runtime Enforcement, ACM Transactions on Privacy and Security, 26:1, (1-41), Online publication date: 28-Feb-2023.
- Walker M, Khazra P, Nanah Ji A, Wang H and van Breugel F (2023). jpf-logic, ACM SIGSOFT Software Engineering Notes, 48:1, (32-36), Online publication date: 10-Jan-2023.
- Nguyen T and McCaskey A (2022). Extending Python for Quantum-classical Computing via Quantum Just-in-time Compilation, ACM Transactions on Quantum Computing, 3:4, (1-25), Online publication date: 31-Dec-2022.
- Karnalim O, Simon , Chivers W and Panca B (2022). Educating Students about Programming Plagiarism and Collusion via Formative Feedback, ACM Transactions on Computing Education, 22:3, (1-31), Online publication date: 30-Sep-2022.
- Willis J and Wu N Design patterns for parser combinators in scala Proceedings of the Scala Symposium, (9-21)
- Gu Q and Ke W A Neural Architecture for Detecting Identifier Renaming from Diff Intelligent Data Engineering and Automated Learning – IDEAL 2021, (33-44)
- Ding J, Reniers M, Lu J, Wang G, Feng L and Kiritsis D Integration of modeling and verification for system model based on KARMA language Proceedings of the 18th ACM SIGPLAN International Workshop on Domain-Specific Modeling, (41-50)
- Monroe Z and Bansal A Kitsune: Structurally Aware and Adaptable Plagiarism Detection 2021 IEEE Frontiers in Education Conference (FIE), (1-9)
- Karnalim O and Simon Promoting Code Quality via Automated Feedback on Student Submissions 2021 IEEE Frontiers in Education Conference (FIE), (1-5)
- Balliu M, Merro M, Pasqua M and Shcherbakov M (2021). Friendly Fire, ACM Transactions on Privacy and Security, 24:3, (1-40), Online publication date: 31-Aug-2021.
- Favre L (2021). Formal Metamodeling for Secure Model-Driven Engineering, International Journal of Systems and Software Security and Protection, 12:2, (46-67), Online publication date: 1-Jul-2021.
- Bagherzadeh M, Jahed K, Combemale B and Dingel J (2021). Live modeling in the context of state machine models and code generation, Software and Systems Modeling (SoSyM), 20:3, (795-819), Online publication date: 1-Jun-2021.
- Lee H, Kim H, Kim C, Han H and Seo E (2021). Idempotence-Based Preemptive GPU Kernel Scheduling for Embedded Systems, IEEE Transactions on Computers, 70:3, (332-346), Online publication date: 1-Mar-2021.
- Tufano M, Kimko J, Wang S, Watson C, Bavota G, Di Penta M and Poshyvanyk D DeepMutation Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering: Companion Proceedings, (29-32)
- Le X, Pasareanu C, Padhye R, Lo D, Visser W and Sen K (2019). Saffron, ACM SIGSOFT Software Engineering Notes, 44:4, (14-14), Online publication date: 2-Dec-2019.
- Michael L, Donohue J, Davis J, Lee D and Servant F Regexes are hard Proceedings of the 34th IEEE/ACM International Conference on Automated Software Engineering, (415-426)
- Tufano M, Watson C, Bavota G, Penta M, White M and Poshyvanyk D (2019). An Empirical Study on Learning Bug-Fixing Patches in the Wild via Neural Machine Translation, ACM Transactions on Software Engineering and Methodology, 28:4, (1-29), Online publication date: 31-Oct-2019.
- Berger T and Collet P Usage Scenarios for a Common Feature Modeling Language Proceedings of the 23rd International Systems and Software Product Line Conference - Volume B, (174-181)
- Dutta S, Zhang W, Huang Z and Misailovic S Storm: program reduction for testing and debugging probabilistic programming systems Proceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, (729-739)
- Kövesdán G and Lengyel L (2019). Meta3, Software and Systems Modeling (SoSyM), 18:4, (2421-2439), Online publication date: 1-Aug-2019.
- Ahmed S, Bhatti N, Alizai M, Siddiqui J and Mottola L Efficient intermittent computing with differential checkpointing Proceedings of the 20th ACM SIGPLAN/SIGBED International Conference on Languages, Compilers, and Tools for Embedded Systems, (70-81)
- Timo O, Petrenko A and Ramesh S (2019). Fault model-driven testing from FSM with symbolic inputs, Software Quality Journal, 27:2, (501-527), Online publication date: 1-Jun-2019.
- Wang J, Chen B, Wei L and Liu Y Superion Proceedings of the 41st International Conference on Software Engineering, (724-735)
- Tufano M, Pantiuchina J, Watson C, Bavota G and Poshyvanyk D On learning meaningful code changes via neural machine translation Proceedings of the 41st International Conference on Software Engineering, (25-36)
- Jin W, Cai Y, Kazman R, Zheng Q, Cui D and Liu T ENRE Proceedings of the 41st International Conference on Software Engineering: Companion Proceedings, (67-70)
- Tianyi S, Yulin K, Yihong H and Yujuan Q PAAA Proceedings of the 2019 4th International Conference on Distance Education and Learning, (68-72)
- Nielebock S, Heumüller R and Ortmeier F (2019). Programmers do not favor lambda expressions for concurrent object-oriented code, Empirical Software Engineering, 24:1, (103-138), Online publication date: 1-Feb-2019.
- (2019). COBRA-HPA, International Journal of Grid and Utility Computing, 10:2, (105-118), Online publication date: 1-Jan-2019.
- Nasrawt Z and Lam M (2019). Less-Java, more learning, Journal of Computing Sciences in Colleges, 34:3, (64-72), Online publication date: 1-Jan-2019.
- Cristiá M, Hollmann D and Frydman C (2019). A multi-target compiler for CML-DEVS, Simulation, 95:1, (11-29), Online publication date: 1-Jan-2019.
- Meyer T, Helms T, Warnke T and Uhrmacher A Runtime code generation for interpreted domain-specific modeling languages Proceedings of the 2018 Winter Simulation Conference, (605-615)
- Marin V and Rivero C Towards a framework for generating program dependence graphs from source code Proceedings of the 4th ACM SIGSOFT International Workshop on Software Analytics, (30-36)
- Abba A and Hassan M Design and Implementation of a CSV Validation System Proceedings of the 3rd International Conference on Applications in Information Technology, (111-116)
- Wang K, Sullivan A, Marinov D and Khurshid S ASketch: a sketching framework for Alloy Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, (916-919)
- de Medeiros S and Mascarenhas F Towards automatic error recovery in parsing expression grammars Proceedings of the XXII Brazilian Symposium on Programming Languages, (3-10)
- Costa P, Canedo E and Bonifácio R On the Use of Metaprogramming and Domain Specific Languages Proceedings of the VII Brazilian Symposium on Software Components, Architectures, and Reuse, (102-111)
- Tufano M, Watson C, Bavota G, Di Penta M, White M and Poshyvanyk D An empirical investigation into learning bug-fixing patches in the wild via neural machine translation Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering, (832-837)
- Jakšić S, Bartocci E, Grosu R, Nguyen T and Niă?Ković D (2018). Quantitative monitoring of STL with edit distance, Formal Methods in System Design, 53:1, (83-112), Online publication date: 1-Aug-2018.
- Medeiros S and Mascarenhas F Syntax error recovery in parsing expression grammars Proceedings of the 33rd Annual ACM Symposium on Applied Computing, (1195-1202)
- Martini R and Henriques P (2017). Automatic generation of virtual learning spaces driven by CaVaDSL: an experience report, ACM SIGPLAN Notices, 52:12, (233-245), Online publication date: 1-Dec-2017.
- Motta P Declaring Lua data types for GPU code generation Proceedings of the 4th ACM SIGPLAN International Workshop on Software Engineering for Parallel Systems, (44-45)
- Martini R and Henriques P Automatic generation of virtual learning spaces driven by CaVaDSL: an experience report Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences, (233-245)
- Schauss S, Lämmel R, Härtel J, Heinz M, Klein K, Härtel L and Berger T A chrestomathy of DSL implementations Proceedings of the 10th ACM SIGPLAN International Conference on Software Language Engineering, (103-114)
- Botelho J, Durelli V, Borges S, Endo A, Eler M, Delamaro M and Durelli R On the costs of applying logic-based criteria to mobile applications Proceedings of the 2nd Brazilian Symposium on Systematic and Automated Software Testing, (1-9)
- Busari S and Letier E RADAR Proceedings of the 39th International Conference on Software Engineering, (552-562)
- Cito J, Oliveira F, Leitner P, Nagpurkar P and Gall H Context-based analytics Proceedings of the 39th International Conference on Software Engineering: Software Engineering in Practice Track, (193-202)
- Lin B, Ponzanelli L, Mocci A, Bavota G and Lanza M On the uniqueness of code redundancies Proceedings of the 25th International Conference on Program Comprehension, (121-131)
- Hodován R, Kiss Á and Gyimóthy T Tree preprocessing and test outcome caching for efficient hierarchical Delta debugging Proceedings of the 12th International Workshop on Automation of Software Testing, (23-29)
- Karanikolas C, Dimitroulakos G and Masselos K (2017). Early Evaluation of Implementation Alternatives of Composite Data Structures Toward Maintainability, ACM Transactions on Software Engineering and Methodology, 26:2, (1-44), Online publication date: 30-Apr-2017.
- Castro-Schez J, Gallardo J, Miguel R and Vallejo D (2017). Knowledge-based systems to enhance learning, Knowledge-Based Systems, 122:C, (180-198), Online publication date: 15-Apr-2017.
- Maidl A, Mascarenhas F, Medeiros S and Ierusalimschy R (2016). Error reporting in Parsing Expression Grammars, Science of Computer Programming, 132:P1, (129-140), Online publication date: 15-Dec-2016.
- Hodován R and Kiss Á Modernizing hierarchical delta debugging Proceedings of the 7th International Workshop on Automating Test Case Design, Selection, and Evaluation, (31-37)
- Petrenko A, Timo O and Ramesh S Test Generation by Constraint Solving and FSM Mutant Killing Testing Software and Systems, (36-51)
- Setlur V, Battersby S, Tory M, Gossweiler R and Chang A Eviza Proceedings of the 29th Annual Symposium on User Interface Software and Technology, (365-377)
- Andrade G, Carvalho W, Utsch R, Caldeira P, Alburquerque A, Ferracioli F, Rocha L, Frank M, Guedes D and Ferreira R ParallelME Proceedings of the 22nd International Conference on Euro-Par 2016: Parallel Processing - Volume 9833, (447-459)
- Petrenko A, Nguena Timo O and Ramesh S Multiple Mutation Testing from FSM 36th IFIP WG 6.1 International Conference on Formal Techniques for Distributed Objects, Components, and Systems - Volume 9688, (222-238)
- Haberland R, Krinkin K and Ivanovskiy S Abstract predicate entailment over points-to heaplets is syntax recognition Proceedings of the 18th Conference of Open Innovations Association FRUCT, (66-74)
- Couto L, Tran-Jørgensen P and Lausdahl K Principles for reuse in formal language tools Proceedings of the 31st Annual ACM Symposium on Applied Computing, (1997-2000)
- Schielke P (2016). Ruse, Journal of Computing Sciences in Colleges, 31:4, (42-48), Online publication date: 1-Apr-2016.
- Hickinbotham S and Stepney S Augmenting Live Coding with Evolved Patterns Proceedings of the 5th International Conference on Evolutionary and Biologically Inspired Music, Sound, Art and Design - Volume 9596, (31-46)
- Pottier F Reachability and error diagnosis in LR(1) parsers Proceedings of the 25th International Conference on Compiler Construction, (88-98)
- Lezos C, Dimitroulakos G, Latifis I and Masselos K Automatic Generation of Code Analysis Tools Proceedings of the 1st International Workshop on Real World Domain Specific Languages, (1-10)
- Borenstein D Nanoverse Proceedings of the 2015 Winter Simulation Conference, (206-217)
- Parr T, Harwell S and Fisher K (2014). Adaptive LL(*) parsing, ACM SIGPLAN Notices, 49:10, (579-598), Online publication date: 31-Dec-2015.
- Maeda K Parser development with an internal domain-specific language and an aspect weaver Proceedings of the 8th International Conference on Bioinspired Information and Communications Technologies, (235-238)
- Krall P Generating Code Using Reflection in the Context of Computer-Assisted Legacy System Analyses and Reengineering Proceedings of the 14th Workshop on Domain-Specific Modeling, (7-12)
- Karaivanov S, Raychev V and Vechev M Phrase-Based Statistical Translation of Programming Languages Proceedings of the 2014 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software, (173-184)
- Parr T, Harwell S and Fisher K Adaptive LL(*) parsing Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications, (579-598)
- Carr S (2014). A programming languages course emphasizing interpreters and object-oriented design, Journal of Computing Sciences in Colleges, 30:1, (52-60), Online publication date: 1-Oct-2014.
- Carvalho N, Almeida J, Henriques P and Pereira M Conclave Proceedings of the 14th International Conference on Computational Science and Its Applications — ICCSA 2014 - Volume 8584, (116-131)
- Amighi A, Blom S, Darabi S, Huisman M, Mostowski W and Zaharieva-Stojanovski M Verification of Concurrent Systems with VerCors Advanced Lectures of the 14th International School on Formal Methods for Executable Software Models - Volume 8483, (172-216)
- Margara A and Salvaneschi G We have a DREAM Proceedings of the 8th ACM International Conference on Distributed Event-Based Systems, (142-153)
- Blom S and Huisman M The VerCors Tool for Verification of Concurrent Programs Proceedings of the 19th International Symposium on FM 2014: Formal Methods - Volume 8442, (127-131)
- McArdle E, Holdsworth J and Lee I Assessing the usability of students object-oriented language with first-year IT students Proceedings of the 25th Australian Computer-Human Interaction Conference: Augmentation, Application, Innovation, Collaboration, (181-188)