Open paulstansifer opened 3 years ago
I don't like that this adds numbers to the core language. But I think it's the only reasonable approach.
I guess there's already numeric types, and one
through ten
, and anything_to_string
even assumes base-10. But there's no way to relegate this to core_extra_forms.rs
.
Nested
Alt
s andBiased
s are (a) hard to understand, and (b) impossible to add to, making::=also
limited in what it can do.Instead:
::=also
assume that there's a top-levelAlt
and add to it, rather than adding another layer of nesting.Biased
, and instead have some sort ofPriority
wrapper that sets a rule's priority.That way, rules can be usefully prioritized when extending grammars.
This shouldn't be too hard. It will require adjusting
LocalParse
, but that it's just a matter of changingJustifiedByAtomPlanB
and thinking through how prioritized and non-prioritized rules relate to each other. (Maybe they have priority 0, and you can set priorities both positive and negative?) Might also need to think about when a partial parse "loses" its priority.