Skip to content

Commit

Permalink
Release Candidate linux-x64 v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Letsmoe committed Mar 7, 2024
1 parent 338e1f3 commit 36f48e2
Show file tree
Hide file tree
Showing 12 changed files with 344 additions and 216 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
node_modules
dist
bin
./release/**/*
Binary file added bin/meta-linux-x64/meta
Binary file not shown.
5 changes: 4 additions & 1 deletion lib/char-test.asm
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ scan_or_parse:
; If the parse flag is not set we encountered an error during parsing.
; we're done here...
cmp byte [eswitch], 1
je .done
je .done_error
cmp byte [tflag], 1
jne .done

Expand All @@ -121,6 +121,9 @@ scan_or_parse:
mov byte [eswitch], 0
ret
.done:
add word [input_string_offset], 1
ret
.done_error:
ret

; Clears the last_match variable to all zeros
Expand Down
5 changes: 4 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ watch:
done

watch-compile-gyro:
bash ./watch-full-compile.bash ./bootstrap/meta ./gyro/gyro.meta ./gyro/gyro-test.txt
bash ./watch-full-compile.bash ./bootstrap/meta ./gyro/gyro.meta ./gyro/gyro-test.txt

bundle:
cd bin && rm -f ../release/meta-linux-x64.zip && zip -r ../release/meta-linux-x64.zip ./meta-linux-x64/meta
2 changes: 2 additions & 0 deletions meta-lisp/meta-lisp.meta
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ PROGRAM =
->("push ebp")
->("mov ebp, esp")
$(BRACKET_EXPR_WRAPPER | COMMENT)
->("mov esp, ebp")
->("pop ebp")
->("mov eax, 1")
->("mov ebx, 0")
Expand Down Expand Up @@ -161,6 +162,7 @@ BRACKET_EXPR = ("+" [set ARG_NUM 0] BRACKET_ARG ->("push eax") [set ARG_NUM 1] B
[set IS_FUNC 1]
// Function Body
$(BRACKET_EXPR_WRAPPER | COMMENT)
->("mov esp, ebp")
->("pop ebp")
->("ret")
.LABEL(*1 ":")
Expand Down
31 changes: 20 additions & 11 deletions meta/meta.input.meta
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PROGRAM =
$((".TOKENS"
.LABEL("; -- Tokens --")
$(TOKEN_DEFINITION | COMMENT))
| (".SYNTAX" .ID
| (".SYNTAX" ID
.LABEL("section .text")
->("global _start")
.LABEL("_start:")
Expand All @@ -23,7 +23,7 @@ PROGRAM =

// -------------------------------- Includes -----------------------------------

INCLUDE_STATEMENT = ".INCLUDE" .STRING_RAW ";"
INCLUDE_STATEMENT = ".INCLUDE" RAW ";"
.DIRECT("mov esi, last_match")
.DIRECT("call import_meta_file_mm32")
.DIRECT("mov byte [eswitch], 0");
Expand All @@ -40,18 +40,19 @@ OUT1 = "*1" ->("call gn1")
->("call print_mm32")
| STRING ->("print " *);

OUT_IMMEDIATE = .STRING_RAW ->(*);
OUT_IMMEDIATE = RAW ->(*);

OUTPUT = ("->" "(" $(OUT1) ")" ->("call newline")
| ".LABEL" ->("call label") "(" $(OUT1) ")" ->("call newline")
| ".RS" "(" $ OUT1 ")")
| ".DIRECT" "(" $ OUT_IMMEDIATE ")";

EX3 = .ID ->("call vstack_clear") ->("call " *) ->("call vstack_restore")
| ".ID" ->("call test_for_id")
EX3 = ID
->("call vstack_clear")
->("call " *)
->("call vstack_restore")
| ".RET" ->("ret")
| ".NOT" (STRING | NUMBER) ->("match_not " *)
| ".STRING_RAW" ->("call test_for_string_raw")
| "%>"
->("mov edi, str_vector_8192")
->("mov esi, last_match")
Expand All @@ -75,11 +76,11 @@ EX1 = EX2 $ ("|"
->("cmp byte [eswitch], 0")
->("je " *1) EX2) .LABEL(*1 ":");

DEFINITION = .ID .LABEL(* ":") "=" EX1 ";" ->("ret");
DEFINITION = ID .LABEL(* ":") "=" EX1 ";" ->("ret");

// --------------------------------- Tokens ------------------------------------

TOKEN_DEFINITION = .ID
TOKEN_DEFINITION = ID
.LABEL(* ":") ":" TX1 ";" ->("ret");

TX1 = TX2 $("|"
Expand Down Expand Up @@ -108,10 +109,13 @@ TX3 = (".TOKEN"
->("je " *1))
->("mov byte [eswitch], 0")
| ".ANYBUT(" CX1 ")"
->("NOT" "scan_or_parse")
// Negate the error switch
->("test byte [eswitch], 0")
->("setz [eswitch]")
->("call scan_or_parse")
| ".ANY(" CX1 ")"
->("call scan_or_parse")
| .ID
| ID
->("call " *)
| "(" TX1 ")";

Expand Down Expand Up @@ -140,9 +144,14 @@ COMMENT = "//" .NOT 10;

.TOKENS

// Remove any leading whitespace
PREFIX : $.ANY(32!9!13!10);
// Match numbers (sequence of digits)
NUMBER : PREFIX .TOKEN DIGIT $DIGIT .DELTOK;
DIGIT : .ANY(48:57);
STRING : PREFIX .ANY(34) .TOKEN $.ANYBUT(13!10!34) .DELTOK .ANY(34) ;
ID : PREFIX .TOKEN ALPHA $(ALPHA | DIGIT) .DELTOK;
ALPHA : .ANY(65:90!97:122) ;
STRING : PREFIX .TOKEN .ANY(34) $.ANYBUT(13!10!34) .ANY(34) .DELTOK;
RAW : PREFIX .ANY(34) .TOKEN $.ANYBUT(13!10!34) .DELTOK .ANY(34);

.END
Loading

0 comments on commit 36f48e2

Please sign in to comment.