Git Product home page Git Product logo

onlinectutor's Introduction

CTutor

The CTutor is a variant of python tutor

License

BSD licensed.

How to Run

CTutor/ is the source code running in the server, which will generate an js file. This js file contains the trace information which will be used by the frontend js engine to render.

To run it:

$ cd CTutor

$ ./c_tutor.py < hello.c > index.js

put index.js to the python tutor js/ directory, so that the front end could render it.

During c_tutor.py running, all the temporary files will be stored in /tmp/ directory. And in the local dir, there will be a log file named CTutor.log generated to give log information during c_tutor.py running.

Prerequest

llvm, clang, lldb, and all the py-binding.

To run the FE, your running env should also statisfy the requirements of python-tutor.

Files

In case for CJK (Chinese, Japanese, Korean) characters, all the intermediate and src file should be encoded as UTF-8 file. CTutor currently contain the following files.

  • c_tutor.py : The main entry to run the CTutor.
  • Trace.py: The class used to call lldb to generate the trace, and put it in a js file.
  • Trace_test.py: Unit test for trace generator, currently still under development.
  • Makefile_buildlib: Makefile used to generate the library used for heap memory management. We need to get information about the malloc, alloca and free function call. It is used to generate libsample.so by running $make -f Makefile_buildlib
  • sample.c: The source code for a self-defined malloc/alloc/free function.
  • hello.c: An example code used to generate js.

TODO

  • DONE: More unit tests to make the whole CTutor work during the more development

  • more testcase from the Mengma C language class test.

    • DONE: CJK Chars support
  • How to display pointers

  • Support for stdin input operation, such as scanf

  • DONE: Support for floating point numbers

  • Support for array

    • DONE: Array in stack frame
  • Array in global scope

  • Support for large strings

  • DONE: Adjust the tempoary file path layout according to the discussion with Danny.

    • source code and output js all stored in files, do not use stdin/stdout anymore
    • source code in a subdir of /tmp
    • generated code in another subdir of /tmp
  • Display the variable based on the live scope, not display it all the time.

  • BUG: CTutor sometimes crashes

    • When running the small testcase, sometimes CTutor does not generate full trace, but only part of the trace. we need to findout why.
  • FE adjustment:

    • test/0006: For complex array display, The render frame still have display problem, the array displayed is out of the box range.

Unexpected behaviors ---_--

  • printf string without \n: newline character will be used to flush the stdout to the terminal, therefore if the printf string does not end with \n, the string will not be immediately output to the console. See testcase No. 0000.
  • When deploy on Aliyun Cloud, LLDB will suffer an run fail issue in _start function after loading the binary and start to run it

onlinectutor's People

Contributors

dc951015 avatar orthographic-pedant avatar

Stargazers

Boyang Yang avatar Ernst Salzmann avatar  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.