Exercise 4: Parsing

Summary

Write a simple parser to parse input consisting of one or more lines according to the following grammar. The parser should then update the brain instance accordingly.

Define an entity:

{entity}

Define a relationship:

{entity1} {relation} {entity1}

Specify a value assignment:

{entity1}.{entity2} = {entity3}
{entity1}.{entity2}.{entity3} = {entity4}
etc.

Test cases

Click here

Solution

Click here

Web UI

Click here