1.3 Running Your First HLA Program


1.3 Running Your First HLA Program

The whole purpose of the Hello World program is to provide a simple example by which some who is learning a new programming language can figure out how to use the tools needed to compile and run programs in that language. True, the Hello World program in the previous section helps demonstrate the format and syntax of a simple HLA program, but the real purpose behind a program like Hello World is to learn how to create and run a program from beginning to end. Although the previous section presents the layout of an HLA program, it did not discuss how to edit, compile, and run that program. This section will briefly cover those details.

All of the software you need to compile and run HLA programs can be found on the CD-ROM accompanying this book. The software can also be found at the following web address:

 http://webster.cs.ucr.edu 

(Note that the latest version of the software can always be found on Webster, so you might want to visit Webster to get any updates that may have appeared since the production of the CD-ROM; note, however, that all the software appearing in this text works just fine with the software appearing on the CD-ROM.)

This section will not describe how to install and set up the HLA system. Those instructions change over time and any attempt to describe the installation of HLA on these pages would be wasted because such instructions would become obsolete. The readme.txt file in the root directory of the CD-ROM is the place to go to learn how to install HLA on your system. From this point forward, this text will assume that you've successfully installed HLA and other necessary tools on your system (those instructions also show you how to compile and run your first program, so we'll skip details from that discussion, as well).

The process of creating, compiling, and running an HLA program is very similar to the process you'd use for a program written in any computer language. The first step is to create or edit your source file using a text editor. HLA is not an "integrated development system" (IDE) that allows you to edit, compile, test and debug, and run your application all from within the same program (like many software development tools). Therefore, you're going to need a text editor in order to create and edit HLA programs.

Windows and Linux both provide a plethora of text editor options. You can even use the text editor provided with other languages' IDEs to create and edit HLA programs (e.g., Visual C++, Borland's Delphi, Borland's Kylix, and similar packages). The only restriction is that HLA expects ASCII text files, so the editor you use must be capable of manipulating text files. Note that under Windows you can always use notepad.exe to create HLA programs; under Linux you can use joe, vi, or emacs if you don't prefer some other editor.

The HLA compiler[2] is a traditional command line compiler. This means that you need to run it from a Windows' command line prompt or a Linux shell. To do so, you'd type something like the following into the compile line prompt or shell window:

 hla hw.hla 

This command tells HLA to compile the hw.hla (Hello World) program to an executable file. Assuming there are no errors, you can run the resulting program by typing the following command into your command prompt window (Windows):

 hw 

or into the shell interpreter window (Linux):

 ./hw 

If you're having problems getting the program to compile and run properly, please see the HLA installation instructions in the HLA Reference Manual on the accompanying CD-ROM. These instructions describe in great detail how to install, set up, and use HLA.

[2]Traditionally, programmers have always called translators for assembly languages assemblers rather than compilers. However, because of HLA's high level features, it is more proper to call HLA a compiler rather than an assembler.




The Art of Assembly Language
The Art of Assembly Language
ISBN: 1593272073
EAN: 2147483647
Year: 2005
Pages: 246
Authors: Randall Hyde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net