-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use AST #109
Draft
pherrymason
wants to merge
140
commits into
main
Choose a base branch
from
search_on_astB
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Use AST #109
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Convert lambda declaration.
Complete ternary_expression test
…ferent choices and/or a sequence of nodes.
Signed-off-by: Nikita Pivkin <[email protected]>
… field). Improve "Find enum member in same module" scenario so it actually challenges the algorithm by placing trap declared before desired result.
…e detected on it. Added test to find cursor on struct interface.
Parse struct declarations as ast.GenDecl.
AST generation: Work with Module pointers instead to avoid copying their content everytime a module is passed to a function. Search: Support finding symbols that their identity contain explicit module resolution.
pherrymason
force-pushed
the
search_on_astB
branch
from
January 28, 2025 17:27
6757eab
to
6a44383
Compare
@PgBiel , I'm interested in the design of the ast nodes and how symbols are now indexed. |
Thanks. I'll probably stay off for several days now, but I'll try to take a look at a later date and give you some feedback. 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Treesitter is used to obtain a structured representation of source code, which has been utilized to extract symbol declarations.
So far, Treesitter has been used to parse the source code to analyze and obtain a structured representation of the code: Context Syntax Tree (CST). The CST, also known as the Parse Tree, contains all the elements that are part of the text (spaces, brackets, etc.).
Although the CST can be navigated to analyze the code, it contains too much information about the language's syntax, making certain tasks more challenging.
On the other hand, using an AST (Abstract Syntax Tree) would allow working with a simpler structure that more accurately reflects the program's logic.
Strategy
Continuing to use Treesitter as a parser simplifies a large part of the work, as there is currently no other ready-to-use parser available.
One option is to convert the CST generated by Treesitter into an AST.
Subsequently, by using the Visitor pattern, it would be possible to implement different analyzers:
TODO
def
#105distinct
types (Supportdistinct
types #107).