From 49215693b8941118f70641ff8106693aad30d748 Mon Sep 17 00:00:00 2001 From: julianb0 Date: Wed, 29 May 2019 22:27:49 +0200 Subject: [PATCH] stuff --- as/k-as.py | 5 ++-- as/testfile.k | 4 +-- lg/karch.lang | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ pc/instrs/INSTRS | 5 ++++ 4 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 lg/karch.lang diff --git a/as/k-as.py b/as/k-as.py index 7460dbe..d100eef 100755 --- a/as/k-as.py +++ b/as/k-as.py @@ -118,12 +118,11 @@ def parse_preproc(line): assert(written == 8) pdata += written - elif tok[2][0] == "'": + elif tok[2][0] in "'\"": s = tok[2].strip() - assert(s[-1] == "'") + assert(s[-1] == tok[2][0]) s = s[1:-1] - assert(not "'" in s) plabels_data[tok[0]] = pdata pdefs[tok[0] + "_len"] = str(len(s)) diff --git a/as/testfile.k b/as/testfile.k index a828ba9..97edf36 100644 --- a/as/testfile.k +++ b/as/testfile.k @@ -1,7 +1,7 @@ ; The OS/K Team licences this file to you under the MIT license. ; See the LICENSE file in the project root for more information. -hw = 'Hello World' +hw = "Hello World" ; ; Entry point @@ -10,7 +10,7 @@ main: ; Initializes the stack mov rbp, 0x200000 mov rsp, rbp - + mov ax0, hw call print diff --git a/lg/karch.lang b/lg/karch.lang new file mode 100644 index 0000000..8380b7f --- /dev/null +++ b/lg/karch.lang @@ -0,0 +1,71 @@ + + + + + + \ + + + #|@|;|/ + + + + /\* + \*/ + + + + ^[A-Za-z_][A-Za-z_0-9.]*\: + + + + .[A-Za-z_0-9.]*\: + + + + " + " + + + + ' + ' + + + + include + + + + ^\s+[a-zA-Z_]{2,} + + + + (inv|flg) + r[isb]p + r[a-fs][xi] + [an]x[0-9]+ + (sa|cr)[0-9]+ + + + + \b([1-9][0-9]*|0)([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b + + + + \b([0-9]+[Ee][-]?[0-9]+|([0-9]*\.[0-9]+|[0-9]+\.)([Ee][-]?[0-9]+)?)[fFlL]? + + + + \b0[xX][0-9a-fA-F]+([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b + + + diff --git a/pc/instrs/INSTRS b/pc/instrs/INSTRS index abe9a4b..950ebe4 100644 --- a/pc/instrs/INSTRS +++ b/pc/instrs/INSTRS @@ -180,7 +180,12 @@ call m ret +# push rbp +# mov rbp, rsp enter + +# mov rbp, [rsp+8] +# add rsp, 8 leave pushf