r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Parse] Discussion of PARSE dialect

BrianH
8-Nov-2008
[3001x2]
Interesting! It sounds like it is related to OF, Carl's idea to replace 
DELECT. That would be useful for making DELECT-style dialects without 
the parameters being optional. How important is it that the parameters 
be mandatory?
By the way, Carl has already decided that REP 11 will take the form 
of the USE proposal. The RULE! type will have to wait for UDTs.
Steeve
8-Nov-2008
[3003]
Brian, OF optionnal parameters can be constructed using  ALL like 
this:
ALL  [rule1 | rule2 | opt rule3]
so ALL, is more generalist
BrianH
8-Nov-2008
[3004]
That sounds good to me. OF is not set in stone yet, so that should 
definitely be brought up. Good idea :)
Graham
8-Nov-2008
[3005]
quickie ... will words set by parse go into a global context still?
BrianH
8-Nov-2008
[3006]
Yes, but you will be able to make recursion-safe local words with 
USE.
Graham
8-Nov-2008
[3007]
and will we be able to do things like  [ copy obj/var to something 
]
BrianH
8-Nov-2008
[3008]
That sounds like a good idea too.
Graham
8-Nov-2008
[3009]
part of constructing objects while parsing
BrianH
8-Nov-2008
[3010]
If you don't know what the field will be, you might want to append 
to the object instead in a paren. Setting obj/var only works if there 
is already an var field in obj, but append will work even if there 
isn't.
Graham
8-Nov-2008
[3011]
mostly I want to collect all the data into a predefined object
Steeve
8-Nov-2008
[3012]
but if you  do that you must limit the behaviour of INTO.
currently INTO enter in paren! path! and block!.
if think it's to versatile
Graham
8-Nov-2008
[3013]
to reduce the number of variables I work with
Steeve
8-Nov-2008
[3014]
INTO sh
Graham
8-Nov-2008
[3015]
so, for the latter situation ... [ append obj/var to something ] 
will allow me to build the object?
BrianH
8-Nov-2008
[3016]
Steeve, have you looked at the INTO parse proposal on the wiki? It's 
at the end. It's my favorite, if only because of the example :)
Steeve
8-Nov-2008
[3017x2]
the INTO/string, yes i always tought it was an excellent idea Brian
ah ok it's covering my request
BrianH
8-Nov-2008
[3019x2]
The INTO and CHANGE proposals were made after I checked with Carl 
that keyword modifiers were workable.
That reminds me, I have a few edits to make.
Steeve
8-Nov-2008
[3021x2]
ah i feel better
after a good beer
BrianH
8-Nov-2008
[3023]
Check the page again - you're on it (INTO proposal).
Steeve
8-Nov-2008
[3024]
haha seriously, u can't credit me on that, you had already done the 
proposal.

But i will accept the credit if Carl accept the ALL ehancement ;-)
BrianH
8-Nov-2008
[3025x2]
More names are good. (check private chat)
I'm serious about attribution here. I didn't attach my name to any 
proposal I didn't come up with.
Steeve
8-Nov-2008
[3027x3]
check private chat, plz
here we go for proposals
Brian i hear you ;-)
BrianH
8-Nov-2008
[3030x2]
It occured to me (as I'm sure that it has occured to others) that 
it is possible for parse rules to do one bad thing even if you exclude 
all of the modification statements, word setting statements, and 
parens: ANY and SOME can go into infinite loops if they don't advance 
the position. I would like to propose that there be some form of 
warning or error if SOME or ANY loop again on the same position they 
did last time. This condition should be screened for with a PARSE 
refinement. If the refinement is set then when the point is reached 
where ANY or SOME would repeat at the same position, the rule would 
fail (and possibly backtrack to the next alternate).
Maybe that and a few other restrictions could be enabled when a /safer 
refinement is used.
Steeve
8-Nov-2008
[3032]
i'm thinking...
BrianH
8-Nov-2008
[3033x3]
Because of get-words there may be times where you don't want the 
position to advance, so this would have to be an option rather than 
standard behavior, or it would be a backwards compatibility problem 
that might not be worth it.
The way the new behavior would be formulated is this: ANY or SOME 
would only succeed if one of these conditions happened:
- The rule argument fails (after the first round for SOME).
- The rule argument succeeds *and* the position changes.
I'm not sure how REVERSE would fit in, but it sounds workable so 
far...
Steeve
8-Nov-2008
[3036x2]
i never had such a case. I don't really see your point. When all 
rules failed in an ANY block, then we have a break
it's the responsability of sub-rules to do some skip to avoid such 
cases
BrianH
8-Nov-2008
[3038]
Ah, but if one of the rules succeeds but doesn't advance the position 
(like NONE), you get an infinite loop.
Steeve
8-Nov-2008
[3039]
yes but who do such things ?
BrianH
8-Nov-2008
[3040]
The reason you would enable this option is to catch sub-rule logic 
errors.
Steeve
8-Nov-2008
[3041x2]
i always take care to advance in the serie
ah ok, it's to help for debugging purposes ?
BrianH
8-Nov-2008
[3043]
Yeah, or malicious rules from third parties because you can't easily 
statically determine whether the bug would happen. Most malicious 
rules can be screened for, but others can't. It's a bad idea to run 
third-party rules anyway, but some people can't avoid it.
Steeve
8-Nov-2008
[3044]
but i see the interest to set no backwards capabilities in some case, 
we coold have a special command (like FREEZE) to throw an error when 
we have a backward effect
BrianH
8-Nov-2008
[3045]
Backwards isn't a problem (especially with REVERSE) - stasis is.
Steeve
8-Nov-2008
[3046]
i have to reread the effect of REVERSE
BrianH
8-Nov-2008
[3047x4]
At the very least the infrastructure should be added to detect this 
kind of error so that PARSE tracing can warn about it.
REVERSE changes the direction of PARSE. This helps with recognizing 
language patterns that LR is better at than LL is.
I have some ideas about how REVERSE and should work with backtracking 
that I haven't written down yet.
and ->