Scripting

From RISC OS

Jump to: navigation, search

Scripting in short, is a high level sequence of commands, usually without the strong typing of compiled languages. This is an overview of scripting languages available for RISC OS.

Languages

No longer supported?

  • Ruby Ported by Reuben Thomas.
  • Tcl Ported by C.T.Stretch.

What is a scripting language?

RISC OS is controlled by Obey files. These contain scripts for a command language. It is rather a limited language; its variables we call system variables, and its facilities for conditional or looping structures are rudimentary. For this reason, Basic is often used in situations where Obey files are insufficiently expressive. The OSCLI command allows one to build up Obey commands using Basic variables. In other words, Basic has a useful role to play as a scripting language. However, BASIC lacks certain facilities that are often needed for scripting, namely:

  • Passing parameters into a BASIC program via the command line is not straightforward.
  • Basic has no mechanism for iterating over objects in a directory, without recourse to SWIs.
  • Basic has only rudimentary facilities for pattern matching.
  • Basic strings are limited in size - you cannot load a whole file in as a single string.
  • Memory management is not automatic in BASIC, so maximum sizes have to be guessed for DIM statements.

The term scripting language is vague, but the languages described by it tend to have the following features:

  • Memory management is automatic. The claiming and freeing of memory ceases to be of concern.
  • They have powerful string-processing and pattern-matching facilities.
  • They can read system variables and execute commands.
  • The words on the command line are available as an array of strings.
  • They support arrays or lists in various forms without the need for specifying a maximum number of components.

As scripting languages evolved, these features were found to be useful for expressing command scripts concisely. Of course, many of these languages have also acquired other features, some of them appropriate for writing applications more ambitious than quick and dirty scripts. Almost all of them are interpreted. The interpreters are usually divided into two parts - a compiler that converts the source scripts into bytecodes for a virtual machine, and an emulator and runtime system for the virtual machine.

See Also

Personal tools