GithubHelp home page GithubHelp logo

a1liu / tci Goto Github PK

View Code? Open in Web Editor NEW
10.0 4.0 2.0 2.23 MB

Teaching C Interpreter

Home Page: https://tci.a1liu.com

License: MIT License

C 15.84% Rust 75.41% JavaScript 7.15% CSS 1.54% HTML 0.07%
c interpreter

tci's Introduction

Teaching C Interpreter

The goals of this compiler are:

  1. Provide better error messages for new programmers
  2. Make debugging C programs easier

Rationale

Learning C is hard. Students have to navigate pointers, segmentation faults, and bit manipulation, all while working without garbage collection, usually for the first time. This interpreter aims to address this problem by giving better error messages and more runtime diagnostic tools.

Features

  • Better debug information
    • Stack traces on segmentation fault
  • Harder errors: the following all cause a segmentation fault
    • use-after-free
    • buffer overflow
    • double free
    • out of memory
    • stack overflow
    • calling string functions with a string that isn't null-terminated

Todo

Lots of stuff left to do still.

Compiler

  • Const
  • Enums
  • Designated initializers
  • full support for #if
  • Better macro debug messages
  • Better parsing error messages
  • Hardening against invalid input
  • Unified error system

Runtime Environment

  • Leak detection: manual memory management is hard sometimes
  • Processes and threads: students often learn multithreading paradigms in C
  • Program arguments && Standard input - good functionality to have
  • unistd.h: because sometimes professors be like that
  • time.h: because sometimes you gotta do that
  • Variable/type information at runtime: allows student to use TCI as a debugger
  • Full kernel replayability: go backwards in time when using TCI as debugger

User Interface

  • Working file system explorer
  • Runtime file explorer
  • Terminal emulator (without shell)
  • Service worker for caching stuff locally
  • Github Issue/Bug-fix-request button
  • User interface for runtime/compiler options

Restrictions and Incompatibilities

  • Implicit types on functions will never be supported
  • Implicit function declarations will never be supported

Credit

  • TCI uses an error renderer plagiarised from codespan-reporting to make error messages.
  • TCI uses a parser plagiarized from lang-c to handle parsing the C language

tci's People

Contributors

a1liu avatar dwc291 avatar esilverm avatar kn99hn avatar santiagorendon avatar tangym27 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tci's Issues

Editor bugs

Editor is generally buggy, with highlighting being off and scrolling through large files being impossible

Breakpoints

We want to be able to insert a breakpoint at any point in the program.

Basic Debugger

Basic functionality to step forwards in code bit by bit using buttons.

Advanced Symbol Table Info at Runtime

Advanced symbol table information, like what variable is what type or where variables are located, is not available to the programmer at runtime.

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.