-
Notifications
You must be signed in to change notification settings - Fork 99
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
Parse humanReadable program string #50
Comments
Sorry, we have not updated the tutorial after we removed support for parsing I think the XML for that program would be something like this: <NonterminalNode symbol="?" rule="Substring">
<VariableNode symbol="x" />
<NonterminalNode symbol="?" rule="PositionPair">
</NonterminalNode>
<NonterminalNode symbol="?" rule="AbsolutePosition">
<VariableNode symbol="x" />
<LiteralNode symbol="k"><![CDATA[0]]></LiteralNode>
</NonterminalNode>
<NonterminalNode symbol="?" rule="AbsolutePosition">
<VariableNode symbol="x" />
<LiteralNode symbol="k"><![CDATA[5]]></LiteralNode>
</NonterminalNode>
</NonterminalNode> (I don't know the symbol names off the top of my head, so I've put in |
Thank you. Where could I read more about the XML grammar? The XML that you have written for me doesn't look straightforward for me to apply somewhere else. For example, I could not have guessed the My use case is that I need to test my program first (kinda like running it 'forward', before asking Prose to learn the params for it via witness functions) to make sure that it indeed does the transformation that I want. |
Sorry, there's no documentation on that. (Apologies, our documentation is a bit lacking; we know.) I found that XML example by running |
Thanks. |
Hello,
I was following the tutorial, but at this step
var ast = ProgramNode.Parse("Id(simpleInput)", grammar, ASTSerializationFormat.HumanReadable);
I got
Unhandled exception. System.NotSupportedException: Deserializing human-readable ASTs is not supported.
In which
Id
is my identity function that does nothing.If I use the equivalent XML as the input
program_string = "<NonterminalNode symbol=\"simpleOutput\" rule=\"Id\"><VariableNode symbol=\"simpleInput\" /></NonterminalNode>";
and parse with
ASTSerializationFormat.XML
, then it works.I look into the code and it seems like only the XML format is currently supported. So given a more complicated function, like
"Substring(x, PositionPair(AbsolutePosition(x, 0), AbsolutePosition(x, 5)))"
, how do I manually construct the XML to test?Thanks.
The text was updated successfully, but these errors were encountered: