flat assembler
Message board for the users of flat assembler.

flat assembler > Compiler Internals > suggestion /*Comments*/ (final rev.8 - over for me)

Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
edfed wrote:
mov /*comment*/ eax,/*comment*/ebx ;comments?

no comment. i don't see the use of such a feature, even in 2010.
Wink
in french, we say :

"Qui peut le plus, peut le moins" ..."who can do more, can do less !" Razz

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 12 Mar 2010, 20:22
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
ouadji,

Looks like you're as crazy as I am. Wink That should be marvelous at least.

BTW, "release" means something complete, maybe "revision"? "Version" will fit the bill too. Wink
Post 12 Mar 2010, 22:11
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

Quote:

Looks like you're as crazy as I am

crazy ? Shocked Wink the others are crazy not to be crazy about asm. Razz
Code:
/*init!!!()!
db 0,\ !(comment)!/*init!!/**//*comment*/
1,/*init!!{==}{=com
ment=}2,/*idle!!3,4/*idle!!/*init!!§--§§-com
ment-§,5

flat assembler  version 1.69.12 (multiline comment)
5 passes, 0.2 seconds

 Smile Smile Smile i like it !
    
PS : ok for "revision" Wink

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 12 Mar 2010, 22:52
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16735
Location: In your JS exploiting you and your system
ouadji wrote:
Code:
/*init!!!()!
db 0,\ !(comment)!/*init!!/**//*comment*/
1,/*init!!{==}{=com
ment=}2,/*idle!!3,4/*idle!!/*init!!§--§§-com
ment-§,5    
And this is supposed to be more readable?
Post 13 Mar 2010, 01:12
View user's profile Send private message Visit poster's website Reply with quote
Coddy41



Joined: 18 Jan 2009
Posts: 384
Location: Ohio, USA
revolution wrote:
And this is supposed to be more readable?

Only to those whom want to believe it is more readable... I am not one of them. Razz

_________________
Want hosting for free for your asm project? You can PM me. (*.fasm4u.net)
Post 13 Mar 2010, 01:47
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
Quote:
And this is supposed to be more readable?
Obviously not ! Razz (Rolling Eyes)

it's just for the fun revolution. Wink ,nothing else.

like we say in french :"who can do more, can do less"
but you can do this too :
Code:
db 0,\
(!

                        comment only for revolution

!)
1
    
nothing to do with "readable",
just a sample to show the power of engine, like macros.

Wink

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 13 Mar 2010, 03:24
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
ouadji wrote:
Code:
db 0,\
(!

                           comment only for revolution

!)
1    
Are you trying to say that comment blocks EOL marker after it from separating lines? Following two can be legal:
Code:
db 0,\ (!
   1,\
   2,\ !)
   3

db 0,\
(! 1,\
   2,\
!) 3    
Your example looks suspicious (I mean implicit continuation): what if I add "666,\" after closing parenthesis? "666,"? Or single "666"? I think, stream comment should be like "can be placed anywhere space is allowed and behave as single space (line numbers are preserved)".
Post 13 Mar 2010, 06:25
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

hi baldr, Wink
I think I don't understand fully the meaning of your message.
1)
this below, does compile without problem;
Code:
/*init!!(!!)
A
--
db 0,\ (! 
   1,\ 
   2,\ !) 
   3

; the result is :
db 0,\
3
;-------------------------------------------
B
--
db 0,\ 
(! 1,\ 
   2,\ 
!) 3

; same result too.
db 0,\
3    

in both cases (above), and in any cases, line numbers are preserved.

Quote:

Your example looks suspicious (I mean implicit continuation): what if I add "666,\" after closing parenthesis? "666,"? Or single "666"? I think, stream comment should be like "can be placed anywhere space is allowed and behave as single space (line numbers are preserved)".


a)
stream comment should be like "can be placed anywhere space is allowed
and behave as single space (line numbers are preserved)".

no, but :

Can be placed anywhere (and nothing else),
and behave as "nothing" ... like "ghost comment".
And obviously, the line numbering is preserved in all cases.
Quote:

what if I add "666,\" after closing parenthesis?
"666,"? Or single "666"?


hummm, here, i don't quite understand.
like this ?
Code:
db 0,\ 
(! 1,\ 
   2,\ 
!) "666,\"   ;no problem with this, compilation ok

;or this (?) :

dd 0,\ 
(! 1,\ 
   2,\ 
!) 666,\
667          ;compilation ok too
    

baldr, Give me an example about what you think (about "666")
thank you.

PS : but why exactly "666" ? Confused ... about 2012 ? Shocked
is there a hidden message in this number ?
Wink

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 13 Mar 2010, 08:29
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
ouadji wrote:
Can be placed anywhere (and nothing else), and behave as "nothing" ... like "ghost comment".
I don't think this is right. Is «a/**/b,c» equivalent to «a b,c» or «ab,c»? I prefer former.

