php-rust-tools / parser

A handwritten fault-tolerant, recursive-descent parser for PHP written in Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reflection

ryangjchandler opened this issue · comments

Something I've experimented with a little bit is a reflection API provided by the parser.

You provide it a generated AST (or multiple ASTs) and the struct is able to traverse the AST to search for function declarations, classes, etc.

You would then be able to call methods on the struct to find a particular class, function, get type information, params etc.

This would do a lot of heavy lifting for static analysis tools, dead code finders, interpreters etc.

reflection can be a whole different project in it's own repository.

it is possible to build a reflection system from AST, see https://github.com/Roave/BetterReflection for reference.

yeah, whether its part of this repo or not, doesn't bother me. just noting down ideas surrounding the parser

Not related to parser, closing.