Coding 2023-08-24
Okay. I want to write a lexer for Impliciula. For that, I need test cases. Let's start listing things. In each case, assume the whitespace is needed but I don't really care how it lexes.
- list-of: 'a: function-inline-right, type-variable
- list-of: int: function-inline-right, name
- nil: name
- head: head and-tail: tail: function-inline-right, name, function-inline-right, name
- for-all-e-in: list e: ::is-even: function-inline-right, name, function-inline-right, function-prefix-left
- there-exists-an-e-in: list such-that-e: ::is-even: function-inline-right, name, function-inline-right, function-prefix-left
Pause here to note that I will consider goofy unicode abbreviations for those, so they're more like ∀-e-in::e:: and ∃-e-in::st-e:: (which have to be function-prefix-left, function-prefix-left unless I want to devise Cursed Tokens or if I don't indicate the side on the prefix form, and let it contain multiple parts, in which case it's function-prefix, and that above is function-prefix-left instead of function-prefix)
The problematic cases come in with partial evaluation. Like, if I want to apply for-all-e-in::e:: to the predicate, can that be for-all-e-in:: e: ::is-even, or does it have to be for-all-e-in: : e: ::is-even? I really want to make the former work, but that would seem to mean that function-prefix-right, function-inline-right, function-prefix-left is a valid call. I can't "simply" lex the freestanding colons separately because otherwise I think the inline-right, prefix-left sequence is instead something really messed up. I think I'd like to allow the prefix version to contain double colons, because the alternative is to just split it into a bunch of prefix-rights. Prefix-left can only be a single segment, and prefix-right and prefix-right-left end in double colon and can maybe contain multiple segments.
I'm going to need to make some kind of Punnett square for the token types I'm trying to come up with here. Not a Punnett square. Um... I dunno.
I'm going to wrap up, and doodle that chart while this publishes.
Good night.