Coder Social home page Coder Social logo

cs591l1_proj1's Introduction

Readme file

BNF Notation

program = statement
     | statement program
     
stmt = Assign(expr* targets, expr value)
  | Import(alias* names)
  | Expr(expr value)

expr = Dict(expr* keys, expr* values)
   | Set(expr* elts)
   | List(expr* elts, expr_context ctx)
   | Call(expr func, expr* args, keyword* keywords)
   | Num(object n)
   | Str(string s)
   | Tuple(expr* elts, expr_context ctx)

Methods I use

I use python as the host language. This subset of language support auto checking language type, reading in different kinds of data consisting of DataFrame, statically analyzing the whole memory of DataFrame use. I assume that in this subset of language, all the read-in data structure would be inputted into DataFrame as an argument.

For each cell in DataFrame, I assume it needs 8 bytes memory. I would count all the cells in the dataframe and ouput the final result. I would write pandas as pd in the following formulas. The operations I used in this project mainly include the following:

  1. read data from a list(pd.DataFrame([])).
  2. read data from a dict.
  3. read data from a csv file.
  4. read data from a tuple.
  5. use pd.concat() to connect two DataFrame together.

Algorithms

  1. Auto check the program

    I rewrite the methods in class NodeVisitor to check the program. This method would go through all of the ast to make sure the program only included import, data structure declaration and function call statement. And among function call, only methods in pd.DataFrame(), pd.read_csv(), pd.concat() are allowed.

  2. Remove additional print statement using ast.NodeTransformer

    Since this subset of language doesn't support print() function. This method would rewrite methods in NodeTransformer to change the structure of ast. This function would be called before we auto check the language type.

  3. Static analysis of the memory used by DataFrame

    I rewrite methods in the ast.NodeVisitor class to go through the ast. When encounter number or string, the program would add 1 to the total memory. The program would finally output the total memory.

cs591l1_proj1's People

Contributors

zhukaikang 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.