Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
on:
pull_request:
branches: [main, master]
push:
branches: [main, master]

env:
CARGO_TERM_COLOR: always

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Run tests
run: cargo test --verbose

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build release
run: cargo build --release --verbose
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/target


# Added by cargo
#
# already existing elements were commented out

#/target
32 changes: 32 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "trivilang"
version = "0.1.0"
edition = "2024"

[[bin]]
name = "trivic"
path = "src/main.rs"

[dependencies]


[dev-dependencies]
pretty_assertions = "1.4.1"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# masterthesis
Our Master Thesis
# Master Thesis (TriviLang)
Trivilang is a custom toy language for demonstrating the ease of adding hardening capabilities to compilers.
12 changes: 12 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fn main() {
println!("Hello, world!");
}

#[cfg(test)]
mod tests{
use pretty_assertions::{assert_eq};
#[test]
fn zero_eq_zero(){
assert_eq!(0,0);
}
}
32 changes: 32 additions & 0 deletions test.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Test file for small_lang compiler

func is_greater_than_44(params : Integer) -> Integer {
let x : Integer = params;
if x > 44 is True then {
1
}
else if not {
0
}
}


func otherFunction() -> Boolean {
let number : Integer = 20;
let is_greater : Integer = is_greater_than_44(number);
if is_greater == 0 is True then {
print("Didnt work the first time!");
}
while is_greater == 0 do {
number = number + 1;
is_greater = is_greater_than_44(number);
}
True
}

func main() -> Boolean {
let result : Boolean = otherFunction();
print(result);
print("Finished");
result
}