HLACompileTimeLanguage - The HLA Compile-Time Language The...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
The HLA Compile-Time Language Beta Draft - Do not distribute © 2001, By Randall Hyde Page 949 The HLA Compile-Time Language Chapter Seven 7.1 Chapter Overview No w we come to the fun part. F or the past nine chapters this te xt has been molding and conforming you to deal with the HLA language and assembly language programming in general. In this chapter you get to turn the tables; you’ ll learn ho w to force HLA to conform to your desires. This chapter will teach you ho w to e xtend the HLA language using HLA s compile-time langua g e . By the time you are through with this chapter , you should ha v e a health y appreciation for the po wer of the HLA compile-time language. Y ou will be able to write short compile-time programs. Y ou will also be able to add ne w statements, of your o wn choosing, to the HLA language. 7.2 Introduction to the Compile-Time Language (CTL) HLA is actually tw o languages rolled into a single program. The run-time langua g e is the standard 80x86/HLA assembly language you’ v e been reading about in all the past chapters. This is called the run-time language because the programs you write e x ecute when you run the e x ecutable fi le. HLA contains an interpreter for a second language, the HLA Compile-T ime Language (or CTL) that e x ecutes programs while HLA is compiling a program. The source code for the CTL program is embedded in an HLA assem - bly language source fi le; that is, HLA source fi les contain instructions for both the HLA CTL and the run-time program. HLA e x ecutes the CTL program during compilation. Once HLA completes compilation, the CTL program terminates; the CTL application is not a part of the run-time e x ecutable that HLA emits, although the CTL application can write part of the run-time program for you and, in f act, this is the major purpose of the CTL.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chapter Seven Volume Four Page 950 © 2001, By Randall Hyde Beta Draft - Do not distribute Figure 7.1 Compile-Time vs. Run-Time Execution It may seem confusing to ha v e tw o separate languages b uilt into the same compiler . Perhaps you’ re e v en questioning wh y an yone w ould need a compile time language. T o understand the benefi ts of a compile time language, consider the follo wing statement that you should be v ery comfortable with at this point: stdout.put( "i32=", i32, " strVar=", strVar, " charVar=", charVar, nl ); This statement is neither a statement in the HLA language nor a call to some HLA Standard Library proce - dure. Instead, stdout.put is actually a statement in a CTL application provided by the HLA Standard Library. The stdout.put "application" processes a list of objects (the parameter list) and makes calls to various other Standard Library procedures; it chooses the procedure to call based on the type of the object it is currently processing. For example, the stdout.put "application" above will emit the following statements to the run-time executable: stdout.puts( "i32=" ); stdout.puti32( i32 ); stdout.puts( " strVar=" ); stdout.puts( strVar ); stdout.puts( " charVar=" ); stdout.putc( charVar ); stdout.newln(); Clearly the stdout.put
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 20

HLACompileTimeLanguage - The HLA Compile-Time Language The...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online