Skip to content
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

Add Visualization Tool for Clava #2

Merged
merged 41 commits into from
Jan 28, 2025
Merged

Conversation

Process-ing
Copy link
Contributor

@Process-ing Process-ing commented Jan 28, 2025

NOTE: This PR is a revamp of this one, in the Clava repository, and most of the things here are also referred in the previous PR.

Description

Closes #1. This PR adds a visualization tool that allows the visual mapping of the source code to the AST. This tool was develop on the context of the summer internship with topic "[CSE01] Visual Mapping of Source Code to Abstract Syntax Tree (AST)", from the INESC TEC Summer Internship 2024 programme.

To be precise, this PR creates the specialization of the tool for Clava. So, this PR must be merged before merging this one.

Changes Made

  • Added specializations of GenericVisualizationTool and GenericAstConverter, defined in the LARA API, that implements the needed operations for the Clava compiler.
  • Configured the base NPM project so that the tool can be used in a Clava project as an NPM package.

How Has This Been Tested

This was mainly tested manually.

To test the project, first do the setup described in Clava-JS (but using the staging branches in Clava and LARA). Then, clone the visualization tool's repositories, in the right branches:

git clone -b feature/ast-visualization https://github.com/specs-feup/lara-visualization.git
git clone -b feature/ast-visualization https://github.com/specs-feup/clava-visualization.git

Edit the base folder's package.json to the following:

{
  "type": "module",
  "workspaces": [
    "clava/Clava-JS",
    "lara-framework/Lara-JS",
    "lara-visualization",
    "clava-visualization"
  ]
}

Then, execute the following commands to finish the compilation procedure:

npm install
npm run build -w lara-visualization
npm run build -w clava-visualization
npm install

To run the tool, in the script fed to Clava, import VisualizationTool and call await VisualizationTool.visualize() on the point of execution where you want to analyze the AST. You can find more information in the README.

@Process-ing Process-ing requested a review from joaobispo January 28, 2025 19:33
@joaobispo joaobispo merged commit a458173 into main Jan 28, 2025
@joaobispo joaobispo deleted the feature/ast-visualization branch January 28, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move Clava AST Visualization to NPM Repo/Package
2 participants