rust-lang / wg-grammar

Where the work of WG-grammar, aiming to provide a canonical grammar for Rust, resides
Apache License 2.0
99 stars 20 forks source link

Add initial grammar using lykenware/gll, and a testing tool. #10

Closed eddyb closed 6 years ago

eddyb commented 6 years ago

I also took the liberty of adding the basic licensing boilerplate.

Example output after running cargo run dir ../rust-2/src: (that is, attempting to parse all the .rs files in the Rust project)

(click to see the compact progress "dot" display) ``` ............................................................................... .....~.......................................................................... ................................................................................ ................................................................................ ................................................................................ .............................................................................~.. .~..............~............................................................... ......................~........................~~............................... .......................~........................................................ ....................~........................................................... ...................................................................X.X.......... X.............................X............XX....X...X........X..........X...X.. .....X..X....X............X...X..................X.............................. .....................X...X........XX....X......X..........X.X..X........XX...... X....X..X.............................................~......................... ...............................................~....~........................... ...........~.................................................................... ................................................................................ ................................................................................ .................X.......X.............................X........................ ................................................................................ ................................................................................ ................................................................................ ............................~.~.~~.~............................................ ................................................................................ ..........................................~..................................... ..~.........................~................................................... ................................................................................ ................................................................................ ................................................................................ ............................~................................................... ................................................................................ ...........................~...........................................X........ ................................................................................ .................X.....~.~...................................................... ................................................................................ ................................................................................ ................................................................................ ..............X....................X...X........................................ ................................................................................ ..................................................................X............. ................................................................................ ................................................................................ ..............................................~.~.......~~...................... .............................XX................................................. ................................................................................ ................................................................................ ............................~................................................... ................................................................................ ................................................................................ ....X........................................................................... ............................................................................X... ................................................................................ ................................................................................ ................................................................................ ...............................~..................~.~............~..........X... ...X............................................X............................... ...................................................~............................ ................................................................................ ................................................................................ ................................................................................ ~............................................................................... ................................................................................ ................................................................................ ................................................................................ ................................................................................ ............................~................................................... ................................................................................ ................................................................................ ................................................................................ ................................................................................ ..............X.......~............................................~.~~~.~...... ................................~............................................... ...............~.....~......~.....~~...................~...~~.....~~~..........~ ..~....~~~~~.....~......~~~........~............................~..............~ .........~~....~......~...........~~~...~~...............~...................... .~..............~~..........................~...~~~....~..~~.................... ................~~~............................................................. ................................................................................ ................................................................................ ...........................~.................................................... .............................................................~.~...~............ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ...............................................................................~ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ .............................................................................~.. ~........................~........................~............................. ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ..............................................................X................. ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ........................................................~....X.................. ................................................................................ ............................................................~................... ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ............................~.........~...~..................................... ........................~....................................................... ................................................................................ ................................................................................ ............................................................~...~............... .....~........~..............~......................~........~.................. ...........................................~..................................~. .........................~.................................~~~~................. ........~....................................................................... .............~.......................~.........~.~~~............................ ...........................................~.................................... .~........~..............................................~.....~......~......... .....~................................~....................................~.... ................................................................................ ................................................................................ ................................................................................ ................................~............................................... ................................................................................ ................................................................................ ................................................................................ ..............................~................................................. ................................................................................ ................................................................................ ................................................................................ .........................................................................~...... ................................................................................ ................................................................................ ................................................................................ ................................................................................ ........................... ```


Out of 13066 Rust files tested:
* 140 parsed fully and unambiguously
* 0 parsed fully (but ambiguously)
* 12876 parsed partially (only a prefix)
* 50 didn't parse at all