groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ? ? <realblue...@hotmail.com>
Subject [20160619]Progress on the new parser for Groovy
Date Sun, 19 Jun 2016 08:33:33 GMT
Hi Groovy-Dev,

    The new parser for groovy has reached another milestone, it now can handle almost all
source code of Groovy in Action 2nd Edition(612 pass / 613 total), all source code of grails-core-3.1.8(1212
pass / 1212 total) and other source code(447 pass / 447 total). Here is the details of the
test cases: http://ci.groovy-lang.org/viewType.html?buildTypeId=Groovy_Antlr4grammar


     The following list shows our main work ( https://github.com/jespersm/groovy/commits/antlr4
):

1)  Fully support command expression
2)  Enhance command expression to make it act as an expression, e.g.

assert (1.plus 2 plus 3) + (2.plus 3 plus 4) == 15
assert Math.max((1.plus 2 plus 3), (2.plus 3 plus 4)) == 9

3)  Save doc comment(e.g. groovydoc) as node meta data to simplify generating groovydoc files
4)  Correct the precedence of some operators
5)  Support "break" and "continue" with label
6)  Support inner interface
7)  Support class constant of Java style, e.g. java.lang.Integer.class
8)  Support call on parenthesis expression and contants, e.g.

((int) 1 / 2)(1, 2) {} {} (2, 3, 4) {}
(((int) 1 / 2))(1, 2) {} {} (2, 3, 4) {}
(m())()
((Integer)m())()

'm'() + /aa/() + $/bb/$() + "$m"() + /a${'x'}a/() + $/b${'x'}b/$() + 1.2('b') + 1('a') + 2()
+ null() + true() + false() + a() + {a,b->}(1, 2) + [1, 2]() + [a:1, b:2]() + new int[0]()
+ new Integer(1)()

9)   Fix a lot of bugs

     Our TODO list shows as follows:

1) Add Groovy source code as test cases to build Groovy itself by the new parser
2) Support call on built-in type and class name
3) Verify operator precedence

4) Improve the performance of the new parser
5) Friendly prompt messages

6) Support lamda expression
7) Support do-while, the basic control structure like java's

8) Support java-like new array expression, e.g. new int[] {1, 2, 3}

      Finally, we want to thank Jochen, who offers us a lot of suggestions on refining the
new parser especially on the command expression support.

p.s. If you want to play with the new parser, try:

$ git clone -b antlr4 https://github.com/jespersm/groovy.git
$ cd groovy
$ ./gradlew -PuseAntlr4=true console

Cheers,
Daniel.Sun

Mime
View raw message