In order to eliminate the macro processor, I have changed the syntax
for break, continue, and redo:

var i = 0; 
fred:whilst i < 10 do 
  println i; ++i; 
  if i> 6 do break fred; done 
done

Basically, if you want to break, continue, or redo, you have to label
your whilst, until, or forall loop as shown. Even if there is no other loop
around, there's no default.

The plus side of this is that you can break out of or continue multiply nested 
loops
to any level.

The loop labels must be unique in a given scope.

As a fun side-effect .. you can continue ANY loop this way (at the moment!)
even one the continue isn't inside of: it's just a goto after all.

break fred is exactly the same as goto break_fred, the parser inserts the
label "break_fred" at the place for breaking. Ditto continue and redo.

Label is not required on a loop if you don't break, continue or redo.

Note: the difficulty with the old syntax is that the macro processor did the 
labelling
of the break/continue statements after parsing, using recursive descent.
The parser Scheme code, on the other hand, evaluates bottom up, so the 
break/continue
will be processed BEFORE the containing loop is reduced.

Of course I could then do a recursive descent in Scheme on the s-expression, but
that would require a suitable term mapping function, a lot more work :)
I may do that later. 

For the moment "get rid of the macro processor" is the goal. Actually
some of it will be retained, such as the constant folding and some of the
desugaring it does.

It remains a problem how to handle macro vals, which are currently *required*
for conditional compilation based on the OS. (Linux, MacOSX etc).
In order for this to work the symbol has to be visible in all files, however
we can't use a "val" because that would be a duplication.


--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to