flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > nop \ [solved]

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 05 Oct 2011, 08:50
Code:
;does not compile (unexpected end of line)

nop\
    
Code:
;does compile, all ok.

nop\

nop
    

This behavior is not logical.
This should compile in both cases,
or get an unexpected end of line in both cases.
But not two different results.

_________________
I am not young enough to know everything (Oscar Wilde)- Image


Last edited by ouadji on 05 Oct 2011, 18:05; edited 1 time in total
Post 05 Oct 2011, 08:50
View user's profile Send private message Send e-mail Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 05 Oct 2011, 09:58
Are you sure? The first example does not have whitespace after the nop\ and users intention was to continue on the next line. Its the user's bug.
The second example is assembled to two rows where the first row consists of "n","o","p","\",13,10 and the second "n","o","p".
CR and LF (at least according to HTML) are whitespace. I don't know how they're supposed to be handled by FASM.

This user bug is hard to find, but I think its up to the user to fix.
Post 05 Oct 2011, 09:58
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 05 Oct 2011, 10:45
First case only causes error when you do not have a line following the "nop\" line, and it is "unexpected end of file", because fasm is looking for the next line to concatenate it in place specified by "\", but finds none.
Press enter after "nop\", save, and you've got no error.
Post 05 Oct 2011, 10:45
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 05 Oct 2011, 10:51
I remember seeing this kind of (error?) in some C compiler's IDE, where it greeted you with a warning/error (I cannot remember) at compile time, saying you needed a newline at the very end of every source/include file. I felt it was weird, but I got accustomed.

Is it a matter of taste? Elegance? Completeness? I don't know.
Post 05 Oct 2011, 10:51
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 05 Oct 2011, 11:18
Code:
if last_char='\' AND ~ next_line eq   ;and !
 {concatenate }
else
{all ok, go}

    
A very small change would make the behavior of fasm more "logical".
just because one likes perfect things.
Wink

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 05 Oct 2011, 11:18
View user's profile Send private message Send e-mail Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 05 Oct 2011, 14:02
Quote:

warning/error (I cannot remember)

"Warning: No newline at end of file"? I think that was the warning in GCC.
Post 05 Oct 2011, 14:02
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 05 Oct 2011, 14:42
ouadji wrote:
Code:
if last_char='\' AND ~ next_line eq   ;and !
 {concatenate }
else
{all ok, go}

    
A very small change would make the behavior of fasm more "logical".
just because one likes perfect things.
Wink
I do not really understand your pseude-code there.
However in my opinion current behavior is strictly logical - think of "\" as two-argument operator here, it needs two lines ("arguments") to concatenate. When you have no next line, this "expression" is invalid. It is like if you wrote "a = 1+".
Post 05 Oct 2011, 14:42
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 05 Oct 2011, 16:10
Quote:
I do not really understand your pseude-code there
concatenate only if the last character is "\", (1)
but also(2) if the following line exists.(3)
in other words,if the next line does not exist, ignore the "\" character
Code:
if last_char='\' ;(1)
AND                ;(2)
~ next_line eq  ;(3)    
Quote:
It is like if you wrote "a = 1+". Wink
This way of thinking is logical too.
In fact, on second thought, i'm agree with you.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 05 Oct 2011, 16:10
View user's profile Send private message Send e-mail 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.