Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
High Level Assembly
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Distinguishing features == Two HLA features distinguish it from other x86 assemblers: its powerful macro system (compile-time language) and the HLA Standard Library. === Macro system === HLA's compile-time language allows easy extension of the language, even enabling the creation of small [[domain-specific language]]s to simplify common programming problems. The macro <code>stdout.put</code> is a good example of a sophisticated macro that can simplify programming. Consider the following invocation of that macro: <code>stdout.put( "I=", i, " s=", s, " u=", u, " r=", r:10:2, nl );</code> The stdout.put macro processes each argument to determine its type and then calls an appropriate procedure in the HLA Standard Library to handle the output of each operand. Most assemblers offer some macro capabilities. HLA's advantage over other assemblers is its ability to process macro arguments like <code>r:10:2</code> using HLA's extensive compile-time string functions. HLA's macro facilities can also infer variable types and use that information to direct macro expansion. HLA's macro language provides a special ''Context-Free'' macro facility. This feature allows easy writing of macros that span other code sections via a ''starting'' and ''terminating'' macro pair (along with optional ''intermediate'' macro invocations available only between the start–terminate macros). For example, one can write a fully recursive-nestable SWITCH–CASE–DEFAULT–ENDSWITCH statement using this macro facility. Because of the HLA macro facilities' context-free design, these switch..case..default..endswitch statements can be nested without conflicting code emission. === Compile-Time Language === The HLA macro system is a subset of the larger HLA ''Compile-Time Language'' (CTL). The HLA CTL is an interpreted language available within an HLA program source file; hence the name ''compile-time language''. The HLA CTL includes control statements such as #IF, #WHILE, #FOR, #PRINT, and an [[Assignment (computer science)|assignment statement]]. One can also create compile-time variables and constants, including structured data types like records and unions. The HLA CTL also provides hundreds of built-in functions, including a rich set of string and pattern-matching functions. The HLA CTL allows programmers to create CTL ''programs'' that scan and parse strings, enabling the creation of ''embedded [[domain-specific language]]s'' (EDSLs, also termed ''[[mini-language]]s''). The <code>stdout.put</code> macro mentioned earlier is an example of such an EDSL. The put macro (in the stdout namespace, hence ''stdout''.put) parses its macro parameter list and emits the code that will print its operands. === Standard library === The HLA Standard Library is an extensive collection of pre-made routines and macros (like the stdout.put macro described above) that simplify programming by preventing programmers from starting from scratch for each new application. Perhaps equally important, the HLA Standard Library allows programmers to write portable applications that run under Windows or Linux by simply recompiling the [[source code]]. Similar to the [[C standard library]] for the programming language [[C (programming language)|C]], the HLA Standard Library allows users to abstract away low-level [[operating system]] (OS) calls, so the same set of OS [[application programming interface]]s (APIs) can serve for all operating systems that HLA supports. While an assembly language allows making any needed OS calls, using the HLA Standard Library API set simplifies writing OS-portable programs. The HLA Standard Library provides thousands of functions, procedures, and macros. As of mid-2010 for HLA v2.12, the library included functions in these categories (though the list changes over time): * Command-line argument processing * Array (dynamic) declaration and manipulation * Bit manipulation * Blob (binary large object) manipulation * Character manipulation * Conversions * Character set manipulation * Date and time functions * Object-oriented file I/O * Standard file I/O * File system manipulation functions, e.g., delete, rename, change directory * HLA-related declarations and functions * The HLA Object Windows Library: object-oriented framework for Win32 programming * Linked list manipulation * Mathematical functions * Memory allocation and management * FreeBSD-specific APIs * Linux-specific APIs * MacOS-specific APIs * Win32-specific APIs * Text console functions * Coroutine support * Environment variable support * Exception handling support * Memory-mapped file support * Sockets and client–server object support * Thread and synchronization support * Timer functions * Pattern matching support for regular expressions and context-free languages * Random number generators * Remote procedure call support * Standard error output functions * Standard output functions * Standard input functions * String functions * Table (associative) support * Zero-terminated string functions === Design === The HLA v2.x language system is a command-line driven tool that consists of several components, including a ''shell'' program (e.g., hla.exe under Windows), the HLA language compiler (e.g., hlaparse.exe), a low-level translator (e.g., the HLABE, or HLA Back Engine), a [[Linker (computing)|linker]] (link.exe under Windows, ld under Linux), and other tools such as a resource compiler for Windows. Versions before 2.0 relied on an external assembler back end; versions 2.x and later of HLA use the built-in HLABE as the back-end object code formatter. The HLA ''shell'' application processes command line parameters and routes appropriate files to each program in the HLA system. It accepts <code>.hla</code> files (HLA source files), <code>.asm</code> files (source files for MASM, TASM, FASM, NASM, or Gas assemblers), <code>.obj</code> files for input to the linker, and <code>.rc</code> files (for use by a resource compiler). === Source code translation === Originally, the HLA v1.x tool compiled its source code into an intermediate source file that a ''back-end'' assembler such as MASM, TASM, flat assembler ([[FASM]]), [[Netwide Assembler]] (NASM), or [[GNU Assembler]] (Gas) would translate into the low-level object code file. As of HLA v2.0, HLA included its own ''HLA Back Engine'' (HLABE) that provided the low-level object code translation. However, via various command-line parameters, HLA v2.x can still translate an HLA source file into a source file compatible with one of these other assemblers. === HLA Back Engine === The HLA Back Engine (HLABE) is a compiler back end that translates an internal intermediate language into low-level [[Portable Executable]] (PE), Common Object File Format ([[COFF]]), [[Executable and Linkable Format]] (ELF), or [[Mach-O]] object code. An HLABE ''program'' mainly consists of data (byte) emission statements, 32-bit relocatable address statements, x86 control-transfer instructions, and various directives. In addition to translating byte and relocatable address statements into the low-level object code format, HLABE also handles branch-displacement optimization (picking the shortest possible form of a branch instruction). Although the HLABE is incorporated into the HLA v2.x compiler, it is a separate product. It is public domain and open source (hosted on [[SourceForge.net]]).
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)