Work continues. After an aborted first attempt that did not deal with ambiguity well, and a bout of coder's block, the first swipe at the second stage of the parser is dev-done. The code can (read: should) now parse statements when given an arbitrary identifier stream and a scope. Scopes are simple now. No nesting. Just type constants (which aren't used yet), parameter declarations and functions in separate bundles to keep things simple.
Tests exist for:
- step from identifiers to parameter reference
- step from identifiers to function binding
- step from function binding to function invocation
- function consumption of non-terminals (values of a given type)
- priority given to parameters when ambiguous
- use of lower priority when it can successfully parse
Not that it actually
does anything yet. All the code does is take identifiers and give you a parse tree for that statement. More than one parse tree actually if the statement is ambiguous in the current scope. It also likely behaves poorly when there are cycles in the grammar/function declarations.
Still, I am happy to have the core that makes Tangent different there and working. And happy that progress continues
No comments:
Post a Comment