Difference between revisions of "Zbex Properties"

From CCARH Wiki
Jump to navigation Jump to search
(added chapter links at bottom of page)
(added chapter navigator at top of page)
Line 1: Line 1:
 +
{{ZbexChap
 +
  | before = [[Zbex:_Programs_in_files_and_in_other_Dmuse_windows|Programs in files and in other Dmuse windows]]
 +
  | after = [[Zbex_utility_programs|Utility programs]]
 +
}}
 +
 +
 
The Zbex programming language is very similar to the [http://en.wikipedia.org/wiki/Pascal_%28programming_language%29 Pascal] and [http://en.wikipedia.org/wiki/Python_%28programming_language%29 Python] programming languages.  If you are old enough to have programmed in Pascal, you will find learning Zbex quite easy.  There are two cautions you need to keep in mind.  (1) While Zbex statements on the surface look the same as Pascal statements, the implementation of the statements (that is, what the program actually does) may be slightly different in some cases.  (2) Zbex is not as versatile as Pascal.  There are many things you can do with Pascal that you cannot do with Zbex.  Zbex, for example, does not allow you to use pointers.  You cannot compile and link separate modules with Zbex.  This means that you cannot build programs from separate pieces.
 
The Zbex programming language is very similar to the [http://en.wikipedia.org/wiki/Pascal_%28programming_language%29 Pascal] and [http://en.wikipedia.org/wiki/Python_%28programming_language%29 Python] programming languages.  If you are old enough to have programmed in Pascal, you will find learning Zbex quite easy.  There are two cautions you need to keep in mind.  (1) While Zbex statements on the surface look the same as Pascal statements, the implementation of the statements (that is, what the program actually does) may be slightly different in some cases.  (2) Zbex is not as versatile as Pascal.  There are many things you can do with Pascal that you cannot do with Zbex.  Zbex, for example, does not allow you to use pointers.  You cannot compile and link separate modules with Zbex.  This means that you cannot build programs from separate pieces.
 
   
 
   

Revision as of 06:02, 15 October 2010

Previous chapter
Programs in files and in other Dmuse windows
Zbex
Manual
Next Chapter
Utility programs


The Zbex programming language is very similar to the Pascal and Python programming languages. If you are old enough to have programmed in Pascal, you will find learning Zbex quite easy. There are two cautions you need to keep in mind. (1) While Zbex statements on the surface look the same as Pascal statements, the implementation of the statements (that is, what the program actually does) may be slightly different in some cases. (2) Zbex is not as versatile as Pascal. There are many things you can do with Pascal that you cannot do with Zbex. Zbex, for example, does not allow you to use pointers. You cannot compile and link separate modules with Zbex. This means that you cannot build programs from separate pieces.

If Zbex is essentially a scaled down version of Pascal, what are its advantages? Why not just program in Pascal? The answer to this question has several parts.

  1. Zbex compiles into an intermediate language, which is executed by an interpreter, like Java. The advantage is that your Zbex program never really controls the computer; the interpreter controls the computer, with your Zbex program telling the interpreter what to do. If your Zbex program asks the interpreter to do something that is illegal, that is, something that would crash the system, the interpreter won't do it; instead, the interpreter will flag the offending line of code in your Zbex program, giving you information about what was wrong, and then halt the execution of your program. The remaining windows of Dmuse will be unaffected by this.
  2. All Zbex programs require the same interpreter. The interpreter has been set up to handle more than one Zbex program at the same time. It does this by switching between programs after executing a specified number of instructions. Zbex programs, once started, will continue to run in the background when you change to another window. You can use the Dmuse editor in one window, while several Zbex programs are running in other windows.
  3. Zbex was designed primarily as a language to manipulate string variables. In Zbex, string variables actually have two components: (1) the current run-time length of the string, and (2) the actual characters in the string. A string variable may be declared to have a maximum length of 100 ["maybe 900 characters now?"] characters, but the actual length of the string during the running of the program may vary from zero to 100 characters.
  4. Zbex not being a standard language has allowed us to add extra features, without running the risk of confusing people who are use to a standard language. Features added to Zbex include, (1) specialized functions to perform common tasks more quickly, (2) specialized variable types such as random access tables, (3) specialized instructions for applications in music. Included in this group are commands to display musical notation in graphics mode and commands to interface with MIDI devices.
  5. The real purpose of Zbex is to allow you to write "throw away" programs quickly and easily. It has been estimated that 80 to 90 percent of the programs written in course of doing research on the computer are used once and then thrown away. In this type of situation, it is important to have (1) good diagnostics at compile time, (2) good run-time debugging tools, (3) quick turnaround between successive versions of a program, and (4) a safe execution environment that will not trash the system. Zbex has all of these features.

In spite of Zbex's real purpose being the ability to write "throw away" programs, I [Walter] have found Zbex to be an excellent language for writing software for complicated tasks such as music printing. It is hard enough to get such programs to run properly, without having to worry about whether I have overwritten some critical section of computer memory in the process. Zbex allows me to check out the logic of a program in a friendly environment, and later to convert that logic to a less forgiving language such as C. This two-step process can save a lot of time in the long run.



Previous chapter
Programs in files and in other Dmuse windows
Zbex
Manual
Next Chapter
Utility programs