Virgo is a linear (line by line) programming language that uses just words and numbers, invented in 2010 and developed by Sinatra (aka User:Virgolang, I forgot the pass of Sinatra :( ). It is a retroactive product of the Zodiac Working Group.
- 1 Library
- 2 Syntax
- 3 Examples
- 4 How can use this language?
- 5 What is the current process?
- 6 What will you do?
There are everything that you can use in Virgo.
Instructions grouped here.
As in Assembly, it adds the value to stack.
As in Assembly, it pulls topmost item of stack and puts into operand.
Declares a variable
Same with pop, but it pops all the stack to operand as array. (clears the stack)
poparr <array operand>
Same with push, but it pushes all the content of operand to stack. (fills the stack)
pusharr <array operand>
Calls functions (2nd tier instructions)
call <function name>
Casts the topmost element of stack to specified type.
convst <type selector>
Starts the if block.
Ends the if block and starts the else block
Ends an if-else recording and starts executing recordings based on passed condition.
It is special instruction that required to make use of esoteric functions of Virgo. Esoteric functions will only work with TaurusVM languages.
Functions (2nd tier instructions)
These functions can used only with call instruction.
Pops all stack to temporary array register and sums all of them. And pushes the sum to stack.
Outputs string in stack.
Inputs line of string and pushes it to stack. (_0 pushed if nothing passed)
Outputs string in stack to stderr.
Syntax is pretty easy! Just write function name, and parameters. (all splitted by space)
Some instructions and functions may require type parameters. It's defined in this syntax:
<instruction> $<type name>$
<instruction> $<type name>+$
For functions you need to push type selector.
push $<type name>$
push $<type name>+$
And call it!
call <function name>
This is just examples to get you into Virgo.
push h push e push l push l push o push _ch32 push w push o push r push l push d alloc myStr poparr myStr push myStr call cout.
It pushes all the characters one by one, creates a variable named myStr, pops all stack content to myStr as character array, pushes the myStr (for parameter for cout), and calls cout (the outputting function). The dot means program ended.
Adding two numbers together
alloc first push 10 pop first alloc second push 3 pop second push second push first call add alloc sum pop sum alloc string_output push sum convst $char+$ poparr string_output push string_output call cout.
It allocates first, pushes 10 and pops to first (it literally sets first to 10) then, allocates second. Pushes 3 and pops to second (it literally sets second to 3). Now it pushes the parameters right-to-left since stacks are last-in-first-out, calls add (add pops all the elements on stack to temporary array and pushes the sum). Allocates sum, pops the return value to sum. Allocates string_output, pushes the sum; pops the last element, casts it to char array (+ means array of that type). Casting process pushes all the characters to stack. Pops all the stack as array to string_output, pushes string_output as array of char (not char by char). And calls cout.
Standard Input & Output
Without it, a language is not worth being a language.
alloc for_std_output push W push h push a push t push _32 push i push s push _32 push y push o push u push r push _32 push n push a push m push e push _?_ push _32 poparr for_std_output push for_std_output call cout alloc std_input call cin_line poparr std_input alloc to_compare_str push _0 poparr to_compare_str push std_input push to_compare_str call equality setif push Y push e push s alloc junk poparr junk push junk call cout setelse push N push o alloc junk poparr junk push junk call cout endif
If we enter nothing, it will push null (_0).
What is your name? Yes
If we enter something, it will push entry as string.
What is your name? fsafsaasdf No
We allocate a variable (for_std_output) for question. Pushed the question char by char. Popped them to variable. Pushed string concretely to stack. And asked the question. We allocated another variable (std_input) for getting the entry. Got the entry and popped to variable. We created another variable (to_compare) for comparing with null. Pushed 1 null. Popped it. And pushed the variable as 1st operand. And we pushed another variable (std_input) as 2nd operand. We called equality function (pops 2 element from stack and pushes the result). We created start point for 'if' with setif (it stops executing as it records to temporary code stack). It records the statements until setelse or endif. When it gets to setelse, it starts to recording else block (doesn't wipe if recording) until the endif instruction. When it gets endif, it executes correct block.
How can use this language?
Since there's no interpreter for Virgo, you can only write programs now. Interpreter will convert into C++, compile with G++. If not possible, it'll run it line by line like script. And it will compile to the TaurusVM.
What is the current process?
We're implementing streams.
What will you do?