Skip to content

jamestiotio/compstruct-vscode

Repository files navigation

compstruct-vscode

VSCode Extension for Computation Structures Courseware (jsim, tmsim, bsim)

Installation

You can install this extension from the Visual Studio Code Marketplace or from the Open VSX Registry!

Description

This repository hosts a Visual Studio Code extension with rich language support for the courseware used in the (labs of) Computation Structures module (both MIT 6.004 and SUTD 50.002): jsim, tmsim and bsim.

These tools were originally developed by MIT:

  • JSim is a netlist simulator language which serves as a circuit simulator design environment.
  • BSim is a Beta ALU architecture simulator. The β is a RISC processor design (general-purpose 32-bit architecture) used for the course.
  • TMSim is a Turing Machine simulator.

Features

Currently available features:

  • Syntax Highlighting
  • Code Navigation (Folding)
  • Code Formatting (Comment Toggling, Auto-Indentation, Bracket-Matching, Bracket-Autoclosing & Bracket-Autosurrounding)
  • Snippet Completion (Auto Code Completion)
  • One click to run current file in JSim/BSim
  • Commands to run current file in JSim/BSim

Features in the works:

  • Semantic Highlighting
  • Linting (Syntax & Style Error Checking)
  • Refactoring
  • Debugging
  • IntelliSense (Hover Information, Parameter Info, Auto-Completion & Content Assist)
  • Code Navigation (Definition Jumps)
  • Language Configuration

You can request for more features by submitting an issue!

Feel free to also contribute via submitting a pull request! For contributors, please check the included tool documentations in the docs folder for your reference when further developing this extension!

Requirements

This section will describe any requirements and dependencies for this extension, as well as how to install and configure them for this extension to work properly.

Currently, only Microsoft Visual Studio Code (or its vendor-neutral open-source alternatives) is needed to run this extension. As more features are added to this extension, more requirements might be needed in the future, so do keep a lookout!

Extension Settings

The extension contributes the following settings (configuration):

  • compstruct-vscode.statusBarButton.JSim: Enable/Disable 'Run JSim' button in status bar
  • compstruct-vscode.statusBarButton.BSim: Enable/Disable 'Run BSim' button in status bar
  • compstruct-vscode.popups.findJarNotification: Show/Hide information message when finding .jar files

Known Issues

This section will call out known issues to help limit users opening duplicate issues against this extension.

JSim Continuation Lines Detection Issue

Multiline detection which spans across newline characters (and indicated by lines starting with the character +) might not be supported yet by the TextMate grammar engine as elaborated here. To add support for this feature, might need to migrate to Monarch instead of TextMate or implement a more sophisticated, real-time detector using TypeScript. Dynamic programmatic analysis could also be done via implementing a language server (which would be the ideal choice going forward, instead of simply only relying on declarative features).

Syntax Highlighting for Negative Numbers

More work needs to be done since attempts of using regular expressions to syntax-highlight negative numbers (i.e. including the hyphens) did not work as intended.

Additional Resources

Here are some available useful resources (such as syntax highlighting for other editors and official MIT source code for JSim, BSim and TMSim online editors):