Aztec® Programming Language
Version 1.1 Alpha 2

Copyright © 2010-2017, Aztec Development Group, All Rights Reserved

Download Aztec

Search        Contact Us

Shoot it back and watch this girl unwind...

- Mia Borders

 

The Aztec Interpret UI Dialog is available from the Aztec system menu as described in the Aztec Engine Overview page. It can be used in two different ways.

♦ The Interpret UI can be run standalone (Aztec -interpret), in which case the Aztec Engine prepares an empty Aztec script environment, providing the Interpret UI with a clean slate, so Aztec statements can be executed without fear of affecting an already executing script.

♦ The Interpret UI can also be used when the Virtual Machine is running an Aztec script/application (Aztec -interpret -exec SourceCode). This provides the Interpret UI with access to objects running in the Aztec script, depending on the visibility settings of the classes and objects in the script.

♦ Each time the Ad Hoc Interpret UI compiles and executes new code, it is compiled in the context of a separate 'unit' versus the code that is running in the Script. So it is necessary to mark identifiers as 'public' in the script in order to be visible in the Interpret UI.
♦ The Interpret UI is currently only available when running "-exec" mode with Aztec source code. It is currently not available when the Engine is launched with an ".azcode" file.

The Interpret UI Dialog provides two separate tabs for dynamic code compilation, one is provided to load an entire new module of source into the system and the other is to execute ad hoc Aztec statements.

♦ Both the LoadModule and the Interpret tabs use the Aztec dynamic code generation feature to do their jobs. Each tab provides three useful buttons.

"Load From File" retrieves source code written previously and stored in a file.
"Save To File" stores the source code currently in the source code window of the tab.
"Previous Code" allows the user to search through previous sets of code that were compiled and/or executed and retrieve one of them. The list only includes successful code from the current VM session.

♦ The LoadModule tab supports the creation of an entirely new Aztec source module. When the "Compile" button is pressed, the source code in the window is compiled within the context of the running Aztec script. If the compile is successful, the new code is integrated into the existing Virtual Machine environment, including binary code, Metadata and virtual method hierarchy tables to support polymorphism. If one or more classes in the running script are defined as 'dynamic', the new source code can create new methods and shared data for those dynamic classes using "Satellite" classes.

When compiling the new source code, the entire set of Aztec Compiler steps is performed, including compile-time execution in Step 4. So full compile-time logic as described in the Compile-Time Logic page are supported in the LoadModule tab.

The "go" button for this tab is "Compile", as opposed to "Execute" on the Interpret tab. As mentioned above, this new module is compiled and integrated into the VM environment, but nothing is actually executed. The success message from the UI also indicates that the code was compiled but not executed.

Aztec Interpret UI LoadModule Tab

 

♦ The Interpret tab supports the creation of Ad Hoc Aztec source code that can be compiled and then executed by the Virtual Machine in one shot. It is similar, in theory, to the Interpret() family of methods in the Script class, but it actually uses "CompileMethod" technology under the covers. The Interpret() methods are more limiting, and do not allow the creation of new data items. When recompiling a dynamic method, the entire code from the method is rebuilt, and data items can be defined.

So the source code in the Interpret UI should be looked at as replacement code for a method. The system automatically compiles the code when the "Execute" button is pressed and if successful, the "new method" is automatically executed by the Virtual Machine in the special Ad Hoc VM thread. As with the LoadModule tab, the compilation and execution of this code is performed in the context of the currently running Script. Public data items, methods and classes/types are all accessible to the source code in the Interpret UI window.

Run-time exceptions can be handled in the Interpret tab code as normal. If an exception is fired, and the Interpret UI code does not handle it, the entire Virtual Machine Script session does not terminate. It only terminates the current instance of this special Ad Hoc VM Thread. A dialog is displayed indicating that an unhandled exception occurred, but the Interpret UI can continue to be used. Each execution instance is a separate animal.

The "go" button for this tab is "Execute", to indicate the code is not only compiled, it is actually executed on the fly by the VM once the compilation is successful. The success message from the UI also indicates that the code was compiled and executed.

Aztec Interpret UI

 

♦ These run-time utilities can be very useful debugging tools, and they can also be used as part of a more formal unit test strategy.

 

Page UpPage DownCopyright © 2010-2017
Aztec Development Group
All Rights Reserved

Download Aztec