-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add virtual machine to run programs written in Go
- Loading branch information
1 parent
66ae5cd
commit 10b4033
Showing
111 changed files
with
47,043 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
16.18.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"trailingComma": "all", | ||
"tabWidth": 2, | ||
"semi": false, | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["esbenp.prettier-vscode", "peggyjs.peggy-language"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"editor.formatOnSave": true | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
Oops, something went wrong.