Matching special characters is done greedily, the longest left prefix is considered first. Currently the precedence level is ignored, and all operators are at level 10 binding just more tightly than ||.
The infix form is replaced by a call to the specified function.
The user can also define bracket operators.
If you put some of these things in a separate file, be sure to #import the file in every file that it is needed.
1: #line 693 "./lpsrc/flx_tut_macro.pak" 2: #import <flx.flxh> 3: #infix 10 "^%" myfun 4: print "OK"; endl; 5: fun myfun: int * int -> int = "$1 + $2 * 2"; 6: print$ myfun$ 2,4; endl; // 10 7: print$ 2 ^% 4; endl; // 10 8: 9: #bracket "[[" "]]" abs 10: fun abs: int -> int = "abs($1)"; 11: 12: print$ abs (-10); endl; //10 13: print$ [[ -10 ]]; endl; //10 14: 15: #infix 10 fred joe 16: fun joe: int * int -> int = "$1 + $2 * $2"; 17: print$ joe$ 2,3; endl; // 11 18: print$ 2 fred 3; endl; // 11 19: 20: proc ff:lvalue[int] * int = "$1=$2;"; 21: var x:int <- ff 1; 22: print x; endl; 23: 24: 25: proc gg(px:&int, a:int) { *px = a; } 26: var &y:int <- gg 1; 27: print y; endl; 28: