Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Harmonisation de code avec PHPStorm et ANTLR

Thierry
August 27, 2019

Harmonisation de code avec PHPStorm et ANTLR

Découvrons comment il est possible de s'appuyer sur le projet ANTLR et des plugins de PHPStorm (tels que PHP Inspections) afin de réduire le nombre d'opérations manuelles servant à assainir une base de code écrite en PHP.

Références connexes

- PHP Inspections : https://plugins.jetbrains.com/plugin/7622-php-inspections-ea-extended-/versions
- Exemple en Python : http://j.mp/php-parsing-python
- Exemple en JavaScript : http://j.mp/php-parsing-javascript
- À propos d'ANTLR : https://www.antlr.org/
- Language Implementation Patterns : https://www.oreilly.com/library/view/language-implementation-patterns/9781680500097/
- nikic/PHP-Parser - PHP Parser : https://github.com/nikic/PHP-Parser
- rectorphp/rector - Upgrades / Refactoring : https://github.com/rectorphp/rector
- Compilers: Principles, Techniques, and Tools : https://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools
- Phases de compilation : https://json.weaving-the-web.org/#/structure-of-a-compiler/phases-of-a-compiler?peek=1

Thierry

August 27, 2019
Tweet

More Decks by Thierry

Other Decks in Programming

Transcript

  1. Harmonisation de < code /> avec PHPStorm et ANTLR ou

    comment ré-⌨ de manière moins fastidieuse 1/14
  2. Perspective de migration Montée de version (5.x -> 7.x) Présence

    de régularités ( anti-pattern ) ❄ Tâches répétitives ( refactoring ) ➡ Opportunités d'automatisation 2/14
  3. ANTLR pour manipuler AST ANother Tool for Language Recognition Grammaire

    de PHP ➡ Génération d'outils : Analyse ( Lexer , Parser , Listener ) Transformation ( Writer ) Génération possible en C#, langages s'appuyant sur la JVM (Java, Clojure, Kotlin, Scala...), JavaScript, Typescript, Python 7/14
  4. Références connexes PHP Inspections Python - http://j.mp/php-parsing-python JavaScript - http://j.mp/php-parsing-javascript

    ANTLR Language Implementation Patterns nikic/PHP-Parser - PHP Parser rectorphp/rector - Upgrades / Refactoring Compilers: Principles, Techniques, and Tools Phases de compilation 13/14