[ragel-users] Re: Bug or feature?
Carlos Antunes
cmantu... at gmail.com
Sat Jul 14 22:20:30 UTC 2007
On 7/14/07, Adrian Thurston <thurs... at cs.queensu.ca> wrote:
>
> If you look near the end of that thread I'd like to revive the old semantics (the missing operator you speak of) however there are no more symbols left.
>
Do you see any harm in reviving the old semantics? How about a compile
time switch for the entering operator or maybe an option to write
init? The default would be the new semantics. I guess this would be
easier than to code additional operators. Personally, I find the old
semantics more intuitive and from a pragmatic point of view, they
would be more useful to me (in this particular case, I have to deal
with the possibility of an empty password; the old semantics would
work very well here.)
>
>Instead I want to add an identifier-based embedding operator
>
A what!? :) You lost me with the identifier-based...
Thanks!
Carlos
> -----Original Message-----
> From: "Carlos Antunes" <cmantu... at gmail.com>
>
> Date: Sat, 14 Jul 2007 17:23:49
> To:ragel-users at googlegroups.com
> Subject: [ragel-users] Re: Bug or feature?
>
>
> [Now with the machine attached]
>
> Adrian,
>
> Just built the following example machine:
>
> action action_in {}
> action action_out {}
>
> testmach := lower* >action_in %action_out '$';
>
> Graph is attached. Now, I am even more confused. Does that mean that
> the entering action is really not the entering action into the machine
> but it is the action that gets executed after a character is matched
> for the first time? If that's the case, I think there is one operator
> missing for symmetry, no? One which gets executed with the IN
> transition?
>
> Thanks and sorry about all the "thinking aloud" here. "thinking aloud" here.
>
> Carlos
>
>
>
> > On 7/14/07, Carlos Antunes <cmantu... at gmail.com> wrote:
> > > Adrian,
> > >
> > > I just reread the thread and, for the life of me, I don't understand
> > > why the OUT transition (not shown on the graph on the previous msg)
> > > gets its action executed but the IN transition doesn't get the same
> > > treatment.
> > >
> > > You've said, and I quote you:
> > >
> > > "Prior to version 4.0, the entering action operator actually did exactly
> > > what you describe. If the machine's start state was final, then it also
> > > embedded the action into the start state as a leaving action. Initially
> > > I thought this was very intuitive, however over time I gradually took
> > > the opinion that all operators should have a single purpose."
> > >
> > > Now, it appears to me that you were associating the entering action
> > > with the OUT transition when both the start and final states are the
> > > same. I agree with you, this is not intuitive. However, what I don't
> > > understand is why you don't associate the entering action with the IN
> > > transition. Entering action goes with IN and leaving action goes with
> > > OUT. No dual purpose here, or am I still missing something?
> > >
> > > Thanks!
> > >
> > > Carlos
> > >
> > > On 7/14/07, Carlos Antunes <cmantu... at gmail.com> wrote:
> > > > Adrian,
> > > >
> > > > Let me start by saying that I was wrong when I said that the optional
> > > > machine is bypassed. You are right, there is a state which is both the
> > > > start and finish and that state is always transitioned to. Attahed,
> > > > you'll find the image that convinced me of that. I'm going to reread
> > > > that thread to see if I "get it". To be honest with you, I am still
> > > > confused so expect additional questions from me. I hope you don't
> > > > kind! :)
> > > >
> > > > Thanks!
> > > >
> > > > Carlos
> > > >
> > > > On 7/14/07, Adrian Thurston <thurs... at cs.queensu.ca> wrote:
> > > > > Carlos,
> > > > >
> > > > > The leaving action is run because the machine accepts the zero-length
> > > > > word at the time that it is embedded. That is, the start state is also
> > > > > final. When you 'pass over' a machine that accepts the zero-length word
> > > > > you are always passing through the start state which is also final. And
> > > > > so you are 'leaving' it.
> > > > >
> > > > > But entering actions are always associated with transitions inside the
> > > > > machine. This is how you can leave a machine you have never 'entered.'
> > > > >
> > > > > It's true, the wording of things doesn't perfectly match the semantics,
> > > > > and they used to match better (see the thread), but to me the current
> > > > > state of things seems the best way to go. The semantics of the operators
> > > > > are simple and easy to define.
> > > > >
> > > > > If you make a habit of factoring out zero-length machines then you can
> > > > > avoid this problem.
> > > > >
> > > > > word = char+ >enter %leave;
> > > > > opt_word = word?;
> > > > >
> > > > > -Adrian
> > > > >
> > > > > Carlos Antunes wrote:
> > > > > > Adrian,
> > > > > >
> > > > > > Ok, read the thread and that message specifically. I still don't get
> > > > > > why a machine that doesn't get entered gets to be exited. If a
> > > > > > transition goes around, not through, the machine, why would the exit
> > > > > > action of that machine be called? After all, that optional machine
> > > > > > final state may never be transitioned to, right? How come it can be
> > > > > > transitioned from, then?
> > > > > >
> > > > > > Thanks!
> > > > > >
> > > > > > Carlos
> > > > > >
> > > > > > On 7/14/07, Adrian Thurston <thurs... at cs.queensu.ca> wrote:
> > > > > >> Hi Carlos,
> > > > > >>
> > > > > >> See this thread:
> > > > > >>
> > > > > >> http://groups.google.com/group/ragel-users/browse_thread/thread/9509ab83d7f022f1/
> > > > > >>
> > > > > >> And in particular this message:
> > > > > >>
> > > > > >> http://groups.google.com/group/ragel-users/msg/79546a93494e6773
> > > > > >>
> > > > > >> -Adrian
> > > > > >>
> > > > > >> Carlos Antunes wrote:
> > > > > >>> Adrian,
> > > > > >>>
> > > > > >>> I have the following construct:
> > > > > >>>
> > > > > >>> password = password_char**
> > > > > >>> >{ capture_start(capid_password, p); }
> > > > > >>> %{ capture_stop(capid_password, p); };
> > > > > >>>
> > > > > >>> When I feed a string that doesn't match "password", "capture_stop" is
> > > > > >>> immediately called but not "capture_start". I would expect that either
> > > > > >>> both or none are called (I prefer both). What say you?
> > > > > >>>
> > > > > >>> Thanks!
> > > > > >>>
> > > > > >>> Carlos
> > > > > >>>
> > > > > >>
> > > > > >>
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > "We hold [...] that all men are created equal; that they are
> > > > endowed [...] with certain inalienable rights; that among
> > > > these are life, liberty, and the pursuit of happiness"
> > > > -- Thomas Jefferson
> > > >
> > > >
> > >
> > >
> > > --
> > > "We hold [...] that all men are created equal; that they are
> > > endowed [...] with certain inalienable rights; that among
> > > these are life, liberty, and the pursuit of happiness"
> > > -- Thomas Jefferson
> > >
> >
> >
> > --
> > "We hold [...] that all men are created equal; that they are
> > endowed [...] with certain inalienable rights; that among
> > these are life, liberty, and the pursuit of happiness"
> > -- Thomas Jefferson
> >
>
>
> --
> "We hold [...] that all men are created equal; that they are
> endowed [...] with certain inalienable rights; that among
> these are life, liberty, and the pursuit of happiness"
> -- Thomas Jefferson
>
>
>
>
> >
>
--
"We hold [...] that all men are created equal; that they are
endowed [...] with certain inalienable rights; that among
these are life, liberty, and the pursuit of happiness"
-- Thomas Jefferson
More information about the ragel-users
mailing list