Let's say you only want to parse the start of a large file using Perl 6 grammar. In order to avoid reading the whole file into a string, and then call subparse
on the string. Is it possible to do a subparse when reading the file?
I could not find any subparsefile()
method in the Grammar
class, so I guess this is difficult to implement. But it should be possible in theory, see for example How do I search a file for a multiline pattern without reading the whole file into memory?