---
# System prepended metadata

title: Untitled

---

parse Relations:
```plantuml
@startuml
start
:consume("such that");
if (token is "such that") then (yes)
    repeat
        :consume();
        :convert token into valid RelationType;
        if (token can be converted to RelationType) then (yes)
            :consume("(");
            if (token is "(") then (yes)
                :parse left hand side;
                repeat
                    :consume();
                    :convert token into\n RelationParameterType;
                    if (token can be converted to\n RelationParameterType) then (yes)
                        if (RelationParameter type is IDENT or\nSYNONYM and has an invalid name) then (yes)
                            :Invalid Syntax;
                            stop
                        else (no)
                            if (just parsed left hand side) then (yes)
                                :consume(",");
                                if (token is ",") then (yes)
                                else (no)
                                    :Invalid Syntax;
                                    stop
                                endif
                            else (no)
                                :consume(")");
                                if (token is ")") then (yes)
                                else (no)
                                    :Invalid Syntax;
                                    stop
                                endif
                            endif
                        endif
                    else (no)
                        :Invalid Syntax;
                        stop
                    endif
                repeatwhile(still need to parse right hand side) is (yes)
                -> no;
                if (relation has valid concrete syntax grammar) then (yes)
                    :add Relation with RelationType and RelationParameterTypes to list of relations;
                else (no)
                    :Invalid Syntax;
                    stop
                endif
            else (no)
                :Invalid Syntax;
                stop
            endif
        else (no)
            :Invalid Syntax;
            stop
        endif
    repeatwhile(while next token is TokenType AND) is (yes)
    ->no;
    stop
else (no)
    :Invalid Syntax;
    stop
endif
@enduml
```