As to that 666 thingy (nothing special, I just punched random key on numpad thrice Wink):
Code:
; For the following to compile
db 0,\
(!
!)
1
; it should be equivalent to
db 0,\
\
\
1
; Am I right? If so, consider
db 0,\
(!
!) 666,\
1
; How it should be interpreted?    
Post 13 Mar 2010, 11:18
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

a)
a/**/b,c == ab,c (ghost comment)

mov/*comment*/eax,ebx == moveax,ebx
mov/*comment*/ eax,ebx == mov eax,ebx

b)
Code:
db 0,\ 
(! 
!) 
1 
; it should be equivalent to 
db 0,\ 
\ 
\ 
1
    
yes, above, it'scorrect.

but, it's just a virtual view
look below :
Code:
db 0,\
\
\
1 
nop   <--- line n°x

OR,

db 0,\
;ghost line with ghost "\"
;ghost line with ghost "\"
1
nop   <------- line n°x too

it's the same thing.
in fact, I just explained exactly the same as you by other way. Smile
    

Code:
db 0,\ 
(! 
!) 666,\ 
1 

==

dw 0,\
\
666,\
1         ;dw or dd, not db.

comment ==
a) ghost comment
b) + if need, ghost line (ghost "\") to preserve line numbering.
c) backslash effect, jumps over comment.
    



_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 13 Mar 2010, 11:46
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
ouadji,

Ability to splice two adjacent non-symbol sequences together still looks suspicious. How often do you need to place comment inside symbolic name/mnemonic/numeric constant? d/*efine*/b/*yte*/? Wink

I'm eager to get your next revision in my hands. Twisted Evil
Post 13 Mar 2010, 12:30
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
Quote:

Ability to splice two adjacent non-symbol sequences together
ability to splice ... i'm not agree.
if they are contiguous, they remain contiguous after too.
But if they are not, they are not after either !
Code:
abcd
ab/*v*/cd == abcd ;no changes

ab cd
ab/*v*/ cd or ab /*v*/cd == ab cd  ;no changes

;comment make no changes.
    
Code:
d/*efine*/b/*yte*/ 0 ;does compile. (== db 0)

d/*efine*/b/*yte*/0  ;does NOT compile (== db0)
    
yes, this above, does compile without problem.

Yes, I know ... it makes no sense to allow that.
This is the result of "ghost_engine" ... too permissive.

I think I'm going to prohibit this possibility.

But it is easier to allow it, than to remove it.
Delete this possibility, in fact, it's create a "engine exception".
I'll think about it !
Quote:
I'm eager to get your next revision in my hands
soon, in a few days Wink

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 13 Mar 2010, 14:59
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

That said, I don't see the interest, nor the sense to remove this possibility.
"We must know what we want". If we want a flexible engine which allows to place comments
wherever we want ... it's clear, in this case, this will allow the engine to go too far.
To avoid cases that have no meaning or usefulness, It should then analyze the meaning of the text,
the semantics around the comment. This would need an artificial intelligence engine.
The possibility of placing a comment in a symbolic name, obviously, makes no sense.
But it's the user not to use it.
Like, lea eax, [eax] .. allowed by the compiler, but it has no real meaning.
Also with macro language ..
there are a lot of ways to write a lot of things allowed, but that have meaningless.
Dialectic and Semantic are two very different things.
(sorry for English, I tried to do my best)


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


