Giter VIP home page Giter VIP logo

dependence's Introduction

Dependence

Accepts a series of assignment statements, generates and visualizes the dependency between the variables from the code. This is a personal learning tool to understand how the "greying out variables" feature in many IDEs like VSCode or Atom works.

Representation of a Generated Graph

Requirements and Setup

  • Python 3.8+
  • matplotlib==3.4.1
  • networkx==2.5.1

To setup to run this project, create a virtual environment and install the dependencies:

% python3 -m venv env
% env/bin/pip install -r requirements.txt
% source env/bin/activate

This should set up a virtual environment in which you can run your project.

Usage

The program can be invoked as follows:

% python3 main.py [path/to/file]

This should return on the command line a list of directed edges as generated by parsing the program, and a new window with the graph visualised.

Input Format

The file taken as input requires very specific formatting. Currently, dependence can only handle the visualization of simple assignment statements. Thus, it accepts a block of assignment statements, formatted as follows:

a = 3;
b = 2 + a;
c = a + b;
d = c - 1;

Note that all assignment statements except the last one must be terminated by a semi-colon. Also note that assignments can be simple value assignments or binary operations.

Contributing

This project is open to contributions! There is lots still to be done โ€” to name a few tasks:

  • adopting the grammars of popular languages rather than developing our own, to make the tool more usable
  • support for functions, function call, and scopes
  • support for project-wide analysis, rather than single-file

If you're interested in helping out, feel free to start a PR!

dependence's People

Contributors

somaniarushi avatar

Watchers

 avatar

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.