[Ur] Functional infix operators ?
Gabriel Riba
griba2001 at gmail.com
Wed Feb 25 04:32:42 EST 2015
Gabriel Riba <griba2001 <at> gmail.com> writes:
>
> ** In the definitions section:
>
> backtick_path = `([A-Z][A-Za-z0-9_]*\.)*[a-z_][A-Za-z0-9_']*`;
>
> ** In the rules section:
>
> <INITIAL> {backtick_path} => (Tokens.BACKTICK_PATH (
> substring (yytext, 1, size yytext -2),
> pos yypos, pos yypos + size yytext));
>
This can be simplified, expressing {backtick_path} in terms of {id} and
{cid} for identifiers and module names.
Forget {backtick_path}
* In urweb.lex
** In the rules section
<INITIAL> "`" ({cid} ".")* {id} "`" => (
Tokens.BACKTICK_PATH (
substring (yytext,1,size yytext -2),
pos yypos, pos yypos + size yytext)
);
* About the new operators precedence
** I would shift them down the list below (tighter binding) the sql
operators the comparison operators (EQ NE LT LE GT GE IS) between ARROW (->)
and (CARET, PLUSPLUS) wich are concatenation operators
But this is a matter of controversial and the language designer has the last
word.
%right CAND (* this is an SQL operator *)
+ %right COMPOSE ANDTHEN
%nonassoc EQ NE LT LE GT GE IS
%right ARROW
+ %right FWDAPP
+ %left REVAPP
+ %left BACKTICK_PATH
%right CARET PLUSPLUS
More information about the Ur
mailing list