Given a simple Parsekit grammar.
@start = sentence+;
sentence = 'beer' container;
container = 'bottle' | 'cup';
If I have a partial parse beer is it possible to get Parsekit to return the possible completions to the sentence?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Developer of ParseKit here.
Unfortunately, there is no “free” mechanism in ParseKit which will return this data by itself.
However, this is exactly the kind of task ParseKit is designed/well-suited for. But you must write some code yourself. Something like this would work:
First, change the grammar slightly to include a named production for
'beer'. This will make it easier to implement a callback:Then implement an assembler callback for the
beerproduction.Your ‘client’ or ‘driver’ code should look like:
This should give you an idea of how these types of things can be implemented with ParseKit. For such a small example this solution may look like overkill (and it probably is). But for a large real-world example this would be a very powerful and elegant solution for autocompletion.