flat assembler
Message board for the users of flat assembler.

flat assembler > Compiler Internals > Block comments (infinity+n)th attempt


Proposals (a) and (b) please vote after carefully reading COMPLETE POST
(a) great (b) great
8%
 8%  [ 1 ]
(a) great (b) neutral
0%
 0%  [ 0 ]
(a) great (b) evil
0%
 0%  [ 0 ]
(a) neutral (b) great
0%
 0%  [ 0 ]
(a) neutral (b) neutral
8%
 8%  [ 1 ]
(a) neutral (b) evil
0%
 0%  [ 0 ]
(a) evil (b) great
16%
 16%  [ 2 ]
(a) evil (b) neutral
0%
 0%  [ 0 ]
(a) evil (b) evil - only ";" for comments and nothing else
50%
 50%  [ 6 ]
Don't understand / know / care / other
16%
 16%  [ 2 ]
Total Votes : 12

Author
Thread Post new topic Reply to topic
DOS386



Joined: 08 Dec 2006
Posts: 1904
.

.

(a) add a directive like blockskip or whatever (name to be discussed out) followed by a string (not a single character, string length limits and charset to be discussed out)
Code:
blockskip hehe
  void blah(void)
  /* this function won't work 
  #if 0
    int a=0; // What the **** is the size of "int" in C ???
    /* hey, unbalanced comments
   ; junkkkkkkkkkkkkkkkkkk
   if (a=0) /* then */ {
      break;
   {{{{{
   // OOps, (a=0) or (a==0) above ????
hehe
    

Maybe it should be restricted that block comments may not begin or end in the middle of a line, so
Code:
  mov eax, 0  blokship xxx
    

and (comment block)
Code:
sdkfjsdkfjsdklfjslkdfjskldjl xxx ret 
    

would be invalid Shocked

(b) Add /* blah */ but with the restrictions that thay may not be nested and may not span multiple lines, so a comment begins at "/*" and ends at "*/" or end of line, so

Code:
/* 0F 0B */ UD2 ; BOOM
    

or
Code:
/* /* /* blah
   pushd 0
   call ExitProcessEx 
    

would be valid while
Code:
/* this is a comment
and */  wrmsr
    

would not.

Tomasz wrote in http://board.flatassembler.net/topic.php?p=112215#112215 (2010-Mar-21) :

Thanks for clarification.

Quote:
Thus I'm going to recapitulate: no, I don't plan to implement such feature (and even if I were, it would be likely MASM/TASM-style COMMENT directive, which was a line-based one


So (a) does have a chance ??? Wink

Quote:
The reasons for my decision are quite nicely summarized by this post from JohnFound.


JohnFound wrote (2004-Dec-07) :

Quote:

block comments having "stream" structure (not "line" structure) interfere with the one of the main principles of assembly languages - "line-based" structure of the source.
Of course it is not so much work to make such comments for FASM (for example FASM's macroses and some preprocessor directives have "stream" structure as well) , but there will be some problems with readability of the code.
Also, as far as, the assembly language editors (I am talking about FASMW and Fresh) are line based. So, it will be hard to provide syntax highlighing for block comments without big rebuild of AsmEdit control.
Without syntax highlighting, big block comments (more than one screen) can impact the readability of the source, because there is no way to determine that this is a commented block other than syntax highlighting.

On the other hand, Fresh have functions for block comment/uncoment of group of lines. IMHO, such function can be very decent replacement for block comments, without changing of FASM syntax and without negative effects.


The highlighting is IMHO a minor issue.

Tomasz wrote :

Quote:
As for quickly commenting large block of code, there was a plan that such a feature of editor (insert/remove semicolons from the beginnings of lines in the selected text) would be implemented as a plugin for fasmw (by the way, there are other editors that have such feature already and can be used with fasm).


OK, this would help also (as an official feature of the IDE's). Smile

What about

* include string (any, not only ";" ) at the begin of every line

and

*

cut n chars (n>=1) at the begin of every line

for a range of lines ? Idea

Quote:
And as for the topic of other people contributing something to fasm, check out this thread.


http://board.flatassembler.net/topic.php?t=7882 " fasm packaging as a project for the community" 2007-Nov-25

It's about include files, a thing I personally don't appreciate / use that much, so not very interesting to me. The message is "don't contribute patches to the core" ...

http://board.flatassembler.net/topic.php?t=2237 "comment feature?" 2004-09-12
http://board.flatassembler.net/topic.php?t=2707 "Add block-comments into Fasm?" 2004-12-07 with POLL
http://board.flatassembler.net/topic.php?t=7115 " Multiline /* ... */ comments in FASM." 2007-05-27 by MHajduk in Compiler Internals
http://board.flatassembler.net/topic.php?t=7481 " Comments in FASM." 2007-08-09
http://board.flatassembler.net/topic.php?t=8419 "Looking forward fasm 1.67.27 released" in Main

Please vote, note that my proposals are updated according to past discussions, and ... this is a theoretical poll not necessarily having any impact on FASM development by Tomasz.

EDIT : smaller link list, see latest http://board.flatassembler.net/topic.php?t=13186


Last edited by DOS386 on 27 Jul 2011, 06:20; edited 4 times in total
Post 23 Mar 2010, 07:52
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15976
Location: Qo'noS
(a) This would make my editor program cry. How to implement highlighting into an existing editor (other than fasmw of course)?

(b) What this allows is to put comments at the beginning or middle of a line. I don't feel that assembly syntax really works that way. I have yet to see an example where this is really beneficial. Every time someone here posts something with prefixed or infixed comments it looks like an ugly mess and does nothing to improve readability IMO.

My editor has a perfectly functional keystrokes that allows me to insert or delete ";" at the beginning of selected lines. I've never felt the need for anything else. It doesn't break any existing syntax highlighting and it is easy to spot which lines are non-functional. But please feel free to post an example where your proposal is needed and makes things clearer.


Last edited by revolution on 23 Mar 2010, 09:18; edited 1 time in total
Post 23 Mar 2010, 08:23
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6927
Location: Kraków, Poland
DOS386 wrote:
So (a) does have a chance ??? Wink

No, it would have to be COMMENT, not BLOCKSKIP. Wink

DOS386 wrote:
The highlighting is IMHO a minor issue.

For me it's not so minor. This is the main practical point that holds me from even considering multi-line comment features, I don't want the context-dependent highlighting.

Still, the main JohnFound's point was about this being in conflict with assembly row-based structure - the very same reason that fasm doesn't have inline macros for. And this is the main theoretical point.
Post 23 Mar 2010, 08:39
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4160
Location: 2018
why does you all want a new way to add comments?

don't you have other problems to solve, like coding good codes and applications?

i see it like a time loss to think about a new way to refund fasm syntax.

for me, current fasm syntax cannot be better, because it is the simpler you can have:

Code:
label: inst op1,'op2' ;comments
    

why do you want to overcomplicate teh fasm synatx?
please, go code applications that can represent the fasm community and stop the very boring discutio s about the basic syntax.

if you want complex syntax, go code in another language on another plaform and stop attempts to pollute the fasm source code with useless concepts. Smile
Post 23 Mar 2010, 09:14
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
revolution wrote:

Quote:
(a) This would make my editor program cry.


I haven't been aware of your editor Shocked Where is it ???

Quote:
How to implement highlighting into an existing editor (other than fasmw of course)?


No idea ... FASM is the only one that works for me. And, how many FASM'ers would brute-force through C++ or VB.NET editors for the heck of patching them ? Wink

Quote:
(b) What this allows is to put comments at the beginning of middle of a line. I don't feel that assembly syntax really works that way. I have yet to see an example where this is really beneficial.


Disassemblers. Wink

Quote:
Every time someone here posts something with prefixed or infixed comments it looks like an ugly mess and does nothing to improve readability IMO. But please feel free to post an example where your proposal is needed and makes things clearer.


http://board.flatassembler.net/topic.php?p=90743#90743 in http://board.flatassembler.net/topic.php?t=9911 2009-Mar-08

http://board.flatassembler.net/topic.php?p=73435#73435 in http://board.flatassembler.net/topic.php?t=8419 2008-Mar-16

Quote:
My editor has a perfectly functional keystrokes that allows me to insert or delete ";" at the beginning of selected lines. I've never felt the need for anything else. It doesn't break any existing syntax highlighting and it is easy to spot which lines are non-functional.


Good Smile I'd like to see it ...

Tomasz wrote:

Quote:
And this is the main theoretical point.


So we have idea (c) : add something cool into the IDE's Idea

Well, it would not have to at the beginning of line, just anywhere:

- If there is a selection, take top left corner of selection as
starting point and the selection (vertical or non-vertical) height (!) as range of lines

- If the is no selection, use cursor position and ask for height (amount of lines)

- In both cases, ask for string to insert into the lines or amount of char's to kick Wink

edfed wrote:

Quote:
don't you have other problems to solve, like coding good codes and applications?


Waiting for your "good codes and applications" or good examples at least, don't forget your clone of Windaube 98 Evil or Very Mad

EDIT : more links


Last edited by DOS386 on 23 Mar 2010, 09:35; edited 1 time in total
Post 23 Mar 2010, 09:24
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6927
Location: Kraków, Poland
OK, I feel the rising of the pressure on me to get FASMW plugin system finished at last. Smile
Post 23 Mar 2010, 09:30
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15976
Location: Qo'noS
DOS386 wrote:
And, how many FASM'ers would brute-force through C++ or VB.NET editors for the heck of patching them ? Wink
Well that is the point actually, no one has the time to alter their editor, so highlighting becomes wrong.
DOS386 wrote:
I'd like to see it ...
Nothing special, notepad2.
Post 23 Mar 2010, 09:30
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
> rising of the pressure on me to get FASMW plugin system finished at last.

Will it work in DOS also ?

> Well that is the point actually, no one has the time to alter
> their editor, so highlighting becomes wrong.

My code doesn't have to look great outside FASM editors Wink

> Nothing special, notepad2.
> © Florian Balmer 1996-2010

Voila: revolution = Florian Balmer
Post 23 Mar 2010, 09:44
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4160
Location: 2018
yeepee! revolution is swiss.

do you know Bernard Rappaz? in the "vallais" country?

i like his job.
Post 23 Mar 2010, 10:10
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6927
Location: Kraków, Poland
DOS386 wrote:
> rising of the pressure on me to get FASMW plugin system finished at last.

Will it work in DOS also ?

What made you think something like that?
Post 23 Mar 2010, 10:16
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15976
Location: Qo'noS
DOS386 wrote:
Voila: revolution = Florian Balmer
Hehe, do you think I would write such a thing in HLL?

"my", as in the one I use. Not the one I wrote, or any other meaning.

Windows is my OS. OMG, I am Bill Gates, someone shoot me quickly. Wink
Post 23 Mar 2010, 10:51
View user's profile Send private message Visit poster's website Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
DOS386 wrote:

> Nothing special, notepad2.
> © Florian Balmer 1996-2010
Voila: revolution = Florian Balmer

And you might be German as for me :)

Tomasz Grysztar wrote:

I feel the rising of the pressure on me to get FASMW plugin system finished at last.

I feel there will be confusion then like /* */ */.
AFAIK, { { } is not allowed in macro, still i can be wrong.

revolution wrote:

Nothing special, notepad2.

Notepad++ is more powerful and uses same scintilia.
Post 25 Mar 2010, 22:59
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15976
Location: Qo'noS
Notepad++ had too many annoying bugs the last time I tried it.

{ { } is allow in macros. I use it in some of my macros. But this is an entirely different thing from comments.
Post 25 Mar 2010, 23:16
View user's profile Send private message Visit poster's website Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
Just found this discussion about comments (several threads).

The arguments against multiline comments or block comments are not relevant in praxis because everybody can avoid things like mov ax,'/*' or can avoid using block comments in these code sections. This is not really a reason to disallow block comments at all.

Even other languages like C++ have problems with some kind of nested comments - everybody know it and everybody know how to avoid it. Even you see if lines are interpreted as comments or not because comments have other color.

The main thing is that somebody needs a conveniente way of commenting code (maybe 20 or 30 or more lines) and uncommenting it for test purposes and not really for doing comments. Even somtimes you have to uncomment several blocks.

For really commenting ";" is okay but if you copy comment blocks from somewhere else (documentation written in text editor) to source you have to do a lot of unneccessary finger work. A workaround could be a function with marking textblock with the mouse and then give a command like comment and editor places a ";" in front of each text line and removes on request vice versa.

Maybe here are some macro freaks who can develop a macro which converts

Quote:

/*
some line of text
some line of text
some line of text
some line of text
*/


into

Quote:

;some line of text
;some line of text
;some line of text
;some line of text


for not confusing the compiler.

Just my 2 cents. Cool
Post 02 Apr 2010, 17:05
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium

Code:
/* 
some line of text 
some line of text 
some line of text 
some line of text 
*/ 
    
I've already seen this somewhere Razz

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 08 Apr 2010, 08:54
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-2018, Tomasz Grysztar.

Powered by rwasa.