Added comments

This commit is contained in:
cannoli-fruit 2026-07-26 20:30:38 -04:00
commit bb662f6079
5 changed files with 14 additions and 1 deletions

View file

@ -138,6 +138,7 @@ int main(uint argc, char **argv) {
bool isQuote = false;
bool isProc = false;
bool isInclude = false;
bool isComment = false;
Lz_DA(int) labelStack = {0};
uint64_t allocHead = 0x7000000000000000;
char funcName[128];
@ -164,6 +165,9 @@ int main(uint argc, char **argv) {
compileStart:
while ((newchar = fgetc(currFile)) != EOF) {
++counter;
if (isComment && newchar == '\n') isComment = false;
if (!isComment && newchar == '#') isComment = true;
if (isComment) continue;
if (isspace(newchar) && !isQuote) {
if (tokenAccumulator.cnt == 0) continue;
if (is_int_literal(&tokenAccumulator)) {
@ -396,7 +400,7 @@ codegen:
char *fname = malloc(tokenAccumulator.cnt+1);
memcpy(fname, tokenAccumulator.data, tokenAccumulator.cnt);
fname[tokenAccumulator.cnt] = 0;
FILE *f = fopen(fname, "rb");
FILE *f = fopen(fname, "r");
if (!f) {
fprintf(stderr, "Could not open file %s or doesn't exist\n",
fname);

View file

@ -1,6 +1,7 @@
$inc fvmstd.fp
proc main
# Test for the putuint function in fvmstd
"Hello World!" :puts :newline
23 :putuint :newline
0 :putuint :newline

View file

@ -1,6 +1,7 @@
$inc fvmstd.fp
proc main
# Basic test for getuint and putuint
"Sum Program" :puts :newline
:getuint
:getuint u+

6
flagpole/tests/sub.fp Normal file
View file

@ -0,0 +1,6 @@
$inc fvmstd.fp
proc main
49 48 u-
:putuint :newline
endproc

View file

@ -1,6 +1,7 @@
$inc fvmstd.fp
proc main
# Truth machine (https://esolangs.org/wiki/Truth-machine)
:getchar
while dup "1" ld8 == do
dup :putchar