Skip to content

Commit

Permalink
* VM-01: Implemented memory allocator for vm
Browse files Browse the repository at this point in the history
    * VM-01: Finished basic memory allocation

    * VM-01: Fleshed out memory.test.cc, found and fixed bugs in generateMemoryBlock

    * VM-01: Wrote boilerplate for memory

    * VM-01: Adding basic support for number types

    * VM-01: Working on baseType

    * VM-01: Added License and headers to files

    ASM-01: Commented out write object for now

    ASM-01: Finished basic parsing and creation of intermediate state, brought assembler all the way to writing files (but not quite there)

    ASM-01: Wrote new tests for assembler, got first instructions compiling to intermediate structure

    Fleshed out some documentation for the VM and Assemblers

    ASM-01: Removed bloat from test for print_str instruction, fixed bug in extracting operands

    Properly displaying assemblyLine structs

    ASM-01: Finished extraction of strings in assembly code, made further progress on asm parser.

    ASM-01: Fleshed out the parser for the assembler, stuck on bug in parsing strings

    ASM-01: Continuing work on initial instructions, added printstr.lizasm to test strings

    ASM-01

    *       Expanded settings within .vscode to continue refining build and test phase

    *       Update CMakeList files to account for new libraries and files

    *       Began fleshing out assembler and vm via instructions, opcodes, operands, etc

    *       Wrote stub documentation for current tooling

    ASM-01: Fixed issue in CMakeLists.txt for Tools/lizasm, made build and testing smoother in vscode

    ASM-01: INF-03: Completed build setup for vscode

    ASM-01: INF-03: Setting up autobuilds and testing in vscode, expanded lizas to include parse_asm, updated .gitignore and Meta/Runtest.sh

    ASM-01: Added stub files for VM/Memory library, updated CMakeLists.txt

    ASM-01: INF-02: Made a quick fix to Docker environment

    INF-2: Docker and tests (#4)

    *       Added Dockerfile and docker-compose.yml to allow for running of build and tests on linux.

    *       Added simple CMakeLists.txt and rules to Tests folder

    *       Added Meta/Docker folder where scripts exclusive to the container will reside

    *       Added dummy tests for VM lib

    *       Fixed issues with running tests on docker, expanded Makefile

    INF-1: Fixed IS_DARWIN on Linux (Meta/Common.sh) (#2)

    INF-1: Fixed IS_DARWIN on Linux (Meta/Common.sh)

    INF 01: Rewrite the way cmake generates build, added github action to run build on push (#1)

    * Changed around Meta dir

    * Reworked CMakeLists.txt into subdirectories

    * Updating Makefile, added Rebuild.sh script

    * Updated .gitignore, making changed to Meta/Build.sh

    * Added github action for testing compile

    * Rename build.sh to Build.sh

    * Rename common.sh to Common.sh

    * Update and rename clean.sh to Clean.sh

    Added README.md

    Initial project creation: Built basic file layout and build definitions.  Started working on lizvm

    Initial commit
  • Loading branch information
DylanEHolland committed Mar 17, 2022
0 parents commit 55f8db3
Show file tree
Hide file tree
Showing 98 changed files with 2,402 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Running CI

on:
push:

jobs:
running_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setting up apt
run: sudo apt update
- name: Installing toolchain
run: sudo apt install build-essential cmake -y
- name: Meta/Build.sh
run: sh Meta/Build.sh

running_tests:
runs-on: ubuntu-latest
needs: running_build
steps:
- uses: actions/checkout@v2
- name: Meta/Build.sh
run: sh Meta/Build.sh
- name: Meta/Runtests.sh
run: sh Meta/Runtest.sh

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
.bash_history
6 changes: 6 additions & 0 deletions .vscode/keybindings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"key": "ctrl+s",
"command": "workbench.action.tasks.build"
}
]
65 changes: 65 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"version": "0.2.0",
"configurations": [
{
"args": [""],
"cwd": "${workspaceFolder}",
"isShellCommand": true,
"name": "Base Type",
"preLaunchTask": "Run CMake and Build",
"request": "launch",
"program": "Build/Tests/VM/DataTypes/test_base_type",
"type": "lldb",
},
{
"args": [""],
"cwd": "${workspaceFolder}",
"isShellCommand": true,
"name": "Number Type",
"preLaunchTask": "Run CMake and Build",
"request": "launch",
"program": "Build/Tests/VM/DataTypes/test_number",
"type": "lldb",
},
{
"args": ["Tests/Data/Assembler/instructions/*"],
"cwd": "${workspaceFolder}",
"isShellCommand": true,
"name": "Testing the LizVM Assembler",
"preLaunchTask": "Run CMake and Build",
"request": "launch",
"program": "Build/bin/lizas",
"type": "lldb",
},
{
"args": [], //["${file}"],
"cwd": "${workspaceFolder}",
"isShellCommand": true,
"name": "Testing LizVM Memory Address",
"preLaunchTask": "Run CMake and Build",
"request": "launch",
"program": "Build/Tests/VM/Memory/test_address",
"type": "lldb",
},
{
"args": [], //["${file}"],
"cwd": "${workspaceFolder}",
"isShellCommand": true,
"name": "Testing LizVM Memory",
"preLaunchTask": "Run CMake and Build",
"request": "launch",
"program": "Build/Tests/VM/Memory/test_memory",
"type": "lldb",
},
{
"args": [], //["${file}"],
"cwd": "${workspaceFolder}",
"isShellCommand": true,
"name": "Testing LizVM Registers",
"preLaunchTask": "Run CMake and Build",
"request": "launch",
"program": "Build/Tests/VM/test_registers",
"type": "lldb",
}
]
}
87 changes: 87 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
// "editor.codeActionsOnSave": {
// "workbench.action.tasks.runTask": true
// },
"files.associations": {
"__bit_reference": "cpp",
"__bits": "cpp",
"__config": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__functional_base": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__mutex_base": "cpp",
"__node_handle": "cpp",
"__nullptr": "cpp",
"__split_buffer": "cpp",
"__string": "cpp",
"__threading_support": "cpp",
"__tuple": "cpp",
"algorithm": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"complex": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"exception": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"locale": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"optional": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"vector": "cpp",
"filesystem": "cpp",
"deque": "cpp",
"fstream": "cpp",
"iomanip": "cpp",
"stack": "cpp"
},
"search.exclude": {
"Build": true
},
"C_Cpp.errorSquiggles": "Disabled"
// "emeraldwalk.runonsave": {
// "commands": [
// {
// "match": "*.cc",
// "isAsync": true,
// "cmd": "echo 'I run for all files.'"
// }
// ]
// }
}
28 changes: 28 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"version": "2.0.0",
"tasks": [
{
"args": ["-rf", "Build/bin"],
"command": "rm",
"group": "build",
"label": "Clear executable cache",
"type": "shell",
"presentation": {
"reveal": "silent"
}
},
{
"command": "Meta/Build.sh",
"dependsOn": "Clear executable cache",
"group": "build",
"label": "Run CMake and Build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": {
"base": "$gcc"
},
"type": "shell",
}
]
}
44 changes: 44 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 20)
project(liz)

