Skip to content

Expression variant #154

@quabug

Description

@quabug

Create a tree of variant from a string input.

class Assign<T> : IVariant<T> where T : unmanaged
{
    public IVariantWriter<T> Left;
    public IVariantReader<T> Right;
}

class Add<T> : IVariantReader<T> where T : unmanaged
{
    public IVariantReader<T> Left;
    public IVariantReader<T> Right;
}

class Normalize<T> : IVariantReader<T> where T : unmanaged
{
    public IVariantReader<T> Value;
}

class SomeExpressionReader<T> : IVariantReader<T> where T : unmanaged
{
    public IVariantReaderAndWriter<T> Foo;
    public IVariantReader<T> Bar;
    public string Expression; // "$Foo = $Foo + normalize($Bar)"
                              //     => Assign(Left: Foo, Right: Add(Left: Foo, Right: Normalize(Value: Bar)))
}

https://github.com/datalust/superpower

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions