Opentopia Directory Encyclopedia Tools

Obfuscated Weird Language

Encyclopedia : O : OB : OBF : Obfuscated Weird Language



 

Obfuscated Weird Language, or OWL, is an esoteric programming language developed by Antonio Maschio between 2005 and 2006. It is based on Forth and FALSE and is an interpreted, stack-based language. An OWL program is a sequence of ASCII characters, hereafter called the code stream.

Language summary

This summary applies to version 0.7.2 (February 11, 2006) of the OWL language.

OWL has the following datatypes: 32-bit integer; string of 8-bit characters; and OWL function. Each data type is entered and stored differently.

Also, each data type admits a different set of operations.

As well as the above operations, OWL implements various system commands.

The function buffer is cleared after each use.

Integer variables are initially 0; function variables are initially the empty string.

Language syntax

In the following table of syntax examples, we will write, for example, C B A → D E for an operation which first pops operands A, B and C from the stack and then pushes results D and E onto the stack. If an operation assumes that the function buffer contains an operand X (or two operands, X and Y), we will write (or .) If an operation requires one operand in the function buffer, but two are provided, the second is used and the first is discarded. Recall that the function buffer is cleared after each use.

This table applies to version 0.7.2 of the OWL language.

Data entry.
0x100 These all push the number 256 onto the stack.
Numbers can be written in hexadecimal, decimal, octal, or binary, as shown.
256
O400
B100000000
D This will push 68, the ASCII value of D, onto the stack.
This can be done for any uppercase or lowercase letter.
"ab\ncd" Prints the characters a, b, linefeed, c, and d, and stores a, b, linefeed, c, and d into the first five characters of the PAD, in that order.
"abcd"" Stores a, b, c, and d into the first four characters of the PAD, in that order, and prints nothing.
[10 [3 +] +] Places the function 10 [3 +] + into the function buffer.
[10 [3 +] +] [20 +] Places the functions 10 [3 +] + and 20 + into the function buffer.
Arithmetic and logical operations.
+ Addition: a b → a+b.
- Subtraction: a b → a-b.
* Multiplication: a b → ab.
/ Division : a b → a/b. The quotient is always an integer.
^ Exponentiation: a b → ab. The result is always an integer.
: Root extraction: a b → a1/b. The result is rounded to an integer.
\ Negate: a → -a.
= Equality comparison: a b → c, where c is -1 if a and b are equal and 0 if a and b are unequal.
> Greater-than comparison: a b → c, where c is -1 if a is greater than b and 0 if it is not.
~ Logical NOT: a → b, where b is -1 if a is zero and 0 if a is nonzero.
& Bitwise AND: a b → a ∧ b.
Bitwise OR: a b → a ∨ b.
Stack manipulation.
$ Swap: a b → b a.
% Dup: a → a a.
; Drop: a →.
' Roll: an … a1 a0 b → an-1 … a0 an, if b has value n.
` Pick: an … a1 a0 b → an … a0 an, if b has value n.
Variable manipulation.
D, Store into integer variable D: a →, and a is stored in D.
G@ Read from integer variable G: → a, where a was stored in G.
d, Store function buffer into function variable d: , and X is stored in d.
e@, Set the function index to the name of function variable e.
@@ Execute the function in the function variable named by the function index.
f@ Execute the function in function variable f.
d_, Copy the PAD into function variable d.
Control flow manipulation.
! (with one function in the function buffer) Repeat…until true:
, and X is repeatedly executed and a value a popped from the stack until a is nonzero.
! (with two functions in the function buffer) While…do:
; X is executed, and a value a is then popped from the stack; while a is nonzero, Y is executed, X is executed again, and a is popped again.
? (with one function in the function buffer) If…then:
, a →, and if a was nonzero, X is executed.
? (with two functions in the function buffer) If…then…else:
, a →; X is executed if a is nonzero, and Y is executed if a is zero.
?! These both terminate execution.
!?
Input and output.
( Getchar: → a, where a is the value of a character read from standard input.
) Putchar: a →, and the character with value a is printed to standard output.
< Read: → a, where a is an integer parsed from a line which is read from standard input. The input format is the same as for integers which occur in the OWL code stream.
. Print: a →, and a is printed to standard output in the current output base. Possible output bases are binary, octal, decimal, and hexadecimal.
Print string: the contents of the PAD is treated as a null-terminated string and printed on standard output.
Miscellaneous functions.
, Store into PAD: a b →, and a character with value a is stored into the bth entry of the PAD.
@ Load from PAD: a → b, where b is the value of the ath character in the PAD.
_@ Execute the function stored in the PAD.
System commands.
_OS Push operating system type: → a, where a is 0 if the OWL interpreter is running on Unix and 1 if it is running on Windows.
_v Push version number: → c b a, if the OWL interpreter has version number a.b.c.
_b Set output base to binary.
_o Set output base to octal.
_d Set output base to decimal.
_h These both set the output base to hexadecimal.
_x
_t (Unix only) Time: → y m d s m h, where y, m, and d are the year, month, and day of the current local date, and h, m, and s are the hour, minute, and second of the current local time.
_ty (Unix only) Time components: These seven commands push the year, month, day, hour, minute, second, and millisecond of the current local time, respectively.
_tM
_td
_th
_tm
_ts
_tn
Metalinguistic constructions.
# This is a comment. This is a comment which extends to the end of the line.
(* comment starts
comment, line 1
comment, line 2 …
comment ends *)
This is a multiline comment.
]inc.owl[ Read and execute the OWL source file inc.owl.

Language examples

Implementation

OWL is written in C, using GNU extensions.

See also

External links

 


From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.


Search Titles
0123456789
ABCDEFGHIJ
KLMNOPQRST
UVWXYZ?

E-mail this article to:

Personal Message: