Var'aq

From Wikipedia, the free encyclopedia

The correct title of this article is var'aq. The initial letter is shown capitalized due to technical restrictions.

var'aq is a programming language based loosely upon the grammatical structure of the Klingon language. It was created as part of a speculative exercise in imagining what the computer culture of the fictional Klingon race might be like, and was created by Brian Connors and Chris Pressey c. 2000.

The language is a stack-based language based loosely on PostScript, with aspects of the Lisp language added for handling data structures.

The following keywords are currently supported:

Control Structures

  • ifyes/HIja'chugh
  • ifno/ghobe'chugh
  • choose/wIv
  • ~ (quote/lI'moH)
  • name/pong
  • set/cher
  • repeat/vangqa'
  • eval/chov

Stack Operations

  • pop/woD
  • dup/latlh
  • exch/tam
  • clear/chImmoH
  • remember/qaw
  • forget/qawHa'

Arithmetic Operators

  • add/boq
  • sub/boqHa'
  • mul/boq'egh
  • div/boqHa'egh
  • mod/chuv
  • pow/law'qa'moH
  • rand/mIS
  • add1/wa'boq
  • sub1/wa'boqHa'
  • pi/HeHmI'
  • e/ghurmi'
  • clip/poD
  • smooth/Hab
  • howmuch/'ar

Trig/Log operators

  • sin/joq
  • cos/joqHa'
  • tan/qojmI'
  • atan/qojHa'
  • ln/ghurtaH

Relational Operators

  • All relational operators have been implemented. Thanks to j proctor for null?/pagh'a', negative?/taH'a', int?/HabmI''a', and number/mI''a'.

I/O Operators

  • The var'aq I/O model remains to be defined, but the basic console I/O functions are now present.

List Operators

  • All list operators are now available

String Operators

  • strtie/tlheghrar
  • streq?/tlheghrap'a'
  • strcut/tlhleghpe'
  • strmeasure/tlheghjuv
  • compose/naQmoH

tlhIngan Hol has names for the numbers and there are also pIqaD (the Klingon writing system) versions of those numbers:

||pagh|| wa'|| cha'|| wej|| loS|| vagh|| jav|| Soch|| chogh|| Hut|| wa'maH||
||0   || 1  || 2   || 3  || 4  || 5   || 6  || 7   || 8    || 9  || 10    ||


[edit] Sample program

Name: hello, world
Dialect: English
Version: 5 June 2000
Comments: Note the canonical var'aq "hello, world";
          actually prints "What do you want, universe?" in Klingon

~ nuqneH { ~ 'u' ~ nuqneH disp disp } name
nuqneH

[edit] External links

In other languages