-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bbc65cf
commit 6cad725
Showing
8 changed files
with
45 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
gcc src/hasm.c src/token.c -I headers | ||
gcc src/hasm.c src/token.c src/file_buffer.c -I headers -o hasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
%include "std.hasm" | ||
|
||
main: | ||
msg: string "Hello, World!" | ||
print msg | ||
123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
#define BUFFER_CHUNK_CAP 255 | ||
|
||
void read_filesrc(char* src_path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <stdio.h> | ||
#include <unistd.h> | ||
#include <errno.h> | ||
#include <stdbool.h> | ||
|
||
#include "file_buffer.h" | ||
|
||
void read_filesrc(char* src_path) | ||
{ | ||
bool exists = access(src_path, F_OK) == 0; | ||
if (!exists) { | ||
fprintf(stderr, "Source does not exist!"); | ||
return; | ||
} | ||
|
||
FILE* src_file = fopen(src_path, "r"); | ||
char buffer[BUFFER_CHUNK_CAP]; | ||
|
||
fgets(buffer, BUFFER_CHUNK_CAP, (FILE*)src_file); | ||
|
||
fclose(src_file); | ||
|
||
printf("%s\n", buffer); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
#include <stdio.h> | ||
|
||
int main(int argc, char** argv) { | ||
#include "file_buffer.h" | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
read_filesrc("examples/test.hasm"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#pragma once | ||
#include <stdint.h> | ||
|
||
static uint64_t c_source_letter = 0; |