From fdcf9416fc21a47508531cda9d3082c67bf83766 Mon Sep 17 00:00:00 2001 From: Lizzy Fleckenstein Date: Fri, 18 Aug 2023 12:07:16 +0200 Subject: inline assembly --- bootstrap.lua | 12 ++++++++++++ paradox.false | 13 +++++++++++++ 2 files changed, 25 insertions(+) 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 } -- cgit v1.2.3