I would like my Hack code to be broken down to Abstract Syntax Tree. Please advise me on available tools/libraries/github repositories which will help me to parse Hack code into AST. I have found "h2tp" (hack to php transpiler written by Facebook), however it doesn't parse the code into AST. I also tried this project which does what I want however it is not recognising many of the operators and requires a significant rework, which will quite a lot of time to do.
Parsing Hack code into Abstract Syntax Tree
605 Views Asked by Adel Maratova At
2
There are 2 best solutions below
2
fjsnogueira
On
hhast (HHAST: Low-Level AST Library) lets you do that, you may invoke hh_parse like this : hh_parse --full-fidelity-json $file | jq
taken from (https://github.com/hhvm/hhast/blob/master/docs/ast-lib.md)
Related Questions in ABSTRACT-SYNTAX-TREE
- Generate C++ style code using LLVM
- How to traverse all nodes of clang AST?
- deleting a if statements using ASTParser from a given .java file
- is there there way to access stylus AST
- JDT AstParser - How to get Assignment (parent) from MethodInvocation
- Obtaning the AST of JavaScript code from Spidermonkey
- Three-address code and symbol tables
- Alternate way to read a file as json using python
- HQL unexpected AST node:unexpected AST node:
- How can I evaluate a list of strings as a list of tuples in Python?
- Parse Python Function's Class Name
- Custom Lint for Java / Android Report if we find a class call without implementing its interface
- How can I detect by static analysis, if a project is using Java8?
- Is it possible to work with AST inside D code?
- Java Runtime Compiling within scope
Related Questions in STATIC-ANALYSIS
- How to detect functions, that are only called from unused functions using cppcheck?
- Use static analysis tools to check null pointers and memory leaks in Linux device drivers
- Why it is not suggested to pass hardcoded absolute path name to File object constructor File(String)
- Visual Studio - Discover if method is called by another method at some point
- False positive: precondition is redundant
- Cppcheck GUI: Excluding a file or folder from checking
- How to get better results from LLVM's MemoryDependenceAnalysis pass?
- How to enforce static imports for some methods using checkstyle?
- Dealing with code movement when comparing static analysis reports
- Is there a way to find the ignored JUnit Test with the most lines of code in a large codebase?
- JSHint in javascript is not showing all warnings for code to be corrected
- Parsing Hack code into Abstract Syntax Tree
- Understanding x86 r/m32 instruction
- LLVM Error When Using a Pass from Another Pass
- Sonar - Python plugin rules, what tools it uses behind?
Related Questions in HACKLANG
- How to Implement Singleton Pattern without Nullable
- Check if a variable is convertible to a string in Hacklang
- Parsing Hack code into Abstract Syntax Tree
- No Hack typechecker coverage for PHP functions
- Hacklang — does this type error involving `this` suggest that the underlying object type matters?
- Converting a collection of Awaitables to a time-ordered AsyncGenerator in Hack
- Hacklang — Is there a reason why ConstIndexAccess is invariant on Tk?
- What is "Transformable" in Hack language?
- Hacklang async code example?
- Start Python asyncio courutines execution immediately
- Modeling Nested Data using Hack OR PHP
- What kind of string representation is this?
- how to fix this HH FIXME [4410]?
- Change the value of a lexically scoped variable in a HHVM/Hack lambda expression?
- Running hh_client on one file hangs forever
Related Questions in TRANSPILER
- Parsing Hack code into Abstract Syntax Tree
- Typescript project setup (first time)
- Transpiling to C vs C++ : range of CPU instructions
- Import a custom element in javascript
- Transpiling or not transpiling Polymer 2 applications?
- Does React Native use Babel by default or is it just one option?
- APL language compiler to IL
- How run text-to-svg on browser?
- How to pack Typescript module into one js module
- Vuetify blank display using the Edge browser
- Transpile Arrow Functions into Named Functions without Variable Assignment
- Closure Compiler - best practice for JavaScript library projects?
- Ducktape rust to c compiler via assembly?
- Is there a difference between compiling for Windows 32-bit and Windows 64-bit in TMS Web Core Websites?
- Background image path problem in Scss when built in Vite
Related Questions in PHP-PARSER
- Parsing Hack code into Abstract Syntax Tree
- Parsing conditions in a custom DSL using a tokenizer
- How to get variable value using Nikic/PHPParser
- Simple HTMLDom - i'm confused
- php different html parsing results on local and live server
- PHP-Parser: Pretty printing multi-line arrays
- Check whether variable is defined using nikic/php-parser
- Limitations of PEG grammar & parser generators?
- Is it possible to parse PHP using PEG?
- How can i parse php functions from JSON string variable?
- Regex to match a result that isn't single line and expanded across multiple lines
- Markdown - PHP parser
- PHP: Any way to parse a php file with 'yield' in old versions
- How to get variable name and value in AST
- fetch data from elements with same id in a HTML document
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The HHVM itself provides a lot of tools to dump the structure of a PHP file. However, the AST dump was removed: https://github.com/facebook/hhvm/issues/1268
What you can do is dump the HHVM assembly language: http://hhvm.com/blog/6323/the-journey-of-a-thousand-bytecodes
HHVM also has a PHP transpiler which may help:https://docs.hhvm.com/hack/tools/transpiler
You could also try to port this extension over to the HHVM: https://github.com/nikic/php-ast