Vitro is a lightweight programming language that supports basic arithmetic, variables, and control structures.
- Supports addition (
+), subtraction (-), multiplication (*), division (/), and exponentiation (^). - Parentheses
()can be used to specify precedence.
- Identifiers start with a lowercase letter and can include alphanumeric characters.
- Assignment is done using
x = 10;syntax.
- Distinguishes between
ExprandProcess. Processcan include literals, variables, parenthesized expressions, andifexpressions.
- Supports
if <Expr> <CompareOp> <Expr> then <Process> else <Process>. - Comparison operators include
==,!=,<,<=,>,>=. - Both
thenandelseclauses are mandatory.
return <Process>;is used to produce the program's result.
- Whitespace and line breaks are ignored for readability.
- Statements are separated by semicolons
;.
- Generates an Abstract Syntax Tree (AST) for evaluation.
evalfunction executes calculations while maintaining variable environment.
Download from https://github.com/pantsman-jp/Vitro.
Require GHCup. I use ghcup 0.1.50.2, ghc 9.6.7, cabal 3.12.1.0.
To run:
% cabal runThen you can input a program, and it is evaluated. Like this:
>
x=1; y=0; return if x==y then 1 else 0;
output is of course...
0
Note
There is a line break after > .
It's not a fatal bug.
I will fix it when I feel like it.
Copyright © 2025 pantsman