On Thu, 2007-08-02 at 17:29 +1000, skaller wrote:

> So you cannot write:
> 
>       sexpr := lpar sexpr "over" sexpr rpar =># ( _2 / _4 );
> 
> because, even though _1 and _5 are not used in the user action,
> they're still converted to Felix expressions .. and that
> conversion will fail because lpar happens to be a nonterminal
> returning Snull Scheme value, which isn't a valid Felix expression.

Ahem .. I lied. It does work .. :))

///////////////////////////////////////
#import <flx.flxh>

syntax extension {
  sexpr := lpar sexpr "over" sexpr rpar =># (_2 / _4);
}

open syntax extension;

var x = ( 100 over 20 );
println x;
/////////////////////////////////////////

[EMAIL PROTECTED]:/work/felix/svn/felix/felix/trunk$ f uet
//Parsing Implementation std.flx
//Parsing Implementation uet.flx
5

HAHA lol I don't understand my own code :)

In sex.pak, we have the mapping:

  | Snull -> Lst []

and in flx_sex2flx.ipk we have the mapping:

 | Lst [] -> `AST_tuple (sr,[])

which is a value Felix expr_t term .. so the special nonterminals
mapping to tokens, which all return Snull, are actually mapped
to the unit value ().

So accidentally .. the code above does in fact work.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to