Scripting: Difference between revisions
m (Updated Python link) |
(Removing Ruby, Tcl and Bash as no longer maintained and the latter does not work for most commands) |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
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== |
|||
*[http://lua.riscos.org.uk/ Lua] |
*[http://lua.riscos.org.uk/ Lua] |
||
*[http://www.alexwaugh.com/perl/ Perl] |
*[http://www.alexwaugh.com/perl/ Perl] |
||
*[[PHP]] |
|||
*[http://www.cp15.org/php/ PHP] |
|||
*[http://www.schwertberger.de/python.html Python] |
*[http://www.schwertberger.de/python.html Python] (see also [http://www.riscosports.co.uk/python27.zip Python 2.7.2] for modern systems) |
||
No longer supported? |
|||
*[[Ruby]] Ported by Reuben Thomas. |
|||
*[[Tcl]] Ported by C.T.Stretch. |
|||
==What is a scripting language?== |
==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 |
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, |
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 |
* 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 no mechanism for iterating over objects in a directory, without recourse to SWIs. |
||
* Basic has only rudimentary facilities for pattern matching. |
* 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. |
* Basic strings are limited in size - you cannot load a whole file in as a single string. |
||
* Memory management is not automatic in |
* 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: |
The term ''scripting language'' is vague, but the languages described by it tend to have the following features: |
||
Line 27: | Line 24: | ||
* They have powerful string-processing and pattern-matching facilities. |
* They have powerful string-processing and pattern-matching facilities. |
||
* They can read system variables and execute commands. |
* They can read system variables and execute commands. |
||
* The words on the |
* 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. |
* 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. |
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 == |
|||
* [http://en.wikipedia.org/wiki/Scripting Wikipedia's Definition] |
|||
* [[StrongED:Applying_scripts]] How to use scripts on the contents of StrongED windows. |
|||
* [[Stick]] How to make wimp applications without writing wimp programs. |
Latest revision as of 09:25, 21 November 2018
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
- Lua
- Perl
- PHP
- Python (see also Python 2.7.2 for modern systems)
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
- Wikipedia's Definition
- StrongED:Applying_scripts How to use scripts on the contents of StrongED windows.
- Stick How to make wimp applications without writing wimp programs.