Skip to content

Vinetwigs/vilmos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub code size in bytes GitHub go.mod Go version GitHub last commit stars - vilmos forks - vilmos License issues - vilmos

vilmos interpreter

Official vilmos language interpreter. Thanks to this application you will be able to see your paintings come to life. The interpreter offers many useful tools to help your programming sessions!

Table of Contents

  1. Prerequisites
  2. References
  3. Installing
  4. How to use
    1. Get help
    2. Run a program
    3. Use bigger images
    4. Debugger
    5. Set max memory size
  5. Version
  6. Author
  7. Contributors
  8. LICENSE

References

Back to top

Prerequisites

  • Make sure you have at least installed Go v1.17 or your paintings may be blue.
  • Knowledge of vilmos language

Back to top

Installing

go install github.com/Vinetwigs/vilmos/v2

Back to top

How to use

Get help

Use vilmos help command to get informations about interpreter usage.

help-gif

Optionally you can use alternative forms:

  • vilmos -h
  • vilmos --help

Back to top

Run a program

vilmos -i <FILE_PATH> is the easiest way to see your colors in action. Make sure your image is in .png format. By default, each instruction is rapresented by a pixel.

For instance, let's try executing this vilmos program:

file-input

This simple program, will output a cool ASCII art. Let's see it in action:

input-gif

Alternative forms:

  • vilmos --input <FILE_PATH>

Back to top

Use bigger images

The program we used above is really cool in my opinion but it's kind too small. Let's use a bigger version of the same program to make it more appealing. In this case, each instruction of our program it is no longer rapresented by a single pixel
but by a 200x200px square.

Perfect! Now we can clearly see each instruction of our program.

When we will run this program, we have to tell to the interpreter that the size of each instruction is a 200px per side square. This is easily achievable using -s <SIZE> flag. Full instruction will be vilmos -s 200 -i ./vilmos_big.png

Let's see it in action:

big-input-gif

Alternative forms:

  • vilmos --instruction_size <SIZE>
  • vilmos --size <SIZE>
  • vilmos --is <SIZE>

Back to top

Debugger

Thanks to this useful tools integrated in vilmos interpreter, it is possible to execute our programs
step by step printing in each step the stack content and a message explaing what the interpreter have done.
This feature is useful to debug them and find & fix possible bugs.

To enable debugger mode all you need to do is using -d flag when running your painting.

This time we will use the following program:

counter-alt

This charming program will simply put into the stack integers from 1 to MAX_INT without outputting anything.
To see if our program works we will see the stack content through the debugger feature.

debugger-gif

Alternative forms:

  • vilmos --debug

Back to top

Set max memory size

The problem with the above program execution is that it will run until it's manually stopped, because
by default there is no maximum memory size.

To specify a maximum size for the memory usable for your painting execution you have to use vilmos -m <size> flag. Now if you try to put in memory another element when the stack is full, an error will be launched
and the execution will be stopped.

Let's see it in action setting the max stack size to 200 elements:

max-size-gif

Alternative forms:

  • vilmos --max_size <SIZE>

Back to top

Use custom color codes

The true power of vilmos visual language is the capability of setting custom color codes for the instructions.
This lets you have total control on your Art.

To achieve that, you have to compile a config.ini file provided by this repository. To compile the configs, you have to specify color codes to override to the relative operation.

NOTICE: you can see default instructions color codes in language specification

The color codes must be in the HEX format (without the #) and there are two supported formats:

  1. Full Hex code (a044d1)
  2. Short Hex code (fff)

Once you have chosen your favourite colors, you can set custom colors through the following flag: vilmos -c <CONFIG_FILE_PATH>.

For instance, we will override instructions to the image seen above to make it use orange pallette insteand of blue.

New version of out program will be:

config-counter-alt

And we will compile configs.ini file in the following way to match the colors we have chosen:

[Colors]
AND=
CYCLE=
DIV=
DUP=ffb732
FILE_CLOSE=
FILE_OPEN=
INPUT_ASCII=
INPUT_INT=
LSHIFT=
MOD=
MUL=
NAND=
NOT=
OR=
OUTPUT=
OUTPUT_ASCII=
OUTPUT_INT=
POP=
QUIT=
RCYCLE=
REVERSE=
RND=
RSHIFT=
SUB=
SUM=ffcb4b
SWAP=
WHILE=ffa300
WHILE_END=ff834b
XOR=

Let's see this new version in action:

configs-gif

Alternative forms:

  • vilmos --conf <CONFIG_FILE_PATH>
  • vilmos --config <CONFIG_FILE_PATH>

Back to top

Version

To print actual vilmos interpreter version you have different choices:

  • vilmos version
  • vilmos --version
  • vilmos -V
  • vilmos -v

Back to top

Author

Back to top

Contributors

Back to top

License

   Copyright 2021 Vinetwigs

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

Back to top