The Kestrel Programming Language
the documentation for the Kestrel language
putstring( "Hello world" LF, output );
The semicolon above is optional, and the keyword end could be appended. The comma in the formal parameter list of putstr would be optional except that there is a string constant, and string constants will consume all successive expressions to extend the string.
while ~eof( input ) putchar( getchar[ input ], output ) end
The above code illustrates the use of different kinds of parentheses and brackets to help the reader see which parenthesis matches which. The square brackets could just as easily have been replaced with regular round parentheses, without changing the meaning of the code.
-- strip non ASCII content and all control characters from the input, -- except newline characters, while copying from input to output ch: var char while ~eof( input ) ch = getchar[ input ], output ) if ch < " " -- control characters if ch = LF putchar( ch, output ) end else -- not a control character if ch < DEL -- printable putchar( ch, output ) end end -- if end -- while
The above code illustrates the use of comments, variables, and if statements as well as a variety of simple expressions.
putstring: procedure( ref s:array uint16 of char, f:file ) -- put the string s to file f for i in s.min .. s.max putchar( s(i), output ) end end
This example illustrates the use of a for loop as well as the use an array parameter with bounds that may be a subrange of the bounds of the declared type.