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
610 views Asked by Adel Maratova At
2
There are 2 answers
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
- Javascript to Java
- Resolve complex types using Typescript AST
- AST matcher for C++ #include
- How to parse and group hierarchical list items from an unindented string in Python?
- How can I parse the standard Go package and print all constant variables?
- How to share lexical environment with recursive functions in a custom interpreter?
- How can I use custom grammar with the ast-grep Python API?
- Adding new enumerators to an Enum specifier using CDT ASTRewrite
- library to generate embedding of each line of java file and embeddings must contain ast information
- the expressionType and includePath of CDT parser
- Why Golang ast.Field can have multiple names?
- How to find ast dictionary item in Python using xpath-like expressions
- python multiprocessing locks inside async function
- How to find all function calls a defined function makes? (including recursive and futher down the stack calls)
- Changing the format of data in Python
Related Questions in STATIC-ANALYSIS
- Ansible role analysis with Checkov - facts evaluation?
- Flutter SonarQube: "The main branch has no lines of code."
- the expressionType and includePath of CDT parser
- Adding entry to program header table
- Static checker that number of arguments to python logging matches number of placeholders
- Why am I getting this error when using dataflow in Codeql
- How to disallow exception to curly_braces_in_flow_control_structures linter rule in dart?
- Security scan flagged local variable for heap inspection in C Function
- Is it possible to use Eclipse JDT static analysis for null annotations when compiling from the command line?
- Remove directory from sonar analyzer
- Sonar qube issue in using aes-256-cbc algoritm, stating Make sure that encrypting data is safe here
- Programming language/library that uses dataflow analysis to fetch only required data from the database
- Export comments from Fortify Software Security Center
- Changing lint configuration based on Cargo profile
- Can I reproduce eslint's "prefer-object-spread" rule using ast-grep?
Related Questions in HACKLANG
- Hack, HHVM, MySQL: cancelling while connecting
- timeout for async calles in Hack
- Regex to match all occurrences of pipe operator (|>) expressions in hacklang
- How to convert Unicode codepoint to UTF-8 Hex Bytes?
- How to instantiate a shape type object in hacklang
- Reading nested dictionaries in PHP / Hack
- Hacklang async function seems to be blocking
- Concurrent block in hacklang
- "zsh: illegal hardware instruction hhvm" when running Hackland on VSCode, Macbook Pro M1
- HHVM Library Not Loaded MacOS
- Visual code debugger adapter immediately dies when trying to connect to vscode-hack debugger in local launch mode
- async function as type in hacklang
- How can I deprecate a class on hacklang?
- Builtin for checking if vec contains specified element
- running minimal app with xhp-lib v4 and hhvm v 4.81.1 throws error
Related Questions in TRANSPILER
- Javascript to Java
- Possible to render .vue single file components without transpiling?
- How to handle paths for transpiled JS?
- Parcel doesn't transpile the code without .babelrc configuration file
- Adding my own transpiled file format to Typescript imports
- Is transpling python library to javascript feasible and good approach to share data between multilanguage components?
- Not all compiled files go to the output main.js
- TRANSLOCO ISSUE: TranslocoService -> InjectionToken TRANSLOCO_TRANSPILER -> InjectionToken TRANSLOCO_TRANSPILER]:
- C code generated by Zig fails link stage due to missing functions (soft-float)
- Make Next.js 13 application run in old browser like Chrome 33
- Background image path problem in Scss when built in Vite
- Is there a difference between compiling for Windows 32-bit and Windows 64-bit in TMS Web Core Websites?
- Ducktape rust to c compiler via assembly?
- C# Harmony Transpiler null field exception for one of two nearly identical calls
- Transpile dynamic import with tsc?
Related Questions in PHP-PARSER
- Need help invoking a rust library with Typescript in Tauri
- Regex to match a result that isn't single line and expanded across multiple lines
- How to use Nikic/PHP-parser to extract HTML tags from PHP files
- Modify an array variable inside php file with Nikic PhpParser [php]
- Nipper studio XML parser
- How can i parse php functions from JSON string variable?
- Check whether variable is defined using nikic/php-parser
- PHP-Parser: Pretty printing multi-line arrays
- How to get variable value using Nikic/PHPParser
- How to hide attributes in PHP-Parser
- How to get variable name and value in AST
- How to traverse PHP source code which have If condition
- When using token_get_all(), how do I determine if a "lonely" T_STRING is a function call, a constant or something else?
- How to get the index of global variables in PHP-Parser
- How to use PHP-Parser to get the global variables name and change it
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?
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)
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