An update!

Just minor tweaks and slight updates.
This commit is contained in:
Tony Bark 2021-05-09 15:03:45 -04:00
parent 1cc7b2ec6c
commit aaf6455762
4 changed files with 21 additions and 50 deletions

View file

@ -1,14 +1,13 @@
# Corten
Corten is a RISC virtual machine written in Rust as a hobby and based on Fletcher Haynes's [So you want to build a language VM](https://blog.subnetzero.io/post/building-language-vm-part-01/) tutorial.
Corten is a RISC-V virtual machine written in Rust as a hobby and based on Fletcher Haynes's [So you want to build a language VM](https://blog.subnetzero.io/post/building-language-vm-part-01/) tutorial.
## Build Status
| Service | Status |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| Github | ![Rust](https://github.com/tonytins/corten/workflows/Rust/badge.svg) |
| Travis CI | [![Build Status](https://travis-ci.org/tonytins/corten.svg?branch=master)](https://travis-ci.org/tonytins/corten) |
| AppVeyor | [![Build status](https://ci.appveyor.com/api/projects/status/ffru6ik26j2b87ko?svg=true)](https://ci.appveyor.com/project/tonytins/corten) |
| Service | Status |
| --------- | ----------------------------------------------------------------------------------------------------------------- |
| Github | ![Rust](https://github.com/tonytins/corten/workflows/Rust/badge.svg) |
| Travis CI | [![Build Status](https://travis-ci.org/tonytins/corten.svg?branch=master)](https://travis-ci.org/tonytins/corten) |
## Specifications
@ -21,20 +20,7 @@ See [specifications](docs/spec.md) page.
- Rust 1.41+
- Recommended IDEs
- Visual Studio Code
- Jetbrains IntelliJ
### Supported Platforms
- Ubuntu 18.04+
- Windows 10 v1809+
- macOS 10.15+
## Authors
- **Anthony Foxclaw** - *Initial work* - [tonytins](https://github.com/tonytins)
- **Fletcher Haynes** - *Tutorial* - [fletchercp](https://gitlab.com/fletchercp)
See also the list of [contributors](https://github.com/tonytins/simtactics/contributors) who participated in this project.
- Jetbrains IntelliJ or CLion
## License

View file

@ -1,27 +1,11 @@
# Welcome
Corten is a RISC virtual machine written in Rust as a hobby and based on Fletcher Haynes's [So you want to build a language VM](https://blog.subnetzero.io/post/building-language-vm-part-01/) tutorial.
Corten is a RISC-V virtual machine written in Rust as a hobby and based on Fletcher Haynes's [So you want to build a language VM](https://blog.subnetzero.io/post/building-language-vm-part-01/) tutorial.
## Specifications
See [specifications](spec.md) page.
## Build Status
| Service | Status |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| Github | ![Rust](https://github.com/tonytins/corten/workflows/Rust/badge.svg) |
| Travis CI | [![Build Status](https://travis-ci.org/tonytins/corten.svg?branch=master)](https://travis-ci.org/tonytins/corten) |
| AppVeyor | [![Build status](https://ci.appveyor.com/api/projects/status/ffru6ik26j2b87ko?svg=true)](https://ci.appveyor.com/project/tonytins/corten) |
## Requirements
### Supported Platforms
- Ubuntu 18.04+
- Windows 10 v1809+
- macOS 10.15+
## License
This project is licensed under the MPL 2.0 license - see the [LICENSE](LICENSE) file for details.

View file

@ -15,6 +15,7 @@ pub enum Token {
Number { value: i32 },
}
// RISC-V opcodes
#[derive(Debug, PartialEq, Clone)]
pub enum Opcode {
HLT,

View file

@ -17,18 +17,18 @@ named!(pub opcode<CompleteStr, Token>,
#[cfg(test)]
mod opcode_parser_test {
use super::*;
use super::*;
#[test]
fn test_parser_op_load() {
// Test that opcode is dected and parsed correctly
let result = opcode(CompleteStr("load"));
assert_eq!(result.is_ok(), true);
let (rest, token) = result.unwrap();
assert_eq!(token, Token::Opcode { code: Opcode::LOAD });
assert_eq!(rest, CompleteStr(""));
let result = opcode(CompleteStr("alod"));
let (_, token) = result.unwrap();
assert_eq!(token, Token::Opcode { code: Opcode::IGL });
}
#[test]
fn test_parser_op_load() {
// Test that opcode is detected and parsed correctly
let result = opcode(CompleteStr("load"));
assert_eq!(result.is_ok(), true);
let (rest, token) = result.unwrap();
assert_eq!(token, Token::Opcode { code: Opcode::LOAD });
assert_eq!(rest, CompleteStr(""));
let result = opcode(CompleteStr("alod"));
let (_, token) = result.unwrap();
assert_eq!(token, Token::Opcode { code: Opcode::IGL });
}
}