Repository: groovy
Updated Branches:
  refs/heads/master 2bd24076b -> b68d29786

Update readme of parser-antlr4 subproject


Branch: refs/heads/master
Commit: b68d29786b060251a04ea2b394924393705a83c3
Parents: 2bd2407
Author: sunlan <>
Authored: Fri Feb 2 19:26:54 2018 +0800
Committer: sunlan <>
Committed: Fri Feb 2 19:26:54 2018 +0800

 subprojects/parser-antlr4/README.adoc | 31 ++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/subprojects/parser-antlr4/README.adoc 
index 50a3639..30adad8 100644
--- a/subprojects/parser-antlr4/README.adoc
+++ b/subprojects/parser-antlr4/README.adoc
@@ -24,12 +24,13 @@
 The new parser(Parrot) can parse Groovy source code and construct the related 
AST, which is almost identical to the one generated by the old parser(except 
the corrected node position, e.g. line, column of node). Currently all features 
of Groovy are available. In addition, **the following new features have been 
 * do-while loop, standard loop(e.g. `for(int i = 0, j = 10; i < j; i++, j--) 
-* lambda expression
+* lambda expression(e.g. ` -> e + 1)`)
 * method reference and constructor reference
 * try-with-resources(i.e. ARM)
 * code block(i.e. `{..}`)
 * array initializer of Java style(e.g. `new int[] {1, 2, 3}`)
 * default method of interface
+* type annotation
 * new operators: identity operators(`===`, `!==`), elvis assignment(`?=`), 
`!in`, `!instanceof`
 * safe index(e.g. `nullableVar?[1, 2]`)
 * runtime groovydoc(i.e. groovydoc with `@Groovydoc`), groovydoc attached to 
AST node as metadata
@@ -57,4 +58,30 @@ groovyOptions.forkOptions.jvmArgs += ["-Dgroovy.antlr4=true"]
 * `groovy.attach.runtime.groovydoc`: whether to attach `@Groovydoc` annotation 
to all members which have groovydoc(i.e. `/** ... */`).
 *P.S. Parrot is based on the highly optimized version of 
antlr4(com.tunnelvisionlabs:antlr4), which is licensed under BSD.*
\ No newline at end of file
+=== FAQ
+===== Question(from Slack):
+Can someone explain to me the importance of the Parrot compiler? Basically 
explain like I am 5?
+===== Answer(by Guillaume Laforge, Project Lead of Apache Groovy):
+the syntax of Groovy hasn’t evolved in a long time
+the current / old parser is a bit complicated to evolve
+and is using a very old version of the parsing library
+so any change we’d want to make to the language (a new operator, for 
example) becomes very complicated
+So we’ve been wanting to upgrade the underlying parser library for a while, 
but since the library evolved a lot, that also required a rewrite of the 
grammar of the language
+But there’s another thing to consider
+Groovy’s always been adopted by Java developers easily because of how close 
to the Java syntax it’s always been
+so most Java programs are also valid Groovy programs
+it’s been important to Groovy’s success to have this source compatibility
+Java 8's been out for a while already
+and we’ve been asked countless times if we’d support this or that 
particular syntax enhancement from Java 8
+for “copy’n paste compatibility”, if you will
+We decided to upgrade to a newer version of our parsing library (from v2 to v4 
of Antlr)
+to allow Groovy’s syntax to continue to evolve
+to also support new operators and things like that
+but to also support Java 8 constructs, for continued compatibility
+And that’s about it
\ No newline at end of file

Reply via email to