News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

More Traditional syntax in future HLA versions

Started by indiocolifa, September 15, 2006, 08:34:25 PM

Previous topic - Next topic

indiocolifa

I like the HLA syntax, and the things that are possible with it like instruction composition. But how about including a more "traditional" syntax (e.g: no parenthesis)?

I think the code will be cleaner and many NASM/TASM/MASM/FASM programmers will come to the HLA world.

For example, instead of "procedure" why not PROC ?

Well ...

THank you very much.

BKastenholz

The nice thing with HLA is that you can define your own syntax .
If you want to use PROC instead of procedure than write a macro PROC.
Here is an example:

program macrotest;

#include("stdlib.hhf")

#macro proc(_proc_[]):
   _pvalueArray_,
   _lastValue_,
   _signature_,
   _curparam_;
      
   ?_procname_:string := @string(_proc_[0]);
   ?_curparam_:uns32 := 1;
   ?_signature_ := "";
   
   #while(_curparam_ < @elements(_proc_))
      ?_pvalueArray_ := @tokenize(_proc_[_curparam_], 0, {':'}, {} );
      ?_lastValue_ := @elements( _pvalueArray_ ) - 1;
      
      #if(_curparam_ = 1)
         ?_signature_ := _proc_[_curparam_];
      #else
         ?_signature_ := ?signature_ + ";" + _proc_[_curparam_];
      #endif
      
      ?_curparam_ := _curparam_ + 1;
   #endwhile
#print(   "procedure " + _procname_ + "(" + _signature_ + ");")
   @text("procedure " + _procname_ + "(" + _signature_ + ");")
   @text("begin " + _procname_ + ";")
   
   #terminator endp;
   @text("end " +  _procname_ + ";")
#endmacro

proc(mytestproc, i:int32);
   stdout.put("test",nl);
endp;

begin macrotest;
   mytestproc(88);
end macrotest;


Best
Bernd

Randall Hyde

Quote from: indiocolifa on September 15, 2006, 08:34:25 PM
I like the HLA syntax, and the things that are possible with it like instruction composition. But how about including a more "traditional" syntax (e.g: no parenthesis)?

I think the code will be cleaner and many NASM/TASM/MASM/FASM programmers will come to the HLA world.

For example, instead of "procedure" why not PROC ?

Well ...

THank you very much.


While there are good arguments for allowing a "traditional" syntax in HLA, attracting programmers from other assemblers just isn't one of them. When I first released HLA way back in Sept 1999, I harbored thoughts that existing assembly language programmers would want to switch. It took me about three weeks to realize that this was *never* going to happen en masse. The problem is that once most people have learned one assembler, it's unlikely they're going to be willing to put in the effort to learn another assembler unless they're really unhappy with the one that they've learned.  Sure, a few people here and there will switch because of some "coolness" factor, but you certainly don't want to waste an inordinate amount of effort trying to please that crowd, as you're not going to please them unless their programs will compile 100% unchanged on your assembler, anyway.

That being said, I do have ultimate plans for HLA v2.0 to support what I call "templates" that allow you, within some limits, to create statements with any syntax you choose.  In particular, you will be able to create statements that don't require the parentheses.  That will achieve part of what you're asking for.
Cheers,
Randy Hyde

Evenbit

You can already do this (to some degree) for MASM, FASM, and GAS by using the #asm, #endasm, and #emit() directives:

http://webster.cs.ucr.edu/AsmTools/HLA/HLADoc/HLARef/HLARef15.html#1028044

Nathan.