Next: 1.1 Syntax Up: Contents Previous: Contents Contents Index

#
1. Onyx Language Tutorial

This manual includes a comprehensive Onyx Language Reference chapter, which explains the details of what Onyx is. However, that chapter is rather dry, and more importantly, it does not discuss how to best utilize Onyx. This chapter introduces concepts that are important when designing and implementing Onyx programs, though it is not a complete language tutorial. You will need to read the first several sections of Chapter 2 in order to absorb all of the information in this chapter. However, you should be able to read this chapter first, then come back to it and glean additional understanding after having read later chapters.

Onyx is a stack-based language, so although the ideas that are important to program design in other more traditional languages still apply in many cases, there are different ways of approaching certain problems that integrate better with the facilities provided by Onyx. The most obvious example of this is that Onyx programs are more efficient if written to use named variables as little as possible, relying instead on the power of the operand stack. Another example is error handling. It is possible to write procedures that check for every error condition, but Onyx provides a form of exception handling that, if used correctly, can significantly improve code readability and performance.

Accomplished PostScript programmers will find little new in this chapter; Onyx differs from PostScript in the details, but the concepts are very similar. Accomplished Forth programmers will already be comfortable with stack management, but the rest of the chapter discusses concepts that either have no Forth equivalent, or that are significantly different from Forth, as is the case for dictionaries.

Subsections

- 1.1 Syntax
- 1.2 Data types
- 1.3 Execution
- 1.4 Memory management
- 1.5 Stacks
  - 1.5.1 Efficiency issues
  - 1.5.2 Using stacks as queues
  - 1.5.3 Using the operand stack as two stacks
- 1.6 Dictionaries
  - 1.6.1 Efficiency issues
- 1.7 Regular expressions
  - 1.7.1 Matching
  - 1.7.2 Splitting
  - 1.7.3 Substituting
- 1.8 Code organization
  - 1.8.1 Procedures
  - 1.8.2 Modules
- 1.9 Error handling
- 1.10 Introspection
- 1.11 Threads
  - 1.11.1 Implicit synchronization
  - 1.11.2 General threading concerns
- 1.12 Optimization
- 1.13 Debugging

Next: 1.1 Syntax Up: Contents Previous: Contents Contents Index