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

Quote:

/***/
/* **/
/** */

/** *//***//*/*
**/***/nop/*******/ ; Wink for the fun !


ok, fixed.

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


Last edited by ouadji on 21 Sep 2010, 20:19; edited 1 time in total
Post 16 Feb 2010, 12:52
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
ouadji,

Probably you should write specification first? It's easier to find flaws in the entire scheme than construct test cases looking at the source.
For example, this does not compile:
Code:
db "Hello"/*,"world!"*/,0    
but this does:
Code:
db "Hello",/*"world!",*/0    
Post 16 Feb 2010, 15:03
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

Code:
/* nop \/* nop */

    

does not compile.
I know why ! a stupidity Rolling Eyes
Code:
\/*  ; it's a somewhat special sequence.
    

I'll fix it !


@baldr
Code:
db "Hello"/*,"world!"*/,0

    


ok ... all this is the result of a unique (single ??) problem.
Quote:

Probably you should write specification first ?

no ... He "must" work in all cases ! Razz

i will fix it.

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



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

Baldr ok, I saw why this does not compile !

"/*" preceded by <"> or <'> is also a bit special.
I have not included these particular sequences in the case of nesting.
stupid of me ! i will fix all this.

Your feedback is very important for me, thank you !

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



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
Code:
/* nop \/* nop */ 

    
above, does not compile ... !! Laughing Laughing this is normal! (I go crazy) Wink
Code:
/* nop \"/*" nop */ <---- when nested, </*> or <*/> --> ' or " !

    

when it is nested, I have to put </ *> or <* /> between < '> or < ">

.... I soon finished solving the problem raised by Baldr.

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



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

Code:
all ok
------
db/* nop \"/*" nop */0

db 'Hello'/*,"world!"*/,0
db "Hello",/*"world!",'*/0

and this, below ... Smile

/*
db 'Hello'/*,"world!"*/,0
db "Hello",/*"world!",'*/0
*/


db "/*Hello*/Hello"/*/*        \
'comments                |
'*/'                     |  funny, no ? Smile                            
'*/'*/"Hello"             |
*\*/                      /

db "Hello",/*"*/""Hello"''*/0

db "/*comment='/*'*/"/*db "/*comment='/*'*/"*/
    

problem reported by Baldr, fixed.

Of course, feedback and results of your tests are welcome ! Wink


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


Last edited by ouadji on 21 Sep 2010, 20:20; edited 2 times in total
Post 16 Feb 2010, 17:00
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
ouadji,

You may consider this artificial, but nevertheless:
Code:
db 7,\/*
   8,9,*/10    
doesn't compile. Wink

Without clear specification it's all about contrivance to make particular code fail.
Code:
startcomment fix /*
endcomment fix */
startcomment Hell, it's a cruel world! endcomment    
Post 16 Feb 2010, 20:18
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

for this, it's normal it does not compile.

but ... i will try to fix it, and that this example also compiles
it should be possible! Wink
just a matter of algorithm, no ? Razz

specification ?
start : /*
end : */
inside, for /* and */ --> "/*" (or '/*'), "*/" (or '*/')
that's all.

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



Joined: 19 Mar 2008
Posts: 1651
ouadji,
Code:
; I consider
db 7,\/*
   8,9,*/10
; as a shortcut to
db 7,\;
\; 8,9,
   10
; with line numbers retained    
About your specification… So nested /* or */ would catenate with adjacent string literal (inserting single or double quote as it should)? Not good.

Start small. Unnestable '/*' '*/' with the ability to insert them anywhere ';' goes. Regard fixing and line numbers. Consider open comments in macros and their expansions (or deny them altogether). fasm's preprocessing stage (Tomasz, I apologize for that) is quite a mess already, and we don't have the debugger for it! Wink

As a sidenote, fasmpre was a beautiful tool for debugging macros. Tomasz, would you rewrite it to compile on current codebase (or at least make "Build symbols" able to save partially built .fas in case of error)?
Post 16 Feb 2010, 21:28
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

it's very nice of you, but I have another approach to the problem.
with "\" just before the comment, it's a special case ...
macros and comments are different problems.
you have pinpointed a particular case.
(one of the only remaining, or perhaps even the only).
but I'll fix that.

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



Joined: 19 Mar 2008
Posts: 1651
ouadji,

