PHPackages                             tomzx/abstract-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. tomzx/abstract-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

tomzx/abstract-parser
=====================

An abstract parser written in PHP

v0.1.0(10y ago)2491[2 issues](https://github.com/tomzx/abstract-parser/issues)1MITPHPPHP &gt;=5.4.0

Since Jan 24Pushed 9y ago1 watchersCompare

[ Source](https://github.com/tomzx/abstract-parser)[ Packagist](https://packagist.org/packages/tomzx/abstract-parser)[ Docs](https://github.com/tomzx/abstract-parser)[ RSS](/packages/tomzx-abstract-parser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

Abstract parser
===============

[](#abstract-parser)

[![License](https://camo.githubusercontent.com/c44a03321c10e66f23756c362e5b8015fa06d84c2660fe15f850afa17646ab44/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7a782f61627374726163742d7061727365722f6c6963656e73652e737667)](https://packagist.org/packages/tomzx/abstract-parser)[![Latest Stable Version](https://camo.githubusercontent.com/8f9d4a3742cf8075bbcf9dded084a9392829071a29b1d911f88fca0d4703a9fe/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7a782f61627374726163742d7061727365722f762f737461626c652e737667)](https://packagist.org/packages/tomzx/abstract-parser)[![Latest Unstable Version](https://camo.githubusercontent.com/43293bb4e5e5cc8da2b930414ee2f97232d0584b745655010ce4d330c3aba2d7/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7a782f61627374726163742d7061727365722f762f756e737461626c652e737667)](https://packagist.org/packages/tomzx/abstract-parser)[![Build Status](https://camo.githubusercontent.com/796e5ab00cd0952ea8eb89d90c5c67c2aa28ce93bf56de3ea16e6c14aa2160da/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f6d7a782f61627374726163742d7061727365722e737667)](https://travis-ci.org/tomzx/abstract-parser)[![Code Quality](https://camo.githubusercontent.com/8e709882dfd88d89092609283ccce339fe8648e5bdc969ccce3a1c96f4698bee/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f6d7a782f61627374726163742d7061727365722e737667)](https://scrutinizer-ci.com/g/tomzx/abstract-parser/code-structure)[![Code Coverage](https://camo.githubusercontent.com/42ff2d0d32876283a8861dcf335f654b6ed76c96999a8cb7ebb7a6d346417acc/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f746f6d7a782f61627374726163742d7061727365722e737667)](https://scrutinizer-ci.com/g/tomzx/abstract-parser)[![Total Downloads](https://camo.githubusercontent.com/5c421022d3755baad84ac5f91276524cd479c38701e38e1d1b7249b88f6f391f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f6d7a782f61627374726163742d7061727365722e737667)](https://packagist.org/packages/tomzx/abstract-parser)

An abstract parser written in PHP. Based on [nikic's PHP Parser](https://github.com/nikic/PHP-Parser).

Getting started
---------------

[](#getting-started)

`Abstract parser` offers 2 interfaces which you'll want to implement:

- `NodeInterface`: A basic interface for all of the elements of your tree structured data structure.
- `NodeVisitorInterface`: Actions to execute when entering/exiting a `NodeInterface` element or at the beginning/end of a traversal.

Once you have implemented the `NodeInterface` for your data elements, you can walk through them using something like the following:

```
