Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

An Introduction to the Bogus Language


Nov03: Swaine's Flames

The lack of any sort of written documentation for the Bogus programming language is starting to become an embarrassment to the Bogus community, almost as great an embarrassment as the release of the language itself. Against the advice of some of the biggest names in computing—Stonebraker, Rutishauser, Heppenheimer—I decided to do something about this lack.

This document is a first, incomplete attempt at a programmer's manual for the Bogus language. By the end of the manual, it is my hope that you will be able to read and write and feed yourself.

Bogus is an interpreted language. More precisely, Bogus source code is dynamically misinterpreted and any words that look like English in the resulting byte code are naively transliterated into Ebonics and discarded. The JTL, or just-too-late, misinterpreter can be invoked interactively. Or unattractively; I was sitting in the back of the room and couldn't hear well. In either case, the garbage collector should come in handy. Garbage collection in Bogus is load balanced and distributed, so everybody gets their fair share of garbage.

Bogus is strongly, dynamically typed. Weak, slow typing results in strings like aaaaaaaaaaaaaaaa and klklklklklklklkl.

Whitespace in Bogus programs must be respected and feared. If you come from a language where whitespace is ignored, which you almost certainly do, you will probably never really understand Bogus, but understanding was not one of Bogus's design goals. A good rule of thumb is that whitespace in Bogus has the opposite meaning from the meaning it has in any other language. For example, indentation is used to denote language elements. Thus:

if condition

statement 1

statement 2

statement 3

means to add 1 and 2 and get the result 3. Indentation by three spaces is the addition operator, which, like all Bogus operators, is undocumented, overloaded, and Reverse Polish. Two or more Bogus operators can be combined via the Union operator, but then they will go out on strike and you won't get anything done.

The actual words in the code ("if," "condition," "statement") are ignored; English words are used to provide a misleading feeling of familiarity. The repetition of these words, however, is important. By inserting the same word before each of the numbers to be added and before the number in the last line, we are indicating that we wish to bind that number to that sum. In this case, the sum is 3 and the bound value is coincidentally also 3, but Bogus gives the programmer a great deal of freedom in this respect. If you want to make the sum of 1 and 2 be 18, it's your lookout.

Literal strings in Bogus are represented as a series of backspace characters (ASCII 8): A is a series of 65 backspaces, and so on. A multicharacter string is a series of a series of backspaces, explicitly combined with the concatenation operator. The concatenation operator is 24 (forward) spaces, so when the misinterpreter is reading a long string, it whips back and forth like a disk-drive head being tested to destruction. A brief example should make this clear. Here is a familiar quote from programmer/author Larry Wall, written in Bogus:

Larry is such a wit.

Variables in Bogus are not explicitly declared. Numeric variables come into existence according to the value of the internal clock. The variable 1 came into existence on 12:00:00.001 am January 1, 1904; 2 came into existence one millisecond later; and so on. If you try to use a numeric variable before it exists, the results are unpredictable, but usually what happens is that the garbage collector backs up over your trash can.

Control structures in Bogus are represented by nonEnglish words. A pair of French words denote the beginning and end of a conditional, three Russian words and a numeric constant delineate a repetitive structure. Blocks start with a phrase in Cockney rhyming slang and end with the name of a British rugby team. The misinterpreter does not return error messages, but it does accept apologies.

The sole inheritance method in Bogus is panspermia. New classes are created by the insertion of alien spores and inherit from programs based on nonAristotelian logic.

There are no pointers in Bogus, nor in this manual.


Michael Swaine
editor-at-large

[email protected]


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.