Re: Backtracking through the source

[email protected] (Chaim Frenkel) 29 Nov 2000 11:18:29 -0500
Newsgroups perl.perl6.internals.api.parser
Message-ID <[email protected]>
>>>>> "SF" == Steve Fink <[email protected]> writes:

SF> Handling the parser's state can be done in a backtracking DFA-like or a
SF> direct NFA-like way. The NFA way is to keep track of all possible parse
SF> states and advance each one in parallel based on the next token. The DFA
SF> way is recursive descent, backing out of blind alleys and trying again,
SF> keeping a single working hypothesis alive at a time. The DFA approach is
SF> probably easier to undo user code in, because in the NFA case you have
SF> to consider each token under the assumptions of all possible parses up
SF> to that point. The NFA case has the advantage that you never have to
SF> back up, so you can permanently forget about a token as soon as it
SF> whizzes by.

Can an NFA actually handle the interaction between the lexer and tokenizer?

	$foo = s;foo;bar;g;
	$foo = s#foo#bar#g; # change the world

<chaim>	
-- 
Chaim Frenkel					     Nonlinear Knowledge, Inc.
[email protected]				               +1-718-236-0183