Ok, I see! But it would still be nice to have GLR in goyacc, for instance in order to write an ASN.1 parser.
Den torsdag 8 mars 2018 kl. 20:06:44 UTC+1 skrev Jan Mercl: > > On Thu, Mar 8, 2018 at 7:44 PM David Wahlstedt <david.wah...@gmail.com > <javascript:>> wrote: > > > So, if golang has been bootstrapped, compiled with itself, how did they > write the parser? > > By hand, or by using an LR parser and tweaking the grammar? > > Go authors initially used a modified grammar (distilled version at > https://github.com/cznic/gc/blob/b007e32c610fc39d850653c9b09d7515507f2b6e/testdata/parser/parser.y) > > in combination with a simple transformation of the input token stream in > the lexer (functionally equivalent Go implementation can be seen also at > https://github.com/cznic/gc/blob/b007e32c610fc39d850653c9b09d7515507f2b6e/all_test.go#L976 > ). > > Nowadays the gc uses a handwritten parser, so the class of the language no > more matters [that much]. (Alternative experimental implementation also at > https://github.com/cznic/gc/blob/b007e32c610fc39d850653c9b09d7515507f2b6e/parser.go > ) > > IMHO, GLR would be an overkill for a Go parser. > > > > -- > > -j > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.