Skip to content

Commit

Permalink
again, use V
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Nov 14, 2024
1 parent 49bfb1f commit 50f43eb
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 65 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/compiler_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:

- name: Build Rivet compiler
run: |
wget https://github.com/fusionlanguage/fut/releases/download/fut-3.2.7/fut_3.2.7-1_amd64.deb
sudo dpkg -i fut_3.2.7-1_amd64.deb
sudo apt install libgtk-4-dev
make
./rivetc -h
git clone https://github.com/vlang/v
cd v && make
sudo ./v symlink
cd ..
v . -o rivetc && ./rivetc
5 changes: 0 additions & 5 deletions Makefile

This file was deleted.

Empty file removed fut-out/.gitkeep
Empty file.
24 changes: 0 additions & 24 deletions src/Prefs.fu

This file was deleted.

18 changes: 0 additions & 18 deletions src/Utils.fu

This file was deleted.

11 changes: 11 additions & 0 deletions src/main.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (C) 2024-present Jose Mendoza - All rights reserved. Use of this
// source code is governed by an MIT license that can be found in the LICENSE
// file.

module main

import util

fn main() {
util.ic_error("hello")
}
13 changes: 0 additions & 13 deletions src/ric.fu

This file was deleted.

4 changes: 4 additions & 0 deletions src/token/token.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright (C) 2024-present Jose Mendoza - All rights reserved. Use of this
// source code is governed by an MIT license that can be found in the LICENSE
// file.

52 changes: 52 additions & 0 deletions src/util/util.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright (C) 2024-present Jose Mendoza - All rights reserved. Use of this
// source code is governed by an MIT license that can be found in the LICENSE
// file.

module util

import term

enum MsgLevel {
note
warn
error
ice
}

@[inline]
fn format_msg(msg string, level MsgLevel) string {
return match level {
.note {
"${term.bold('rivetc: ')}${term.bold(term.cyan('error:'))} ${msg}"
}
.warn {
"${term.bold('rivetc: ')}${term.bold(term.yellow('error:'))} ${msg}"
}
.error {
"${term.bold('rivetc: ')}${term.bold(term.red('error:'))} ${msg}"
}
.ice {
"${term.bold('rivetc: ')}${term.bold(term.red('internal compiler error:'))} ${msg}"
}
}
}

pub fn note(msg string) {
eprintln(format_msg(msg, .note))
}

pub fn warn(msg string) {
eprintln(format_msg(msg, .warn))
}

@[noreturn]
pub fn error(msg string) {
eprintln(format_msg(msg, .error))
exit(101)
}

@[noreturn]
pub fn ic_error(msg string) {
eprintln(format_msg(msg, .ice))
exit(102)
}
7 changes: 7 additions & 0 deletions v.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Module {
name: 'rivetc'
description: 'The Rivet Programming Language'
version: '0.1.0'
license: 'MIT'
dependencies: []
}

0 comments on commit 50f43eb

Please sign in to comment.