It's impossible to use an if or while block inside of a macro, as it results in a compiler error. Simulation or compile doesn't matter, it's broken in both.
Example
macro test
2 1 < if
12 print
end
end
Compile result
$ python porth.py sim borked.porth
Traceback (most recent call last):
File "porth.py", line 924, in <module>
program = compile_file_to_program(program_path, include_paths);
File "porth.py", line 862, in compile_file_to_program
return compile_tokens_to_program(lex_file(file_path), include_paths)
File "porth.py", line 709, in compile_tokens_to_program
block_ip = stack.pop()
IndexError: pop from empty list
It's impossible to use an
if
orwhile
block inside of a macro, as it results in a compiler error. Simulation or compile doesn't matter, it's broken in both.Example
Compile result
Version d7ecaa221a791616e2c76989feaf65a9cdf42e0c