2009-12-28

custom precedence rules

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 .]