Skip to content

Commit

Permalink
Add virtual machine to run programs written in Go
Browse files Browse the repository at this point in the history
  • Loading branch information
chengda300 committed Jul 29, 2024
1 parent 66ae5cd commit 10b4033
Show file tree
Hide file tree
Showing 111 changed files with 47,043 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# go-slang
Implementation of Go

# Virtual Machine
The virtual machine is used to run programs written in Go. It is written by Teow Hua Jun and Lim An Jun and the source code can be found (here)[https://github.com/huajun07/go-virtual-machine].
Binary file added go-virtual-machine-main/.DS_Store
Binary file not shown.
17 changes: 17 additions & 0 deletions go-virtual-machine-main/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules/
build/

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
7 changes: 7 additions & 0 deletions go-virtual-machine-main/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# production
build

node_modules

# Ignore the parser generated by PeggyJS.
src/virtual-machine/parser/*.js
76 changes: 76 additions & 0 deletions go-virtual-machine-main/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"plugins": ["import", "simple-import-sort", "prettier", "testing-library"],
"extends": ["eslint:recommended", "prettier"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"extends": ["react-app", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser"
},
{
"files": ["*.stories.*"],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off"
}
},
{
"files": [
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)+(spec|test).[jt]s?(x)"
],
"extends": ["react-app/jest", "plugin:testing-library/react"],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off",
"no-multi-str": "off"
}
}
],
"ignorePatterns": ["build/**/*", "!.storybook", "tsconfig.json"],
"env": { "es6": true },
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
// Rules for auto sort of imports
"simple-import-sort/imports": [
"error",
{
"groups": [
// Side effect imports.
["^\\u0000"],
// Packages.
// Packages. `react` related packages come first.
// Things that start with a letter (or digit or underscore), or
// `@` followed by a letter.
["^react", "^@?\\w"],
// Root imports
// Shared imports should be separate from application imports.
["^(shared)(/.*|$)"],
["^(typings)(/.*|$)"],
[
"^(app)(/.*|$)",
"^(assets|theme)(/.*|$)",
"^(contexts)(/.*|$)",
"^(constants)(/.*|$)",
"^(hooks)(/.*|$)",
"^(utils)(/.*|$)",
"^(services)(/.*|$)",
"^(components)(/.*|$)",
"^(types)(/.*|$)",
"^(templates)(/.*|$)"
],
["^(pages)(/.*|$)", "^(features)(/.*|$)"],
// Parent imports. Put `..` last.
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
// Other relative imports. Put same-folder imports and `.` last.
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"]
]
}
],
"simple-import-sort/exports": "error",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error"
}
}
135 changes: 135 additions & 0 deletions go-virtual-machine-main/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
build/**/*

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Parser files generated by PeggyJS
src/virtual-machine/parser/**/*.js
src/virtual-machine/parser/**/*.js.map
1 change: 1 addition & 0 deletions go-virtual-machine-main/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.18.0
28 changes: 28 additions & 0 deletions go-virtual-machine-main/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

storybook-static
build-storybook.log

.storybook/preview-head.html
6 changes: 6 additions & 0 deletions go-virtual-machine-main/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "all",
"tabWidth": 2,
"semi": false,
"singleQuote": true
}
3 changes: 3 additions & 0 deletions go-virtual-machine-main/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode", "peggyjs.peggy-language"]
}
3 changes: 3 additions & 0 deletions go-virtual-machine-main/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.formatOnSave": true
}
Binary file added go-virtual-machine-main/CS4215_Project.pdf
Binary file not shown.
64 changes: 64 additions & 0 deletions go-virtual-machine-main/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Go-Virtual-Machine

Concurrent Virtual Machine for Go

## Introduction

This repository contains the following systems and services:

- [frontend](https://github.com/huajun07/go-virtual-machine/tree/main/src/frontend) - web interface for user to enter their code and observe the output and return values
- [virtual-machine](https://github.com/huajun07/go-virtual-machine/tree/main/src/virtual-machine) - Implementation of concurrrent virtual machine for Go

## Setting Up

### Dependencies (macOS)

You will need `npm` and `node` to install the dependencies.

```sh
brew install nvm
```

At the point of writing, `go-virtual-machine` uses `node v16.18.0`. We can run `nvm install` and `.nvmrc` will inform `nvm` with the appropriate version to install.

```sh
$ nvm install
$ node --version
# v16.18.0
```

We can now install the necessary dependencies.

```sh
# Install dependencies
$ npm install
```

# Local Development

## Run

```sh
$ npm run dev
```

## Testing

```sh
$ npm run test
```

# Deployment

Deploy by running

```sh
$ npm run deploy
```

## Code Tools

```sh
# Linting
$ npm run lint
```
Loading

0 comments on commit 10b4033

Please sign in to comment.