vv
Jump to navigation
Jump to search
vv is an esolang created by User:Username1234.
Brief intro
There are only two useful characters in this language: v
and ^
. If you want to write annotation, you need to write it behind a ))
.
Operators
^
separates the operators so all you need to care about is the number of v
in every operator.
Number | Meaning |
---|---|
1 | Push the number 1 into the stack
|
2 | Pop the top of the stack |
3 | Print the top of the stack |
4 | Change the ASCII of the top of the stack by one |
5 | Change the ASCII of the top of the stack by negative one |
6 | Change the top to (the ASCII of the top element)the ASCII of the top element mod 128 |
7 | End of the programme |
Examples
Print out "CCF"
v^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvv^vv^v^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvv^vv^v^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvv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vvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvv^vv^v^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvv^vv^v^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvvv^vvv^vv^vvvvvvv
Implementation
The following program in Common Lisp offers an interpreter for the language:
(defun interpret-v^v (code &aux (code-length (length code)) (position 0) (command 0) (stack NIL)) "Executes the piece of v^v CODE and returns NIL." (declare (type string code) (type fixnum code-length position) (type (integer 0 *) command) (type list stack)) (symbol-macrolet ((finished-p (>= position code-length)) (token (the character (char code position)))) (flet ((execute-command () (case command (1 (push command stack)) (2 (pop stack)) (3 (write-char (code-char (first stack)))) (4 (incf (first stack))) (5 (decf (first stack))) (6 (setf (first stack) (mod (expt (first stack) (first stack)) 128))) (7 (setf position code-length)) (otherwise (error "Invalid command: ~d." command))) (values))) (loop until finished-p do (case token (#\^ (execute-command) (setf command 0) (incf position)) (#\v (setf command (loop while (and (not finished-p) (char= token #\v)) do (incf position) count 1))) (#\) (incf position) (if (and (not finished-p) (char= token #\))) (loop until finished-p do (incf position)) (error "Invalid token starting with ')'."))) (otherwise (error "Invalid token ~s at position ~d." token position))) finally (execute-command)))))
The arduous process of generating a message output program can be alleviated by the following function:
(defun build-message-program (text &key (destination NIL)) "Creates a v^v program which outputs the TEXT and writes the code to the DESTINATION, returning for a non-NIL DESTINATION the NIL value, otherwise responding with a fresh string containing the result." (declare (type string text) (type (or null (eql T) stream string) destination)) (the (or null string) (if destination (loop for character of-type character across text do ;; Push the number one (1) unto the stack. (format destination "v^") ;; Increment the one-valued top stack element until it matches ;; the CHARACTER's ASCII code. (loop repeat (1- (char-code character)) do (format destination "vvvv^")) ;; Print the top of the stack as an ASCII character. (format destination "vvv^") ;; Pop the just printed top of the stack. (format destination "vv^") ;; Write program end. finally (format destination "vvvvvvv")) (with-output-to-string (output) (declare (type string-stream output)) (build-message-program text :destination output)))))
The follwing is a Python interpreter for the esolang:
def interpret(code): token=[i.count('v') for i in code.split('))')[0].split('^')] stack=[] for i in token: if i==1: stack.append(1) if i==2: stack.pop() if i==3: print(chr(stack[-1]),end='') if i==4: stack[-1]+=1 if i==5: stack[-1]-=1 if i==6: stack[-1]=stack[-1]**stack[-1]%128 if i==7: return interpret(input())
And an output generator:
print('^'.join(sum([['v']+['vvvv']*(ord(i)-1)+['vvv','vv'] for i in input()],[])+['vvvvvvv']))