add_subdirectory(Source)
add_subdirectory(Tests)

target_include_directories(
common
PUBLIC
"Source"
)

target_include_directories(
vm
PUBLIC
"Source"
)

target_include_directories(
data_types
PUBLIC
"Source"
)

target_include_directories(
memory
PUBLIC
"Source"
)

target_include_directories(
assembly
PUBLIC
"Source"
)

target_include_directories(
lizas
PUBLIC
"Source"
"Include"
)

5 changes: 5 additions & 0 deletions Documentation/BytecodeTools/Assembler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Lizas - Liz VM Assembler

`lizas [$filename]`

The assembler is mostly for testing the VM, as it allows us to write assembly and compile it to a bytecode and run against. The disassembler just comes naturally from building an assembler + a vm to run the bytecode.
Empty file.
13 changes: 13 additions & 0 deletions Documentation/BytecodeTools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Liz Bytecode Tools (lizas, lizdis, etc)

The bytecode tools are our binutils for the lizvm

## The intermediate state

The intermediate state lies between human readable assembly and bytecode.

## See their READMEs:

* [Assembler](Assembler.md)

* [Disassembler](Disassembler.md)
7 changes: 7 additions & 0 deletions Documentation/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Liz Documentation

## Tools and programs within liz

* [VM Documentation](VirtualMachine) - A simple virtual machine for running liz bytecode

* [BytecodeTools](BytecodeTools) - A series of tools for working with bytecode, e.g. assembler and disassembler.
7 changes: 7 additions & 0 deletions Documentation/VirtualMachine/DataTypes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Data Types

All types are derived from the `baseType`

## Core liz types

* `number` - An integer/float
5 changes: 5 additions & 0 deletions Documentation/VirtualMachine/Flags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Flags

Flags are like registers except that they have special purposes such as getting data from the VMs process

##
5 changes: 5 additions & 0 deletions Documentation/VirtualMachine/Memory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Liz VM Virtual Memory

Memory is allocated at the VM startup according to a 128 bit word.

We model these words with two char arrays of
20 changes: 20 additions & 0 deletions Documentation/VirtualMachine/Opcodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# List of Opcodes

* `add` **[$1: number, $2: number]** - Add two numbers and push them to the stack

* `allocate` **[$mem_size: number]** - Allocate `$mem_size` bytes of memory from the heap

* `free` **[$addr: liz_address]** - Unallocate memory blocks attached to `$liz_address`

* `imut` **[$name: varname, $2: value (of type $1)]** - Create an immutable variable (const) with the name provided

* `mov_number` **[$dest: [liz_address|register], $source: number]** - Move a value of type `number` into the `$dest` address space, e.g. `mov_number x 10`

* `mut` **[$name: varname]** - Create a variable with the name provided, e.g. `mut x`

* `put_character` **[$char_to_print: char]** - Put a single character to stdout

* `return` - Pop `stack_top` and return its value

* `set_type` **[$name: varname, $var_type: type]** - Set type of variable

1 change: 1 addition & 0 deletions Documentation/VirtualMachine/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# The Liz VM
9 changes: 9 additions & 0 deletions Documentation/VirtualMachine/Registers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Registers

## Generic registers

* `generic_register_{$0-10}` - A set of ten registers capable of storing any `liz_address`

## Stack registers

* `stack_top`
13 changes: 13 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2022 Dylan E. Holland

All code falls under this license, basically I don't care what you do with it...

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading

0 comments on commit 55f8db3

Please sign in to comment.