flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > When compiling it says "unexpected characters"

Author
Thread Post new topic Reply to topic
l4m2



Joined: 15 Jan 2015
Posts: 657
l4m2
Code:
macro whil {
  macro whil z& \{
    whil
    local a, b, f
    a equ z
    b equ
    match x\\{y, z \\{
      a equ x
      b equ \\\{y
    \\}
    match x\\{, z \\{
      a equ x
      b equ \\\{
    \\}
    if a
      f
      whil a \\{ f \\}
    end if
    macro f b
  \}
}
whil
a equ 1
a equ 2
whil defined a
{
  display a+48
  restore a
}      
When compiling it says "out of stack space".
Code:
a equ 1
while defined a
  display a+48
  restore a
end while    
causes an infinite loop.
So how to deal with it?(Of course
Code:
a equ 1
rept 100 {
  if defined a
    display a+48
    restore a
  end if
}     
is okay but the number is hard to decide


Last edited by l4m2 on 15 Apr 2016, 05:23; edited 2 times in total
Post 15 Apr 2016, 04:08
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
You have too many backslashes. Use only one backslash per level of macro block.
Post 15 Apr 2016, 05:03
View user's profile Send private message Visit poster's website Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 657
l4m2
revolution wrote:
You have too many backslashes. Use only one backslash per level of macro block.
I did the modification but still out of stack space
Post 15 Apr 2016, 05:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
You are also mixing preprocessor and assembly constructs.

EQU/RESTORE are consumed by the preprocessor, so the assembler WHILE/DEFINED never sees them.
Post 15 Apr 2016, 05:17
View user's profile Send private message Visit poster's website Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 657
l4m2
revolution wrote:
You are also mixing preprocessor and assembly constructs.

EQU/RESTORE are consumed by the preprocessor, so the assembler WHILE/DEFINED never sees them.

So how to do that?
p.s. What's worse, even if a is not even defined, still an stack overflow got
Post 15 Apr 2016, 05:21
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
Read up about IRPV, which can loop through all past definitions of a symbol.
Post 15 Apr 2016, 06:43
View user's profile Send private message Visit poster's website Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 657
l4m2
revolution wrote:
Read up about IRPV, which can loop through all past definitions of a symbol.
But what if it is also possible not to go through the definitions but some other thing?
Post 15 Apr 2016, 07:08
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
What other thing would you like to do?

What are you actually trying to do?
Post 15 Apr 2016, 07:15
View user's profile Send private message Visit poster's website Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 657
l4m2
revolution wrote:
What other thing would you like to do?

What are you actually trying to do?
So you think whil is useless, right?
Post 15 Apr 2016, 07:18
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
I don't even know what it is expected to do. Perhaps you would like to explain what you want?
Post 15 Apr 2016, 08:20
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.