Giter VIP home page Giter VIP logo

syntax-tree-visualization's Introduction

ts Bugs Vulnerabilities Code Smells Lint Code Base

๐ŸŒณ Syntax Tree Visualizer

Syntax Tree Visualizer provides interactive environment for exploration of AST1 (abstract syntax tree) and SA2 (syntax array).

Features

  • Code editor with syntax checker
  • AST representation that updates as you type
  • SA representation that updates as you type
  • Highlighting of corresponding elements
  • Sharing your projects with others
  • Exporting to various formats

Supported languages

  • JavaScript

Demo

Demo

How to use

Simply type code in code editor and see how AST and SA change. For more information refer to documentation on the website.

Installation

All in one Docker container

docker run -p 8080:8080 -d --rm --name devast skril/stv:1.0-full

Development

Local setup

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

git clone https://github.com/InnoSWP/syntax-tree-visualization

For running the project you need the following requirements:

On macOS using Homebrew:

brew install git node
npm install yarn

On Arch Linux:

pacman -Suy nodejs npm git
npm install yarn
git submodule init
git submodule update

Using docker

docker run -p 8080:8080 -d --rm --name devast --mount src=/path/to/syntax-tree-visualization,dst=/app,type=bind skril/devast:archlinux

Important: change "path/to/syntax-tree-visualization" to the root directory of the project

Alternatively on UNIX operating systems:

docker run -p 8080:8080 -d --rm --name devast --mount src=$(pwd),dst=/app,type=bind skril/devast:archlinux

Local setup

Requirements:

Install dependencies

yarn

Build project

yarn build

Start server without building it on http://localhost:8080/

yarn start

Env vars: MYSQL_HOST=localhost;MYSQL_USER=root;MYSQL_DATABASE=swpbase;MYSQL_PASSWORD=12345
To start with them

export MYSQL_HOST=localhost export MYSQL_USER=root export MYSQL_DATABASE=swpbase export MYSQL_PASSWORD=12345; yarn start

Contribution

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Notable used tools

Links

Footnotes

  1. https://en.wikipedia.org/wiki/Abstract_syntax_tree โ†ฉ

  2. https://dl.acm.org/doi/10.1145/2935323.2935331 โ†ฉ

syntax-tree-visualization's People

Contributors

skril3366 avatar antony-sk avatar bavpnet avatar ananastya1 avatar levpen avatar uzifam avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar Muwaffaq imam avatar Mohamad Al Mdfaa avatar Nursultan Askarbekuly avatar  avatar  avatar

Forkers

antony-sk levpen

syntax-tree-visualization's Issues

Export to various formats

User story

As a user I want to see general information about project and contacts of the developers so that I can understand purporse of this web site and contact if I encounter any bugs

Acceptance criteria

Fully implemented:

  • Export to SVG
  • Export to LaTeX
  • Export to Graphviz
    Web site contains buttons for exproting to all this formats

Tests

Acceptance cirteria:

  • Integration of jest framework
  • Write tests for all backend components
    • AST
    • SA
    • Controllers

AST builder

Acceptance criteria

    • Given code of the program in JavaScript build corresponding AST save it as json

Share by link

User story

As a user I want to share web page by link so I can save the result and share it with others

Acceptance criteria

  • Sharing by link is fully implemented
  • Web page has button for sharing

Adaptive design

Think how it should look like on different screes:

  • Ultra wide
  • 3:4
  • Different scaling

Fold constant expressions

User story

As a user I want to be able to fold constant expressions so that I can understand how it works in real compilars

Acceptance criteria

User is able to fold all the constant expressions under specified node

Friendly UI

User story

As a user I want to see friendly interface so its easy to work with web site

Acceptance criteria

Completed design of the app:

  • Color pallet
  • Animations
  • Fonts

Live syntax checker

User Story

As a user I want to have live syntax checker in code editor so it is easier for editing

Acceptance criteria

  • Code editor has syntax checker

Help page

User story

As a user I want to see general information about project and contacts of the developers so that I can understand purporse of this web site and contact if I encounter any bugs

Estimation of effort

TBD

Acceptance criteria

  • Pop up window with general information is available and contains link to GitHub repository of the project
  • Button for toggling this pop up window

Code editor

User story

As a user I want to have an ability to edit the code so that I can see changes in syntax tree and array

Acceptance criteria

Given: I'm a user on the main page of the app
When: I want to edit the code
Then: I can edit the code, see syntax highlighting and syntax errors

Basic AST viewer

Acceptance criteria:
Given: I'm a user on the main page
When: I want to see AST of the code
Then: I see AST of that code

SA viewer

User story

As a user I want to see syntax array view so I understand its properties

Acceptance criteria

Acceptance criteria:
Given: I'm a user on the main page
When: I want to see SA of the code
Then: I see SA of that code

Display additional information about node in AST

User story

As a user I want to see additional information about the node so I can understand its properties

Additional information

Decide how to show additional information(or):

  • Hover over node
  • Click on the node and select this option in drop down menu

Acceptance criteria

Given: I'm the user on the main page
When: I hover over the node
Then: I see meta data of that node

Highlighting of corresponding elements

User story

As a user I want to see highlighting of corresponding elements (code block, tree node and array) element if hovering over any one of them so its easier to compare different represenations

Acceptance criteria

  • Hovering over code block/tree node/array entry highlights it and corresponding elements in remaining representations

Live rebuilding of AST and SA

Acceptance criteria:
Given: I'm a user on the main page
When: I change code in code editor
Then: AST and SA rebuild dynamically as I change code

Interactive tutorial

User story

As a user I want to see interactive tutorial so I can understand all the features of the web site I'm using

Acceptance criteria

Interactive tutorial covers all functionality of the project:

  • Code editor
  • Syntax tree and array view
  • Sharing and general information about project

Code highlighting

User story

As a user I want to see code highlighting so its easier to write code

Acceptance criteria

Editor has code hilighting

Full screen AST & SA view

User story

As a user I want to be able to open graph and array view in the full screen so that I can explore them in more detail

Acceptance criteria

Full screen option is implemented for

  • Both graph and array view
  • Only graph view
  • Only array view
  • Buttons for all this options

Programming language selection

User story

As a user I want to have an ability to select languages in code editor so that I can choose language that serves my needs

Acceptance criteria

  • Ability to change language and fully work with it
  • Button for choosing language

Move nodes in the AST

User story

As a user I want to be able to drag and drop nodes in the graph view so that code changes

Acceptance criteria

User is able to:

  • Move nodes to some appropriate places
  • Move subtree to some appropriate places

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.