FalkorDB / code-graph

https://code-graph.falkordb.com
MIT License
9 stars 4 forks source link

Request for Guidance on Code Graph Generation Tool Used in FalkorDB #90

Open programmerraja opened 3 weeks ago

programmerraja commented 3 weeks ago

Hello @gkorland

I hope this message finds you well.

I recently came across FalkorDB while researching methods to convert codebases into graph formats. I was impressed by your project and its capabilities. I am very interested in understanding how you generate the code graph used in your repository.

Could you please provide guidance on the tools and methodologies you employed for creating these code graphs? Any insights or recommendations would be greatly appreciated.

Thank you for your time and assistance.

swilly22 commented 3 weeks ago

Hi @programmerraja, I'm glad to learn you've found this project interesting, I believe the best way to learn how we've created graphs from source files is to review the source code.

But in broad strokes you should know we're:

  1. Cloning a Github repository (to get the actual source code)
  2. Use tree-sitter to parse source code into AST
  3. Taken action when an AST node of interest is encountered e.g. when a Function AST node is discovered we take the appropriate action to create a Function entity within the graph we're constructing.

Would you mind sharing some details on your project, what it is your trying to achieve?

We're thinking on:

  1. Turning this demo into a library / service one could use to generate "code-graphs"
  2. Support additional programming languages.
programmerraja commented 3 weeks ago

@swilly22 Thank you for your response.

Our project is dedicated to the development of a chat bot tailored for assisting users with queries pertaining to our codebase. We envision a platform where users can seamlessly seek clarification and guidance on various aspects of our code.

In pursuit of this objective, we are keen on exploring methods to convert our codebase into graph representations, facilitating easier comprehension and interaction within the chat bot interface. Your project, FalkorDB, has caught our attention due to its commendable capabilities in code graph generation.

We understand the value of open-source collaboration and would greatly appreciate access to your codebase (code to graph) if it is open source. However, if this is not possible, we are prepared to diligently follow the steps outlined in your methodology to develop our own code-to-graph conversion solution.

Thank you once again for your consideration.

swilly22 commented 2 weeks ago

@programmerraja the repository is open for the public, we'll be happy to collaborate.

programmerraja commented 2 weeks ago

@swilly22 Thank you for your prompt response and willingness to collaborate.can i know the repo for creating graph from codebase

swilly22 commented 2 weeks ago

For the time being this is the repo.

programmerraja commented 2 weeks ago

@swilly22 yep but the code for converting code to graph (parse) is in binary format how can i view the original code of the parser without binary

swilly22 commented 2 weeks ago

This project uses tree-sitter as its parser, the parser itself is compiled to binary and we're using it as is to create an AST and traverse it while extracting relevant information such as Classes, Functions and Modules.

Although there are multiple options when it comes to parsers e.g. Antler, YACC, LEG/PEG we've decided to go with tree-sitter due to its bindings and richness variety of grammar files.