It's not a nit-picking. As I can see now, there are several flaws in the design (sorry, I have to be harsh in order to help these useful changes make their way into stable release). Would you like to see my debug build of fasm? It dumps everything as it interprets it.

By the way, excessive indentation and/or extra space after first operand (before comma) wouldn't help to integrate into existing codebase. Would Tomasz like it? I dunno. Wink
Post 16 Feb 2010, 22:37
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

my English is not very good,
and your text is quite complex for me. I can not understand everything.
Quote:

By the way, excessive indentation and/or extra space after first operand (before comma) wouldn't help to integrate into existing codebase. Would Tomasz like it? I dunno.
this, above:
I think i understood.
do not worry, Wink
I can fix this and remove the spaces and unnecessary indentations,
no problem.
Quote:

there are several flaws in the design.
I think the problem you raised is one of the last, probably the last one.
and your comments do not bother me absolutely not. Wink
Quote:

Would you like to see my debug build of fasm?
It dumps everything as it interprets it.

humm ... i don't understand this, sorry.
your "debug build of fasm" ?
Yes, but I don't know exactly what it is.
I don't quite understand this term "debug build" (?)


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



Joined: 19 Mar 2008
Posts: 1651
ouadji wrote:
my English is not very good,
As mine does.
ouadji wrote:
I think the problem you raised is one of the last, probably the last one.
Probably, but I don't think so. The problem is inherent to the design of your inserts: they're not compact (in the sense of set theory Wink).

As for my custom build of fasm — it dumps everything after preprocessing into chosen file. Helps to understand where is the point of failure in my macros (yours too Wink) Unless Tomasz reborns fasmpre, it's my debugger for macros and such.
Post 16 Feb 2010, 23:43
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

for baldr and for all

I'd like, please, that you test this version.

find cases that do not compile to help me to improve the algorithm!
thank you very much ! Wink

but watch this:
for example ... cases below do not compile, but this is normal !
the interpretation is ambiguous.
This case is impossible to solve ... there are others.
This would require a global analysis of context.
Here, it is not a question of dialectics, but of semantics.
Code:
         

db "hello","/*" c "*/hello" 

== "hello","/*" + c "*/hello" 
or 
== "hello"," + /*" c "*/ + hello" 
=> ??? impossible to choose !!

and this: 
db "hello", /* c "*/"hello" ......... Waiting endlessly for </*> ! 

and this, below  ... does not compile
why ? here, it's a choice from me. it must remain consistent !

db 0,\
 /*comment*/   
1     <---  "1" is alone !
or 
db 0,1,\ /* com
ment*/     <-- no problem for the truncated comment
1    <--- but here, "1" is alone too !

it is not impossible to do,  it's a choice from me.

Having said that, this does not compile either 
db 0,\
;  fasm comment    Wink 
2  
    

but there are all other cases Wink
Quote:

all below is ok
----------------
nop
/*
comment
comment
....
*/
nop

mov /* comment */ eax , /* not edx !!! */ ebx <- basic comment ! Smile

nop /* comment
/* com <----- a bit more complicated, just a littel bit Razz
ment */
*/


/*
/*comment2*/comment1
*/

/* don't look here */ ;'

/* xor /*?*/eax,eax ;zero eax */

mov eax, /* comment - /*stop*/*/ 'halt'

/* comment */ mov eax , eax

stdcall /* comment /* A/*B/*C*/D*/E*/ */ MyProc, eax, ebx /*
comment */ , ecx, edx

MyProc /* comment */ : /* /*"C" */ comment */ ret

stdcall KeGetCurrentIrql,eax,\
ebx,\
/* ecx/*C/*not D*//*not E <--- i love this Laughing
*/*/,*/\
edx


/*
cmp ebx,"/*" - cmp ecx,'/*' - '*/' but ?
*/

/* comment *//* comment */

mov ecx,/*comment/*comment2*/*/'/*'
mov edx,'*/'

/* 1 '/*' */
dw/* 1 "/*" */"/*",/*null*/0


mov /*a;b/*not b<-a*/*/al,0/*but not/*al,'*/' */ok?*/

mov ecx,'/*' /*
movhlt edx,"*/" /* mov ecx,'/*' */*/


/*;*/db 0,/*;*/0;/*,1/*;/*,2

nop /* nop
*/

/*
nop*/nop/*
*/

nop
/***/
/* **/
/** */

/** *//***//*/*
**/***/nop/*******/

db/* nop \"/*" nop */0


