-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pio: phrase_to_file/2 #691
Comments
What is the blocker for this issue? |
See mthom#691 for more information.
I have filed #1045 with a rudimentary version that works for the most important case of a deterministic grammar rule body that describes a list of characters, as long as the list fits entirely into memory. The intention of this pull request is to make a basic version of this feature available so that it can be tried out and used in cases where it already works. This is analogous to Are there any opinions about merging this for a start? If so, please comment. Thank you a lot! |
Revisiting this: The current implementation works well if the whole string fits into memory at once (which fits many use-cases). My logic is probably incomplete because otherwise it might have been added already. Is there a problem with this approach? |
Essentially this is the opposite of
phrase_from_file/2
, except that its complete meaning is not that evident.phrase_to_file(Phrase__0, File)
is well defined in the case where there is a single answer string forphrase(Phrase__0, Cs)
. In this case the characters ofCs
are written ontoFile
. TheFile
with those characters appears upon success. The idea is now to write out thoseCs
as they are generated. So much for the most important intended use case.But there are many more cases to consider:
In case the generation of
Cs
becomes non-determinate it seems best to wait.As long as there are some variables in
Cs
, waiting is needed as well.For a finally non-ground
Cs
, an instantiation error is needed.While
phrase_to_file( [non_character], File)
should produce atype_error(character, non_character)
, the goalphrase_to_file( ( cs1, ( cs2, [non_character], cs3, { false } | cs4 ) ), File)
, withcsi
being well formed character sequences, must not produce a type error. No matter how long these sequences might be.The text was updated successfully, but these errors were encountered: