10.6: adda/syntax/prec'order:
. unlike the etree parser
where precedence was table-driven,
adda must know precedence also by type;
and then each type can additionally provide
a prec'table that can reduce the need for writing paren's .
. how does a type`declaration specify precedence?
it can list the symbols in groups of
{values, uniop's, biop's, others},
and then under biop's,
the order given is also the prec'order .
. do the highest precedence last,
so they are listed in the same order they would be
in a parse tree
when no paren's are involved; eg:
( +, -
; *, /
; ** ).
[10.9: just noticed some biop's will have equal precedence,
so there needs to be both comma's and semi-colons
to distinguish equal from unequal levels ] .
override:
. a place where paren's need be part of parse.tree
is explicit paren's when none is needed?
but still don't need a paren' op[etree symbol for explicit paren's],
rather, when paren's are optional yet user-preferred,
use multiple operations vs a single multiarg operation:
eg,
a+b+c: +(a,b,c),
vs:
a+(b+c): +(a, +(b,c)),
[10.9:
. must consider not only user's preference,
but also how eval' order of numbers can affect precision .]
3.22: adda/parse/dealing with limited datatyping:
ReplyDelete. what if the parser doesn't have the type of an operator?
then it doesn't have a precedence
but it has the type of the operator's operands,
and those types should support that operator,
so then the operator's type in that context
becomes known by inference .
. if the atoms are untyped,
then the only operaters allowed
are those supported by numerics or logic .
. still, an intermediary parser starts by
putting biops in an array
that is the same as a flattened tree .