db 'Hello'/*,"world!"*/,0
db "Hello",/*"world!",'*/0 ;'

db "/*Hello*/Hello"/*/*
'comments
'*/'
'*/'*/"Hello"
*\*/
;'

db "Hello"/*,"world!"*/,0

db "Hello",/*"*/""Hello"''*/0
;"?*/'Hello'/*,0,"Hello""*/",0
/*
db 'Hello'/*,"world!"*/,0
db "Hello",/*"world!"','*/0
*/

nop

db 7,\/*8,db 'Hello'*/
/*'*',"world!",0,
9,*/10

db 5,\ /*8,
9*/0

db 0,1,\/*2c ;kdkdk
o'*/'mment*/\ ;
1,\
3/*comment*/

PS:

1)
Inside a nesting, the symbols "/*" and "*/"
must be surrounded by '"' or "'".
2)
The symbols of openness and closure of a comment block or internal nesting,
can't be surrounded by the symbols "'" or '"' .
3)
"/*" or "*/" can not be cut in half, look at this below :
Code:
db 0,/* comment *
/1    

does not compile.
initially, this was ok ! but I deleted it, to keep the logic and coherence.
(cohesiveness of meaning .... my english, ooops Confused )

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


Last edited by ouadji on 21 Sep 2010, 20:25; edited 3 times in total
Post 18 Feb 2010, 21:37
View user's profile Send private message Send e-mail Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 754
Location: Massachusetts, USA
baldr wrote:
Would you like to see my debug build of fasm? It dumps everything as it interprets it.

Yes, please do share sources with us!

_________________
Coding a 3D game engine with fasm is like trying to eat an elephant,
you just have to keep focused and take it one 'byte' at a time.
Post 19 Feb 2010, 02:36
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

Wink

Please, could you try this last release, above.
("fasm 1.69.12 multiline comments (test bench).rar")
and give me your results (cases that don't compile)
it would help me to Improve the algorithm.
Alone to test it, this is not very effective. Confused

thank you very much. Razz


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



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

I found an error in the algorithm, a stupid thing Rolling Eyes

I will fix it !

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



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

I develop a new algorithm, more efficient and more powerful.
And most importantly, it analyzes the immediate environment of each Comments (the "code-context").
It allows to go further and resolve situations which hitherto was unresolved.
This is really fun and exciting. Wink
I think there ... even those who are skeptical, will be interested.
I hope Smile

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



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
hi Wink
Code:
does compile ... and much more
------------------------------
mov\ ;fasm
/*      ;fasm
 */ /* c */ eax /* comment */\ /*com*/ /* com-    ;fasm
ment*/ \  /* com */   ;fasm
,/* c       ;fasm
*/\/*c*/           ;fasm
/*c*/ebx/*c*/  ;fasm
mov ecx,edx


just below, this does not seem difficult ... and yet, it is complex !
but here, it's a case that has substantially improved the algorithm

db 0, \
/*comment*/  ;link spreads over comments (over, above ?)
1,\
/*comment*/
2

;but also,

db 0,1
/*comment*/ 
db 2,3
/*comment*/
db 4,5

;in fact, 
;you have to think like if the comments did not exist. 
;Mentally you remove it.

    

Here is my last version of Fasm "multiline comments".
The algorithm is completely different,much more structured and much more powerful.

I think this algorithm is compact, in the sense of set theory (for Baldr).
Please, could you test this version and give me your results.
I'd like you to give me cases that do not compile.

If you find a case that does not compile, be careful at the logic of your text,
because this algorithm is quite logical (in any case, I hope Razz )
You have to think like if the comments did not exist, and mentally you remove it.

Baldr, Wink
I removed and cleaned up the source file of all unnecessary spaces and tabs.
Except in my code ... it clearer to me with spaces and tabs (for my code)

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


Last edited by ouadji on 21 Sep 2010, 20:22; edited 1 time in total
Post 22 Feb 2010, 10:43
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

a stupid forgetfulness, line 2642, in PREPROCE___.INC
Code:
PREPROCE___.INC - line 2642

je abort_s (obviously !!!)
and not,
je found_again_text_or_stop  
    
absolutly no changes in the algorithm,
just a small and very stupid coding error.

Rolling Eyes Rolling Eyes

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


Last edited by ouadji on 21 Sep 2010, 20:22; edited 1 time in total
Post 22 Feb 2010, 17:09
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.