Page 1 of 1
underscore usage
Posted: Sat Jul 14, 2018 8:45 am
by steve64
Is the underscore accepted for all identifiers, even for lower case names?
Is it accepted for module names and module filenames?
Re: underscore usage
Posted: Sat Jul 14, 2018 11:58 am
by cfbsoftware
Underscore is accepted anywhere that a letter (uppercase or lowercase) is accepted. There are no arbitrary restrictions imposed by the compiler on its use. However, be aware that it is an Astrobe extension to Oberon and is not recommended for general use. The usual Oberon programming convention is to use camel caps to distinguish words in identifiers that are compound words (e.g. SlaveReadTxNoAck instead of slavereadtxnoack or slave_read_tx_no_ack).
Underscore was introduced in Astrobe specifically to allow the naming of MCU constants in the source code to be consistent with the names used in the manufacturer's reference manuals e.g. IOCON_PIO1_10.
If you are intending to share your code with others or port it to other Oberon systems (e.g. RISC5 FPGA) you should restrict the use of underscores in other scenarios to a minimum. Needless to say, if you are going to be the only person who ever sees your code then you can use them wherever you like
Re: underscore usage
Posted: Sat Jul 14, 2018 2:54 pm
by steve64
that's good. must module names be always equal to their filenames (excluded the extension)?
is there a mandatory extension or in principle any reasonable extension could be used? some systems use .obn other .mod and so on...
Re: underscore usage
Posted: Sun Jul 15, 2018 3:39 am
by cfbsoftware
When using Astrobe for ARM Cortex-M targets the files containing Oberon source code should be named <modulename>.mod
The names of the generated files (object, symbol, executable files etc.) are formed from the <modulename> + an extension (.obj, .sym, .bin etc.)
The IDE, compiler and linker use these naming conventions when looking for files to open, import and link.
For more details refer to Chapter 2
File Descriptions in one of the three documents
Oberon for Cortex-M Microcontrollers which you can download from
Astrobe - The Oberon Programming Language webpage.