PHPackages                             davidkuhner/regex - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. davidkuhner/regex

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

davidkuhner/regex
=================

The Hoathis\\Regex library.

141PHP

Since Feb 13Pushed 12y ago2 watchersCompare

[ Source](https://github.com/davidkuhner/Regex)[ Packagist](https://packagist.org/packages/davidkuhner/regex)[ RSS](/packages/davidkuhner-regex/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Visualiser un compilateur
=========================

[](#visualiser-un-compilateur)

Les compilateurs sont des outils formidables qui rendent beaucoup de services. Toutefois, il peut vite devenir difficile de visualiser les données qu'ils manipulent en entrée ou en sortie. L'objectif de ce sujet est double : dans un premier temps, nous proposons de réaliser une représentation graphique d'une expression régulière, puis dans un second temps, optionnellement, d'étendre les compétences fraîchement acquises pour réaliser une représentation graphique d'une grammaire algébrique.

Utilisation
===========

[](#utilisation)

Si Hoa est installé dans `/usr/local/lib/Hoa`, les Hoathis doivent être installées au même niveau, c'est à dire dans `/usr/local/lib/Hoathis`. Cette bibliothèque est une Hoathis de [`Hoa\Regex`](https://github.com/hoaproject/Regex). Voici comment l'installer facilement (sans passer par Composer) :

```
$ git clone http://git.hoa-project.net/Central.git \
            /usr/local/lib/Hoa.central
$ ln -s /usr/local/lib/Hoa.central/Hoa \
        /usr/local/lib/Hoa
$ ln -s /usr/local/lib/Hoa.central/Hoathis \
        /usr/local/lib/Hoathis
$ git clone https://github.com/davidkuhner/compiler-visualization \
            /usr/local/lib/Hoathis/Regex

```

Placer le script `hoa` (dans `/usr/local/lib/Hoa/Core/Bin/`) dans `$PATH`. Ensuite, nous pourrons utiliser `hoa compiler:pp`. Cette commande prend une grammaire et une donnée en entrée, et analyse cette donnée par rapport à cette grammaire. Elle produit un AST, et nous sommes ensuite capable d'y appliquer un visiteur à l'aide des options `--visitor dump` ou `--visitor-class …`. Pour rappel, voici le schéma du processus.

À partir d'une grammaire et d'une regex (notre donnée), le compilateur nous produit un AST. Nous appliquons un visiteur sur cet AST pour nous produire du (le transformer en) SVG. Ainsi :

```
                                 +---------+
+-----------+                    | visitor |
| grammaire |---------+          +---------+
+-----------+         |               |
                      v               v
  +-------+      +----------+      +-----+
  | regex | ---> | compiler | ---> | AST |
  +-------+      +----------+      +-----+
                                      |
                                      v
                                  +-------+
                                  |  |
                                  +-------+

```

Premier exemple, nous allons *dumper* l'AST :

```
$ echo '[a-z]+' | \
      hoa compiler:pp --visitor dump hoa://Library/Regex/Grammar.pp 0
>  #expression
>  >  #quantification
>  >  >  #class
>  >  >  >  #range
>  >  >  >  >  token(literal, a)
>  >  >  >  >  token(literal, z)
>  >  >  token(one_or_more, +)

```

Et maintenant, nous appliquons notre propre visiteur `Hoathis\Regex\Visitor\Visualization` :

```
$ echo '[a-z]+' | \
      hoa compiler:pp \
          --visitor-class Hoathis.Regex.Visitor.Visualization \
          hoa://Library/Regex/Grammar.pp \
          0

```

À toi de jouer !

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c7a02f4c71a333e556bfa36e95f90033ca55b16133d79eaa1e2f2c7b037acaa5?d=identicon)[davidkuhner](/maintainers/davidkuhner)

---

Top Contributors

[![davidkuehner](https://avatars.githubusercontent.com/u/4901327?v=4)](https://github.com/davidkuehner "davidkuehner (42 commits)")

### Embed Badge

![Health badge](/badges/davidkuhner-regex/health.svg)

```
[![Health](https://phpackages.com/badges/davidkuhner-regex/health.svg)](https://phpackages.com/packages/davidkuhner-regex)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