Last edited by ouadji on 13 Mar 2010, 23:41; edited 1 time in total
Post 13 Mar 2010, 17:25
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

Code:
/*init!!;\\;

db 0,\;\             ;== db 0,3
1,2,\;
3

1 passes, 2 bytes

/*idle!!

db 0,\;\           ;== db 0,1,2,3
1,2,\;
3

1 passes, 4 bytes
    

just the last for fun,
absolutely useless, but I find it very funny. Very Happy Very Happy

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 13 Mar 2010, 18:11
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
Code:
;Ouadji - Multiline Comments for FASM - revision 6 Smile
;------------------------------------------------------------
;words control : /*idle!! - /*init!!abcd
;------------------------------------------------------------
;3 Call from PREPROCE.INC (see attached files)
;------------------------------------------------------------

Multiline_Core:       cmp     al,"\"
           je      .main
               cmp     al,byte [@S_]
               je      .presumed
           cmp     al,"/"
            je      .presumed
           ret
                 
.presumed:      dec     esi
         push    ebx
         mov     bx,[@S_]
            cmp     word [esi],bx
               pop     ebx
         je      .main
               cmp     word [esi],"/*"
           je      .main
               inc     esi
         ret

;----------------------------------------------------------
.main:            pushad
              mov     dl,al
               xor     edi,edi
             xor     ebp,ebp
Engine:          
            call    Search_to_the_right
         jc      .wayout
             call    Search_absolute_end_comment
         jz      \
Engine
;----------------------------------------------------------

.wayout: add     [esp+24h],edi ;<---line numbering
                mov     [esp+04h],esi ;<---hide comments
         or      ebp,ebp
             jnz     .backgate

               popad
.final:            cmp     al,"\"
           je      .done

           mov     [esp],eax
           mov     eax,[back_]
         xchg    eax,[esp]
           ret

.done:           mov     byte[esi-1],al
              ret

.backgate:       cmp     ebp,1
               popad
               je      .final
              dec     esi
         cmp     al,byte[@S_]
                je      .final
              dec     esi
         ret

;====================================================
Search_to_the_right:

            cmp     ebp,2
               je      .failed
             xor     ebp,ebp

         mov     ecx,100h
            mov     ebx,-1

.loop_scan:   lods    byte [esi]

              call    Prohibited
          jnc     .abortChar

              cmp     al,20h
              je      .nextScan
           cmp     al,09h
              je      .nextScan

               push    eax
         mov     ax,[@S_]
            cmp     word [esi-1],ax
             pop     eax
         je      .found
              cmp     word [esi-1],"/*"
         je      .found

          call    CRLF_
               jc      .firstTwo
           cmp     al,";"
            jne     .abortChar

.fasm:            lods    byte [esi]
          call    Prohibited
          jnc     .abortChar
          call    CRLF_
               jnc     .fasm

.firstTwo:     inc     ebx
.nextScan:   loopz   .loop_scan
          jz      out_error

;----------------------------------------------------------

.two_crlf:      sub     edi,2   ;"edx" always >=2!
             sub     esi,4
               mov     word [esi],0A0Dh
            stc
         ret

.abortChar:      dec     esi
         or      edi,edi
             je      .failed
             dec     edi
         sub     esi,2
               mov     word [esi],0A0Dh
.failed:        stc
         ret

.found:          inc     esi   ;cy=0 from "je"
             ret

;====================================================
Search_absolute_end_comment:

            call    AccessRight
         jc      .done

           mov     ecx,1
               mov     ebx,20000h

.loopScan:        lods    byte [esi]

              call    Prohibited
          jnc     out_error
           call    CRLF_
               jc      .gonext
             call    Nestings
            jecxz   .done     ;end_comment found!

.gonext:       sub     ebx,1
               jnc     .loopScan
           jmp     out_error

.done:             cmp     dl,"\"
           ret

;====================================================
Nestings:       push    edx
         movzx   eax,word[esi-1]
             mov     edx,+1
              cmp     ax,[@S_]
            je      .core
               neg     edx
         cmp     ax,[@E_]
            je      .core
               pop     edx
         ret     

.core:              add     esi,2
               shl     eax,8                   
            or      eax,22000022h
               cmp     dword[esi-4],eax
            je      .quoted
             xor     eax,("'..'" xor '".."') ;(")<=>(')
              cmp     dword[esi-4],eax
            je      .quoted

         add     ecx,edx
             dec     esi
.quoted:     pop     edx
         ret

;====================================================
CRLF_:          cmp     al,0Dh
              je      .next
               cmp     al,0Ah
              je      .next
               clc
         ret
.next:               xor     al,(0Ah xor 0Dh)
            cmp     al,byte [esi]
               jne     .done
               inc     esi
.done:               inc     edi
         stc
         ret                     
;====================================================
AccessRight:
               cmp     byte [esi],"i"
            je      .confirm

.noCode:    cmp     [Gate],0
            jne     .back

.open:         mov     ax,[@S_]
            cmp     word [esi-2],ax
             jne     .back
               xor     ebp,ebp
             ret               ;nocy! (xor=clc)

.back:            mov     ebp,2
               stc
         ret

.confirm:        push    esi
         mov     ecx,6+4
.validate:       lods    byte [esi]
          call    Prohibited
          jnc     @F
          loop    .validate
@@:            pop     esi
         jnc     .noCode   ;ok=cy,Bad=nocy

               call    IDLE_Code
           jc      .done
               call    INIT_Code
           jc      .done

           ;(call      .mynextcode)                        
            jnc     .noCode
.done:           ret                     

;====================================================
IDLE_Code: cmp     dword [esi-2],'/*id'
              jne     .done
               cmp     dword [esi+2],'le!!'
              jne     .done

.idleCore:     add     esi,6
               not     [Gate] ;open<=>close gate
             mov     ebp,1
               stc
         ret

.done:           clc   ;ok=cy(+ebp),Bad=nocy
         ret
;====================================================
INIT_Code:  cmp     dword [esi-2],'/*in'
              jne     .done
               cmp     dword [esi+2],'it!!'
              jne     .done

.initCore:     add     esi,10
              mov     eax, [esi-4] ;new start/stop
                mov     [@SE_],eax
          mov     ebp,1
               stc
         ret

.done:           clc   ;ok=cy(+ebp),Bad=nocy
         ret

;====================================================
Prohibited:     cmp     al,1Ah
              je      .done
               or      al,al
               jz      .done
                       stc
.done:               ret     ;cy=0 from .done (je,jz)

;====================================================
out_error: popad
               mov     dword [esp],Error_message_1
         jmp     assembler_error

Error_message_1 db 'error multiline comments',0
;====================================================
    

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


Last edited by ouadji on 21 Sep 2010, 20:30; edited 3 times in total
Post 14 Mar 2010, 16:56
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16735
Location: In your JS exploiting you and your system
What will happen here:
Code:
/*init!!

mov eax,ebx
nop    
Question

or here:
Code:
/*init!!mo

mov eax,ebx
nop    
Question
Post 14 Mar 2010, 17:03
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
These are control words.
These words belong to a "syntax".
This syntax must be respected.

Being able to follow a syntax,
is also the beginning of the learning of programming

What will happen here ?
Code:
a) format MS COFFmo

b) format MS

c) mov eax, mo

d) mov eax,
    

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 14 Mar 2010, 17:20
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16735
Location: In your JS exploiting you and your system
So does your code detect an error or does it carry on through and make a mess of things?
Post 14 Mar 2010, 17:21
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

correct ! good idea for improvement, thank you.
this will be done in Version 7

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 14 Mar 2010, 17:29
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

revision 7 in progress

in normal use, the sequence "§--§" is allowed.
Here, it's only to check syntax engine.

Image Razz

if the sequence contains special characters (CR, LF ... or other)
in this case, the error message replaces these characters not viewable by question marks.
Code:
//init!!§ <--- CRLF 
--§ 
/ * i n i t ! ! : invalid sequence : §??-  ;§(CR)(LF)--§
    


also this,
Now the syntax requires that the start sequence
and the end sequence are identical, but reversed.

Image

If you have any suggestions and ideas about this, tell me.
thank you. Wink

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 15 Mar 2010, 01: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:  
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next

< 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-2019, Tomasz Grysztar.

Powered by rwasa.