Fixed examples for changes in lexer
Name assigned to %CONST is the next symbol in stream, not the symbol attached to it.
This commit is contained in:
@@ -50,7 +50,7 @@ pair<token_t, lerr_t> tokenise_symbol(string_view &source, size_t &column,
|
|||||||
|
|
||||||
token_t t{};
|
token_t t{};
|
||||||
|
|
||||||
if (initial_match(sym, "%CONST"))
|
if (sym == "%CONST")
|
||||||
{
|
{
|
||||||
t.type = token_type_t::PP_CONST;
|
t.type = token_type_t::PP_CONST;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
;; 65 which means that past 20! results are truncated and therefore
|
;; 65 which means that past 20! results are truncated and therefore
|
||||||
;; the program produces inaccurate factorials.
|
;; the program produces inaccurate factorials.
|
||||||
|
|
||||||
%const(limit) 20 %end
|
%const limit 20 %end
|
||||||
|
|
||||||
;; Setup entrypoint
|
;; Setup entrypoint
|
||||||
global main
|
global main
|
||||||
|
|||||||
@@ -5,26 +5,26 @@
|
|||||||
;;; stack version.
|
;;; stack version.
|
||||||
|
|
||||||
;; Constants
|
;; Constants
|
||||||
%const(limit) 93 %end
|
%const limit 93 %end
|
||||||
|
|
||||||
%const(increment_i)
|
%const increment_i
|
||||||
push.reg.word 2
|
push.reg.word 2
|
||||||
push.word 1
|
push.word 1
|
||||||
plus.word
|
plus.word
|
||||||
mov.word 2
|
mov.word 2
|
||||||
%end
|
%end
|
||||||
|
|
||||||
%const(print_i)
|
%const print_i
|
||||||
push.reg.word 2
|
push.reg.word 2
|
||||||
print.word
|
print.word
|
||||||
%end
|
%end
|
||||||
|
|
||||||
%const(print_reg_0)
|
%const print_reg_0
|
||||||
push.reg.word 0
|
push.reg.word 0
|
||||||
print.word
|
print.word
|
||||||
%end
|
%end
|
||||||
|
|
||||||
%const(print_reg_1)
|
%const print_reg_1
|
||||||
push.reg.word 1
|
push.reg.word 1
|
||||||
print.word
|
print.word
|
||||||
%end
|
%end
|
||||||
|
|||||||
Reference in New Issue
Block a user