nitlang / nit

Nit language
http://nitlanguage.org
Apache License 2.0
238 stars 64 forks source link

nitcc add groups and small improvments #2839

Closed privat closed 2 months ago

privat commented 2 months ago

Add groups in the parser, that are anonymous productions enclosed by parenthesis.

foo = x (bar baz) y | z ;

is equivalent with

foo = x anon0 y | z ;
anon0 = bar baz ;

This becomes handy when combined with the modifies +, ? and *.

foo = x (bar baz)+ y | z ;

is equivalent with

foo = x anon0+ y | z ;
anon0 = bar baz ;

that is equivalent with

foo = x anon1 y | z ;
anon1 = anon1 anon0 | anon0 ;
anon0 = bar baz ;

Note: This PR is a fork of #2836

github-actions[bot] commented 2 months ago

Test Results

    67 files     314 suites   15m 59s :stopwatch: 14 174 tests 13 633 :white_check_mark: 541 :zzz: 0 :x: 14 230 runs  13 674 :white_check_mark: 556 :zzz: 0 :x:

Results for commit a82ff721.

:recycle: This comment has been updated with latest results.