Skip to content

Commit

Permalink
restructured filetree
Browse files Browse the repository at this point in the history
  • Loading branch information
nic-gaffney committed Sep 6, 2023
1 parent 739421c commit 7b67ab3
Show file tree
Hide file tree
Showing 15 changed files with 12 additions and 28 deletions.
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Build Sloth
cargo build
rm output.o
FILENAME="$1"
# Compile standard library
./target/debug/sloth std/extern.sloth std/stdmath.sloth std/stdio.sloth $FILENAME

# Generate binary
clang --verbose -lm output.o std/stdio.c std/stdlib.c std/stdmath.c -o "${FILENAME%.sloth}"
clang -lm output.o std/stdio.c std/stdlib.c std/stdmath.c -o "${FILENAME%.sloth}"

# Move file
mv "${FILENAME%.sloth}" .
mv "${FILENAME%.sloth}" out/
rm output.o
2 changes: 1 addition & 1 deletion examples/guessing.sloth
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() Int {
var computer: Int = randGen(1, 10);
val computer: Int = randGen(1, 10);
var tries: Int = 0;
var correct: Bool = false;

Expand Down
Binary file added out/arguments
Binary file not shown.
Binary file added out/cgol
Binary file not shown.
Binary file added out/chatbot
Binary file not shown.
Binary file added out/guessing
Binary file not shown.
Binary file added out/hello
Binary file not shown.
Binary file added out/mandelbrot
Binary file not shown.
Binary file added out/mutable
Binary file not shown.
Binary file added out/read
Binary file not shown.
Binary file added out/system
Binary file not shown.
1 change: 0 additions & 1 deletion sloth/src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ impl<'ctx> Codegen<'ctx> {

for stmt in stmts {
self.codegen_stmt(stmt);
self.current_func.unwrap().print_to_stderr();
}
}

Expand Down
9 changes: 8 additions & 1 deletion std/stdsocket.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "stdlib.c"
#include <netinet/in.h>
#include <stdbool.h>
#include <stdio.h>
Expand Down Expand Up @@ -66,6 +65,14 @@ char *recvsock(int soc) {
return buf;
}

size_t
strlen(const char *str)
{
const char *s;
for (s = str; *s; ++s);
return(s - str);
}

void sendsock(char *msg, int soc) { send(soc, msg, strlen(msg), 0); }

void closesock(int soc, bool server) {
Expand Down
19 changes: 0 additions & 19 deletions test.c

This file was deleted.

3 changes: 0 additions & 3 deletions test.sh

This file was deleted.

0 comments on commit 7b67ab3

Please sign in to comment.