I wrote a test.y file with more types. After certain limit, when I compiled the file with command, go tool yacc test
It panics,"Index out of range in yacc.go:891" When I looked at the file https://golang.org/src/cmd/yacc/yacc.go, I saw this comment in defining the constants "the following are adjustable according to memory size" Is there a reason why they have limited the number of type definition to 63(NTYPES = 63) in line 74(in the file mentioned in the link above)
"It panics,"Index out of range in yacc.go:891" "
I got into the same problem because I needed more types (non-term and term types) and what I did to remedy my situation was to change several values.
Please see my GitHub page documenting my change.
Or simply click on the URL below.
https://github.com/MagnusTiberius/go/commit/d4eeb860229867c76d99e67d69bdbd7cc729ce2c
Interesting - I've used go tool yacc
quite a bit and not noticed this limitation.
The reason it is like that is that yacc.go
was ported from a C program and what you see is the obvious straight forward port.
Looking at the code of yacc.go
it would be very straightforward to remove that limitation and turn the typeset
array into a slice.
What I would do is open an issue (check a that there isn't an existing one - I didn't see one but I didn't look very carefully). Next if you are feeling brave submit a patch using the go contribution guidelines. It is a good way to get into contributing to go itself.