https://github.com/evnix/go-php-parser
simple php parser written in GO
https://github.com/evnix/go-php-parser
Last synced: 10 months ago
JSON representation
simple php parser written in GO
- Host: GitHub
- URL: https://github.com/evnix/go-php-parser
- Owner: evnix
- License: bsd-3-clause
- Created: 2015-08-28T17:50:08.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-08-28T17:53:51.000Z (almost 11 years ago)
- Last Synced: 2025-05-02T13:46:04.423Z (over 1 year ago)
- Language: PHP
- Size: 4.83 MB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
php
===
Parser for PHP written in Go
## Project Status
This project is under heavy development, though some pieces are more or less stable. Listed here are components that in progress or are ideas for future development
Feature |Status
------------------------------|------
Lexer and Parser | mostly complete. there are probably a few gaps still
Scoping | complete for simple cases. probably some gaps still, most notably that conditional definitions are treated as if they are always defined
Code search and symbol lookup | basic idea implemented, many many details missing
Code formatting | basic idea implemented, formatting needs to narrow down to PSR-2
Transpilation to Go | basic idea implemented, need follow through with more node types
Type inferencing | not begun
Dead code analysis | basic idea implemented, but only for some types of code. Also, this suffers from the same caveats as scoping
## Project Components
Directory |Description
------------------------------|------
php| the core parser
php/ast| (abstract syntax tree) describes the nodes in PHP as parsed by the parser
php/ast/printer| prints an ast back to source code
php/cmd| a tool used to debug the parser
php/lexer| reads a stream of tokens from source code
php/passes| tools and packages related to modifying or analyzing PHP code (heavily a work in progress)
php/passes/togo| transpiler
php/passes/deadcode| dead code analyzer
php/query| tools and packages related to analyzing and finding things in PHP code (heavily a work in progress)
php/testdata| simple examples of PHP that must parse with no errors for tests to pass
php/token| describes the tokens read by the lexer
original fork: https://github.com/stephens2424/php