Skip to content

Parse humanReadable program string #50

@nhamlv-55

Description

@nhamlv-55

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions