Documente Academic
Documente Profesional
Documente Cultură
by Benedict Roeser
1. Basic syntax
Note about New-Line-Characters (cr lf): They have to be used. But you can use
more than needed.
1. 1. Mission title
1. 2. Pages
A program consists of 'pages'. Each program has got at least one 'page'.
Between the mission title and the first page and between each page has to be a
blank line.
A page starts with the 'Page introduction'. We have to distinguish between
'commentary pages' and
'deliverable pages'. A commentary page is ignored by the Camouflage
interpreter/compiler, a deliverable page isn't.
Important: A commentary page has to have a correct syntax! It has to consist of
'disguises' and 'commands' as well as
deliverable pages.
By using the importance keyword 'might be' the interpreter/compiler can decide
whether to execute the page or not.
This might be interesting for maintenance tasks.
By omitting the keyword 'immediately' the interpreter/compiler can decide when
to execute the page. This might be interesting
for multi-threaded programs.
A page ends with 'and return after having done so.' or 'but return after having
done so.'
'return after having done so.' is a reserved keyword. 'but' and 'and' will be
handled later.
Each page needs at least one 'disguise' and one 'command'. (Will be explained
later)
The first disguise is alwasy written with the first letter in uppercase.
Jumping from one page to another with the 'follow command' or the 'obey
command' is not possible.
Example 'Commenting your code, referring to parts of the Mission "Doing nothing
at all"':
2. Disguises
2. 1. Disguise types
In 'tax collector mode' all variable or constant values are substituted by user
input.
If 'security guard mode' is active and impossible values are entered by the
user, default values are taken.
If 'ghost mode' is active the urge for user input will not be shown in any way
(No popup windows with
'Please enter something:', no blinking cursor on the console, ...)
The following example will ask for user input. If no integer or a number
smaller than 0 is given 'security guard mode' will
overwrite the results of 'tax collector mode' with the given 'default value'
12.
2. 2. Adding disguises
As already shown in the last example, disguises can easily be added. It's
possible to add all five disguises, but you should
be absolutely sure to know what you are doing.
Disguises are added with the keyword 'and'. It's impossible to add a disguise
which is already added.
2. 3. Substituting disguises
The last disguise which was added(/the only disguise) can be substitued with
the keyword 'but'.
It's impossible to substitute a disguise with another one wich is already
added.
It's impossible to substitute a disguise with itself.
2. 4. Removing disguises
Disguises can't be removed before the end of a page, they just can be
substituted with other disguises.
That means: If you add two disguises, the first one can't be changed to any
other disguise!
All disguises are removed with the end of a page.
3. Variables
There are numbers and sentences. numbers are floating point values, sentences
are strings.
Variables are defined with the 'paint command', a variable name and the
reserved keyword 'as'.
A variable name can consist of ASCII-Characters from a to z and A to Z and a
space ' '.
Remember that Camouflage is strictly case sensitive.
As ghost
paint AfunnyVariableWithoutSpaces as number
and paint a funny variable with spaces as sentence
and paint a funny variable WITH spaces as number
and return after having done so.
3. 2. Something similar to a class
Example 'Similarities':
3. 3. Lists
Lists can be limited to a certain size using the command 'set', a size
(integer),
the reserved keyword 'as limititation for', the data type of the list, the
reserved keyword 'in' or 'on',
the name of the list. List limitations can be set to other values during
runtime, but can't be removed.
In 'security guard mode' the violation of a limitation is quietly regulated by
just filling the available space.
In 'playwright mode' with active 'security guard mode' the violation of a
limitation is shown as warning.
As security guard
paint pages
and paint books as storage for pages
and paint the bookshelve as storage for books
and paint Peter Pan as books
and collect 231 pages in Peter Pan
and collect 20 books on the bookshelve
and collect Peter Pan on the bookshelve
and paint a random sentence as sentence
and as playwright
count all books on the bookshelve
and collect ' books on the bookshelve, including Peter Pan.' in a random
sentence
and count all pages in Peter Pan
and collect ' pages in Peter Pan.' in a random sentence
and as ghost
collect 'Scary stuff!' in a random sentence
and return after having done so.
1. the result
2. the time
3. the line
The reserved system variable 'the result' contains the return value of the last
command / control structure.
As security guard
paint dollars
and paint the bucket as storage for dollars
and paint the other bucket as storage for dollars
but as playwright
count all dollars in the bucket
and collect the result in the other bucket
and compare the result with 5
and return after having done so.
4. Commands
All commands have to be connected with the reserved keyword 'and'. There are
indeed exceptions to this rule.
command explanation
collect sets a variable, automatically appends cr/lf (collect 'fo' in/on bar)
compare comparing (Only works with 'the result': compare the result with 5)
count all counting elements in a list (count all books on bookshelve)
follow jump to next disguise (optional keywords: 'on success'/'on failure')
obey jump to last disguise (optional keywords: 'on success'/'on failure')
order import a class/variable/list definition mission, can't be nested
paint initializing a variable/a list of variables/a class (paint books)
rephrase collect w/o crlf, works on sentences only (rephrase bar to 'foobar')
set setting a limitation (set 40 as limitation for books on bookshelve)
split dividing a list by removing 'empty objects' or 'certain objects'
steal removing something painted and freeing its memory
take a. remove object from a list ('empty objects'/'certain objects')
b. storing a property in 'the result' (take author of Peter Pan)
Please note that the 'steal command' won't work in 'security guard mode'.
For an example of the 'order command' see the chapter about file I/O.
Examples 'collect ... on/in, take ... of/from, split ... by':
This is similar to +, -, /, *, =
The reserved keyword 'and' is used when 'but' isn't used. The first command
after Adding or switching a disguise must not
be introduced by 'and'. The first disguise on a page must not be introduced by
'and'. Apart from that almost every
line will have an 'and'. Exceptions are of course the mission title and the
page introduction.
The reserved keyword 'but' is used when comparing something with 'the result'.
It's similar to something called 'else'.
4. 3. File I/O
File I/O is realized with the system defined class file which is made out of
the following source code. You needn't copy the source code to your program.
It is perfectly sufficient to use the 'order command' as shown in the second
example.
As you can easily imagine you can open a file for input/output by using the
'collect command' on a filename of a 'file object'.
There are two predefined properties called characters and lines, both beeing
lists. You can access a file by its lines or by its individual characters.
Writing to the file is done by using the 'collect command', the 'couple
command', the 'rephrase command', or the 'steal command' reading from the file
is done e.g by using the 'take command'.
The filesize can be easily determined by using the 'count all command' on the
character list.
The following example puts the size of a file in the variable 'filesize' and
the first line in the variable 'firstline'.
Besides the system defined class 'a file' there is a system defined class
'mission'.
The current mission is always identified by the variable 'this mission'.
As you can easily see, it is possible to combine the 'this mission' object with
the file I/O structures for getting the file size of your program!
It's also pretty easy to append the current time to the mission title of your
program, as the following example shows.
The stack of strings serves as concat-glue. The slot machine is needed to use
the 'steal command'. The 'ghost disguise' can't be used because the mission
'great justice', which is ordered by the 'security guard mode' already uses
the 'ghost disguise' and disguises can't be substituted by itself (see the
chapter for substituting disguises for more information). The 'security guard'
mode, on the other hand can't be used, because the 'steal command' won't work
in this mode. Ultra-verbosity and user input is not requested, so only the
'slot machine mode' remains. The fifty-fifty chance is removed by the line
'obey the slot machine on failure'. Everything else should be clear.
As security guard
order great justice
and paint this mission as mission
and paint a stack of strings as storage for sentence
and paint the mission title as sentence
and take the mission title of this mission
and collect the result in a stack of strings
and collect the time in a stack of strings
and collect a stack of strings in the mission title
and collect the mission title in this mission
but as slot machine
steal this mission
but as security guard
obey the slot machine on failure
but paint this mission as mission on success
and return after having done so.
5. Examples
As security guard
paint a random sentence as sentence
and as playwright
collect 'Hello World!' in a random sentence
and as ghost
collect 'random stuff' in a random sentence
and return after having done so.
6. You're done.