On Tue, 2006-07-18 at 17:05 +1000, skaller wrote:
> On Mon, 2006-07-17 at 17:22 -0700, Erick Tryzelaar wrote:
> > Here's another: for-else, while-else and break statements

One more comment on user defined syntax.

At present, if there is an error ANYWHERE in the
user code using your extensions, you will just get
a message like:


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
last : int , stride : int )   {
   0:   var i = first ; var count = 0 ; whilst
Syntax Error before token 87 in ab.flx, line 37 col 10
i <= last do initially print "{" ; always print i ; if i + stride <=
last do print ","
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
CLIENT ERROR
Syntax Error
In ab.flx: line 37, cols 10 to 10
36:   var count = 0;
37:   whilst i <= last do
             *
38:     initially

This means the parser tried all the 'whilst' statements,
and couldn't find one that matched.

Executable RD parsing is very bad at errors.

We can do better by left factoring and inserting cuts after
unique heads.

Felix already left factors based on the statement leadin keyword.

The cut algorithm is:

parse(p,backtrack):
  backtrack = backtrack or #alternatives > 1
  for each alternative a: parse(p,backtrack)
  on-error:
    if backtrack return false 
    else throw location

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


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to