All Projects → viraptor → Phply

viraptor / Phply

Licence: other
PHP parser written in Python using PLY

Programming Languages

python
139335 projects - #7 most used programming language
language
365 projects

Labels

Projects that are alternatives of or similar to Phply

allot
Parse placeholder and wildcard text commands
Stars: ✭ 51 (-83.06%)
Mutual labels:  parsing
CalPack
Packets in Python Simplified
Stars: ✭ 19 (-93.69%)
Mutual labels:  parsing
Creek
Ruby library for parsing large Excel files.
Stars: ✭ 270 (-10.3%)
Mutual labels:  parsing
parse-md
Parse Markdown file's metadata from its content
Stars: ✭ 15 (-95.02%)
Mutual labels:  parsing
Compositional-Generalization-in-Natural-Language-Processing
Compositional Generalization in Natual Language Processing. A roadmap.
Stars: ✭ 26 (-91.36%)
Mutual labels:  parsing
Stringsareevil
Reducing memory allocations from 7.5GB to 32KB
Stars: ✭ 260 (-13.62%)
Mutual labels:  parsing
php.json
A library for simplifying JSON linting and validation.
Stars: ✭ 59 (-80.4%)
Mutual labels:  parsing
Semver
Semantic version parsing and comparison.
Stars: ✭ 283 (-5.98%)
Mutual labels:  parsing
ofxgo
Golang library for querying and parsing OFX
Stars: ✭ 96 (-68.11%)
Mutual labels:  parsing
Nearley
📜🔜🌲 Simple, fast, powerful parser toolkit for JavaScript.
Stars: ✭ 3,089 (+926.25%)
Mutual labels:  parsing
python-hslog
Python module to parse Hearthstone Power.log files
Stars: ✭ 37 (-87.71%)
Mutual labels:  parsing
literator
📝 Generate literate-style markdown docs from your sources
Stars: ✭ 55 (-81.73%)
Mutual labels:  parsing
Angourimath
Open-source symbolic algebra library for C# and F#. One of the most powerful in .NET
Stars: ✭ 266 (-11.63%)
Mutual labels:  parsing
rest-query-parser
Query Parser for REST
Stars: ✭ 29 (-90.37%)
Mutual labels:  parsing
Ldetool
Code generator for fast log file parsers
Stars: ✭ 273 (-9.3%)
Mutual labels:  parsing
tools-python
A Python library to parse, validate and create SPDX documents.
Stars: ✭ 65 (-78.41%)
Mutual labels:  parsing
inmemantlr
ANTLR as a libray for JVM based languages
Stars: ✭ 87 (-71.1%)
Mutual labels:  parsing
Gval
Expression evaluation in golang
Stars: ✭ 297 (-1.33%)
Mutual labels:  parsing
Serpent
A protocol to serialize Swift structs and classes for encoding and decoding.
Stars: ✭ 281 (-6.64%)
Mutual labels:  parsing
Nlpython
This repository contains the code related to Natural Language Processing using python scripting language. All the codes are related to my book entitled "Python Natural Language Processing"
Stars: ✭ 265 (-11.96%)
Mutual labels:  parsing

phply

phply is a parser for the PHP programming language written using PLY, a Lex/YACC-style parser generator toolkit for Python.

Why?

Good question. Because I'm crazy. Because it seemed possible.

Things I'm interested in doing with it:

  • Converting PHP code to Python
  • Running PHP templates in a Python environment
  • Learning more about parsing "industrial" languages, warts and all

What does it stand for?

  • phply -> PHP PLY
  • phply -> PHP Hypertext Preprocessor Python Lex YACC
  • phply -> PHP Hypertext Preprocessor Hypertext Preprocessor Python Lex Yet Another Compiler Compiler
  • (... to be completed ...)

How do you pronounce it?

If you're conservative, it's pronounced "pee aich ply". If you're liberal, it's "fiply". And if you're anarchist, pronounce it however you want. Who am I to tell you what to do?

What's working?

  • Lexer matching the standard PHP lexer token-for-token
  • Parser and abstract syntax tree for most of the PHP grammar
  • Script to convert PHP source to JSON-based ASTs
  • Script to convert PHP source to Jinja2 source (experimental)

What's not?

Some things can't be parsed yet. They are getting fewer by the day, but there is still a fair amount of work to do:

  • Labels and goto
  • Some other stuff, probably

Who's working on it?

See the AUTHORS file.

Troubleshooting

Couldn't create 'phply.parsetab'

Phply relies on ply to generate and cache some tables required for the parser. These have been generated with the latest available version of ply for the phply release. If you installed phply under a different user and a new ply was released, the parsetab file cannot be automatically updated. Your options are to:

  • raise an issue for phply
  • rebuild the package yourself

How do I use it?

  • Lexer test: python phply/phplex.py
  • Parser test: python phply/phpparse.py
  • JSON dump: cd tools; python php2json.py < input.php > output.json
  • Jinja2 conversion: cd tools; python php2jinja.py < input.php > output.html
  • Fork me on GitHub and start hacking :)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].