Tiny Ollibot Example Server - Call-by-need functions

Language of matching parens

Recognition with a deterministic push-down automaton with one state ▷. To accept, final state must be ▷ only (stack to the left of ▷ is empty).

r1 : ▷ • [ ->> [ • ▷.
r2 : [ • ▷ • ] ->> ▷.

Examples

Success

%trace * 
  ▷ • [ • [ • [ • ] • [ • [ • ] • ] • ] • ].
▷•[•[•[•]•[•[•]•]•]•]
[•▷•[•[•]•[•[•]•]•]•]
[•[•▷•[•]•[•[•]•]•]•]
[•[•[•▷•]•[•[•]•]•]•]
[•[•▷•[•[•]•]•]•]
[•[•[•▷•[•]•]•]•]
[•[•[•[•▷•]•]•]•]
[•[•[•▷•]•]•]
[•[•▷•]•]
[•▷•]
▷

Failure (too many right parens)

%trace * 
  ▷ • [ • [ • ] • [ • [ • ] • ] • ] • ].
▷•[•[•]•[•[•]•]•]•]
[•▷•[•]•[•[•]•]•]•]
[•[•▷•]•[•[•]•]•]•]
[•▷•[•[•]•]•]•]
[•[•▷•[•]•]•]•]
[•[•[•▷•]•]•]•]
[•[•▷•]•]•]
[•▷•]•]
▷•]

Failure (too many left parens)

%trace * 
  ▷ • [ • [ • [ • [ • [ • ] • ] • ] • ].
▷•[•[•[•[•[•]•]•]•]
[•▷•[•[•[•[•]•]•]•]
[•[•▷•[•[•[•]•]•]•]
[•[•[•▷•[•[•]•]•]•]
[•[•[•[•▷•[•]•]•]•]
[•[•[•[•[•▷•]•]•]•]
[•[•[•[•▷•]•]•]
[•[•[•▷•]•]
[•[•▷•]
[•▷