Skip to content

Commit 39f09be

Browse files
authored
Merge pull request #4 from QuickWrite/1-new-tokenization
New tokenization system to fix #1 As stated in #1 it is currently not possible to create an instruction with a syntax like this: print out "Hello World" These changes in this pull request will change this. This means that this pull request will fix #1.
2 parents 18fe18f + 578ae92 commit 39f09be

File tree

7 files changed

+212
-104
lines changed

7 files changed

+212
-104
lines changed

examples/01_inline_parsing.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ start: mov 10 r0
1717
add r0 r1
1818
jmp start
1919
]]
20-
local tokenizer = LuASM.string_tokenizer(src)
20+
local tokenizer = asm:string_tokenizer(src)
2121

2222
-- 4. Parse
2323
local result = asm:parse(tokenizer)

examples/02_file_parsing.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ local instructions = {
1212
local asm = LuASM:new(instructions, {})
1313

1414
-- 3. Tokenize a source string
15-
local tokenizer = LuASM.file_tokenizer("./data/02_data.lasm")
15+
local tokenizer = asm:file_tokenizer("./data/02_data.lasm")
1616

1717
-- 4. Parse
1818
local result = asm:parse(tokenizer)

examples/03_custom_arguments.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ local src = [[
2020
mov reg0, reg1
2121
print "Hello"
2222
]]
23-
local tokenizer = LuASM.string_tokenizer(src)
23+
local tokenizer = asm:string_tokenizer(src)
2424

2525
-- 4. Parse
2626
local result = asm:parse(tokenizer)

examples/04_interpreter.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ print "Hello"
2323
print "World"
2424
print "Message"
2525
]]
26-
local tokenizer = LuASM.string_tokenizer(src)
26+
local tokenizer = asm:string_tokenizer(src)
2727

2828
-- 4. Parse
2929
local result = asm:parse(tokenizer)

examples/05_comments.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ start: mov 10 r0 # This is a comment
1717
add r0 r1 ; This is another comment
1818
jmp start
1919
]]
20-
local tokenizer = LuASM.string_tokenizer(src)
20+
local tokenizer = asm:string_tokenizer(src)
2121

2222
-- 4. Parse
2323
local result = asm:parse(tokenizer)

examples/06_custom_comments.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ start: mov 10 r0 = My custom comment
1919
add r0 r1 = This just works
2020
jmp start
2121
]]
22-
local tokenizer = LuASM.string_tokenizer(src)
22+
local tokenizer = asm:string_tokenizer(src)
2323

2424
-- 4. Parse
2525
local result = asm:parse(tokenizer)

0 commit comments

Comments
 (0)