In Scala, I have a grammar implemented using the Parser Combinators library. Now, what I want to do is generate random strings given a grammar from the parser combinators library.
It seems to me, that what the ScalaCheck library does it somehow the opposite of Parser Combinators in that it combines generators instead of parsers.
Is there already a way to generate strings using the Parser Combinators or ScalaCheck, or is there a straightforward way of transforming a Parser Combinator into a generator?
There's no straightforward way to convert your grammar to generators. You have to write them manually. And it won't be that hard, because you already have a grammar. You can easily test your parser, but testing your type checker can be quite problematic (but still possible). Before you begin, make sure that your AST nodes can be compared to each other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With