I'm playing around with the dssl support and it's really cool. I'm
running into some issues though. I'm toying around with the idea of
list comprehensions, but I'm having trouble actually getting it
implemented. Here's my toy code:

comprehensions.flx:
syntax foo {
  satom := [ sexpr ] =># (List::list _2);
  satom := lpar "from" sname in sexpr "endfrom" rpar =># ( List::map
(fun x => x + 1) _5);
}


foo.flx:
#import <flx.flxh>
#syntax <comprehensions.flx>
open syntax foo;

val xs = [1, 2, 3];
val ys = ( from (x:int) in xs endfrom );
print ys; endl;


As you can see, I've got a long way to go. First off, this errors out with this:


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
syntax foo   {
   0:   satom := lpar "from" sname in sexpr "endfrom" rpar =># ( List
:: map ( fun x
Syntax Error before token 67 in ./comprehensions.flx, line 2 col 77
=> x + 1 ) _5 ) ; }
   0: <<save syntax ./comprehensions.flx.syncache>> open syntax foo ;
val xs = List :: list (
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Dyp.Syntax_error
PARSE ERROR
Unknown exception Parsing File


It seems it doesn't like the embedded function. Second, after playing
around more to get these statements:


syntax foo {
  satom := "from" in sexpr "endfrom" =># ( List::list 5);
}
val ys = from in xs endfrom;


It warns with this:

// Save Syntax file ./comprehensions.flx.syncache
WHA?? Parent 4048 of 4051 does not exist??
WHA?? Parent 1778 of 1783 does not exist??
[5]


Finally, it'd be awesome if I could do something like this:

  satom := lpar "from" sname in sexpr "endfrom" rpar =># ( List::map
(fun _3 => _3 + 1) _5);


But I'm betting I'm going to have to use scheme to do this. What am I
doing wrong?

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