Apache's Groovy Gets a New Parser

Apache Groovy 3.0, the latest version of the open source, general-purpose programming language for the Java platform, was released in mid-February with a number of new features and capabilities, chief among them a new parser.

The new parser was code-named "Parrot" because its creators originally intended its output to be "an exact echo of what the old parser produced," they explained in the release notes. But the final version was extended to support additional syntax options and language features. Consequently, Parrot is more flexible and maintainable than its predecessor, they said.

The new parser is enabled by default in v3.0, but it can be disabled through a system property. The old parser will be deprecated eventually, though no date has been set.

Groovy 3.0 also comes with a number of Java-like features, including the control-flow do-while loop, enhanced for loop, with support for comma-separated expressions and multi-assignment statements, array initialization using curly brackets, Lambda expressions, method references, try-with-resources statement, anonymous code blocks, non-static inner class instantiation, and default implementation for interface methods.

Groovy is a Java-syntax-compatible, object-oriented language that runs on the Java Virtual Machine (JVM). It has been around since the early 2000s, when it was submitted to the JCP as JSR 241. Version 1.0 was released in 2007, and version 2.0 wasn't released until 2012. Groovy 2.4 was released under the stewardship of Pivotal Software. In 2015, Groovy became a project at the Apache Software Foundation.

Groovy is both a static and dynamic language. It has features that are similar to Python, Ruby and Smalltalk. It can be used as both a programming language and a scripting language. Because it compiles to the JVM, it interoperates seamlessly with other Java code libraries. Unlike Java, Groovy supports domain-specific languages (DSLs) and meta-programming.

About the Author

John K. Waters is the editor in chief of a number of sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS.  He can be reached at [email protected].