Related articles |
---|
HLA v1.32 is now available rhyde@cs.ucr.edu (Randall Hyde) (2002-03-19) |
From: | "Randall Hyde" <rhyde@cs.ucr.edu> |
Newsgroups: | comp.compilers |
Date: | 19 Mar 2002 16:17:44 -0500 |
Organization: | Prodigy Internet http://www.prodigy.com |
Keywords: | assembler, available |
Posted-Date: | 19 Mar 2002 16:17:44 EST |
HLA (the High Level Assembler) is a compiler for an x86 assembly
language that supports both high-level and low-level language
features. HLA v1.32 (the thirty-second version) is now available.
HLA v1.32 runs under both Windows and Linux. Best of all,
(well-written) HLA programs will compile and run on either operating
system unchanged! (Who says assembly language can't be portable?)
You can download a Linux or Windows (or both) version of HLA v1.32
from http://webster.cs.ucr.edu
HLA, the High Level Assembler, is a powerful x86 assembly language
that supports a Pascal/C/Modula-2-like syntax that makes learning and
using assembly language very easy. Although originally written as a
tool to teach assembly language programming to University Students,
HLA's advanced features make it a natural for advanced assembly
language programmers as well.
The HLA package includes the "HLA Standard Library" a package of
hundreds of functions, macro, data declarations, and other HLA code,
that makes assembly language programming trivial. The HLA Standard
Library is available for Linux and Windows, so code that calls the HLA
Standard Library is portable between the two OSes.
A Linux edition of "The Art of Assembly Language Programming" provides
the perfect text for beginners who know a high level programming
language and want to learn assembly language programming under Linux.
You can find "Art of Asm" at the Web URL above.
In addition to the 1,500 pages appearing in the "Art of Asm," the HLA
package also includes over 500 pages of documentation, articles, and
other information related to HLA programming.
Programs written in HLA are far more readable than programs written in
traditional assembly language. For example, here is the ubiquitous
"Hello World" program written in HLA:
program HelloWorld;
#include( "stdlib.hhf" )
begin HelloWorld;
stdout.put( "Hello World" nl );
end HelloWorld;
No, this doesn't look at all like assembly language, but that's
because it's such a trivial program (just invokes a macro in the HLA
Standard Library). Here's a more practical example that actually has
some recognizable machine instructions in it:
program DemoRecursion;
#include( "stdlib.hhf" );
var
myfib:int32;
/*
** Compute fibonocci sequence (digusting, slow, way )
** using a recursive call.
*/
procedure fib( n:int32 ); @nodisplay;
begin fib;
if( n <= 2 ) then
mov( 1, eax );
else
mov( n, eax ); // Compute fib( n-1 );
dec( eax );
fib( eax );
push( eax ); // Save result of fib(n-1);
mov( n, eax ); // Compute fib( n-2 );
sub( 2, eax );
fib( eax );
add( [esp], eax ); // Add fib(n-1) and fib(n-2)
add( 4, esp ); // Clean up stack.
endif;
end fib;
begin DemoRecursion;
mov( 0, myfib );
while( myfib < 10 ) do
fib( myfib );
stdout.put( "fib(", myfib, ") = ", (type int32 eax ), nl );
inc( myfib );
endwhile;
end DemoRecursion;
For die-hard assembly fans, don't get the impression that you have to
use statements like "IF" and "WHILE" in an HLA program. HLA also
allows CMPs and conditional jumps if you prefer to write your assembly
code the old fashioned way.
HLA is totally free (i.e., public domain) and is available in
executable and source form. HLA was written using Flex/Bison/C and a
few lines of assembly code (HLA).
Randy Hyde
Return to the
comp.compilers page.
Search the
comp.compilers archives again.