logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Marpa::R2::Semantics::Phases - Phases of SLIF parse evaluation

Name

       Marpa::R2::Semantics::Phases - Phases of SLIF parse evaluation

Overview Of The Semantic Phases

       Most users will not need to read this document.  Most applications will find that the order in which the
       SLIF executes its semantics "just works".  This document describes that order in detail.  These details
       can matter in some applications, for example, those which exploit side effects.  And some readers may
       also find this background material to be helpful.

Parse Series Setup Phase

       During the Parse Series Setup Phase all action names are resolved to actions  --  Perl  scalars  or  rule
       evaluation  closures.  The rule evaluation closures are not called in the Parse Series Setup Phase.  They
       will be called later, in the Parse Tree Traversal Phase.  Also, during the Parse Series Setup Phase,  the
       logic which ranks parse trees is executed.

Parse Tree Setup Phase

       In  the Parse Tree Setup Phase, the per-parse argument is created.  If a per-parse constructor was found,
       it is run at this point, and the per-parse argument is its return value.  Exactly one  Parse  Tree  Setup
       Phase occurs for each parse tree.

Parse Tree Traversal Phase

       During  the Parse Tree Traversal Phase, the rule evaluation closures are called.  Node Evaluation Time is
       the Parse Tree Traversal Phase, as seen from the point of view of the individual nodes of the parse tree.

Parse Trees And Parse Series

       Because Marpa allows ambiguous parsing, each parse can produce a parseseries -- a series of zero or more
       parse trees, each with its own parse result.  The first call to the SLIF recognizer's value() method
       after the recognizer is created is the start of the first parse series, and Parse Series Setup Phase
       takes place at this point.

       The first parse series continues until there is a call to the series_restart() method or until the
       recognizer is destroyed.  An application is usually interested in only one parse series.

       The series_restart() method starts a new parse series.  The Parse Series Setup Phase for that parse
       series will take place during the next call of the SLIF recognizer's value() method.

Summary Of The Phases

       While processing a parse series, we have:

       •   A  Parse  Series  Setup  Phase,  which  occurs during the first call of the SLIF recognizer's value()
           method for that series.  It is followed by

       •   the processing of zero or more parse trees.

       While processing a parse tree, we have:

       •   A Parse Tree Setup Phase, which occurs during the call of the recognizer's value()  method  for  that
           parse tree.  It is followed by

       •   a Parse Tree Traveral Phase.

       NodeEvaluationTime is the Tree Traversal Phase, as seen from the point of view of each rule node.  It
       is not a separate phase.

See Also