<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->

<book xml:id="book.parle" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <?phpdoc extension-membership="pecl" ?>
 <title>Parsing and lexing</title>
 <titleabbrev>Parle</titleabbrev>

 <preface xml:id="intro.parle">
  &reftitle.intro;
  <para>
   The parle extension provides general purpose lexing and parsing facilities. The implementation is based on <link xlink:href="http://www.benhanson.net/">Ben Hanson</link>'s libraries and requires a <link xlink:href="http://en.cppreference.com/w/cpp/compiler_support">C++14</link> capable compiler. The lexer is based on the regex matching, the parser is LALR(1). Lexers and parsers are generated on the fly and can be used immediately after they've been finalized. Parle deals with parsing and lexing, the appropriate data structures representation and processing are the implementer's task. Serialization and code generation are not supported by the extension, yet.
  </para>
  <para>
   Lexer analysis is a process of splitting a character sequence into a list of lexemes. The lexeme list can be then used for the syntax analysis against a formal grammar. These operations are also known as lexing and parsing. This documentation doesn't aim to provide an exhaustive information on lexing and parsing. Good information in this regard is available on the numerous resources on the net. Several usage examples are included, to show the functionality. The extension is useful for PHP programmers both willing to learn or to utilize parsing and lexing. State machines and grammar parsing don't have to be implemented manually, these complex tasks are taken away by parle. Thanks to that, the development can be focused on the actual problem solving.
  </para>
  <para>  
   The common use case for parle is, when a data format is too complex to be handled by the regex matching with PCRE. The practical application is herewith wide. Be it a specific data format, a behavior modification of existing functions, even an own programming language and beyond. The helper methods such as <methodname>Parle\Lexer::dump</methodname> to inspect the generated state machine, or <methodname>Parle\Parser::dump</methodname> to inspect the generated grammar, are useful. The method <methodname>Parle\Parser::trace</methodname> can also be used to track the parsing operation.
  </para>
 </preface>

 &reference.parle.setup;
 &reference.parle.constants;
 &reference.parle.pattern.matching;
 &reference.parle.examples;
 &reference.parle.parle.lexer;
 &reference.parle.parle.rlexer;
 &reference.parle.parle.parser;
 &reference.parle.parle.rparser;
 &reference.parle.parle.stack;
 &reference.parle.parle.token;
 &reference.parle.parle.errorinfo;
 &reference.parle.parle.lexerexception;
 &reference.parle.parle.parserexception;

</book>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
