aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLizzy Fleckenstein <eliasfleckenstein@web.de>2023-08-18 12:07:16 +0200
committerLizzy Fleckenstein <eliasfleckenstein@web.de>2023-08-18 12:07:16 +0200
commitfdcf9416fc21a47508531cda9d3082c67bf83766 (patch)
treeb8688cb51324e5cfb57840fce0d92ec64e4a75bc
parent0472ad925b5e905c09ae01e2aba1ac32c434f351 (diff)
downloadparadox-fdcf9416fc21a47508531cda9d3082c67bf83766.tar.xz
inline assembly
-rwxr-xr-xbootstrap.lua12
-rw-r--r--paradox.false13
2 files changed, 25 insertions, 0 deletions
diff --git a/bootstrap.lua b/bootstrap.lua
index 04f33dd..c0243c6 100755
--- a/bootstrap.lua
+++ b/bootstrap.lua
@@ -218,6 +218,18 @@ local function compile_fn()
strings = "str_" .. str_counter .. ": db " .. table.concat(str, ",") .. "\n" .. strings
str_counter = str_counter + 1
c = nil
+ elseif c == "`" then
+ while true do
+ local x = read_char()
+ if not x then
+ syntax_error("unterminated inline assembly")
+ end
+ if x == "`" then
+ break
+ end
+ io.write(x)
+ end
+ c = nil
elseif c == "[" then
local lambda = fn_counter
print("jmp end_" .. lambda)
diff --git a/paradox.false b/paradox.false
index 3dea7b4..ce55e42 100644
--- a/paradox.false
+++ b/paradox.false
@@ -150,6 +150,19 @@
1_ { push true }
]?
+ { elseif c = ` }
+ c;'`= $[%~1_\]?[
+ { while read_char() != ` and state != ERROR }
+ [
+ r;! { push read_char() }
+ $1_=["unterminated inline assembly"]e;! { check for EOF }
+ $'`=~ q;2=~ & { condition }
+ ][,]#
+ % { drop ` or EOF }
+
+ 1_ c: { consume current_char }
+ ]?
+
{ elseif c = (opening bracket) }
c;91= $[%~1_\]?[
f; { backup fn_id }