The ViviFire Programming Language
ViviFire is a new open-source programming language with modern features and a familiar syntax. Its features include object-oriented, functional, declarative and modular programming, generics, traits, units of measure, and more.
ViviFire is alpha software. The language is not stable. It can change very frequently and quickly before it becomes stable.
The source code for ViviFire is released under the MIT license. And the documentation is released under Creative Commons CC0 (public domain).
Example programs
Hello World
Require ViviFire.IO
PrintLine "Hello, world!"
Generic Function
Require ViviFire.Units
Function add[T](a As T, b As T) As T
Return a + b
End
Var x = add(2, 3) ' 5
Var y = add(2!, 3!) ' 5.0
Var z = add(2cm, 3mm) ' 0.023 meters
Zahn's construct
Zahn's construct permits “structured control flow”. You can stop a loop when one of many possible conditions occurs.
Code
Require ViviFire.IO
Var sum = 0
For Each num In {2, 3, 5, 7, 11}
Exit When bad_array
If num = 11 Then Exit bad_array
sum += num
If sum > 20 Then Exit bad_array
// %INDEX is a "magic" loop counter.
PrintLine $"{%INDEX}: {num}"
When bad_array
// 'Exit bad_array' causes this block to run.
PrintLine $"Index {%INDEX} stopped loop"
When DONE
// The loop stopped as usual, without 'Exit'.
PrintLine "Array is OK"
End For
Examples in the manual
Downloads and repository
- 70KB – Updated 14 December 2024
- Parser demo and example code.
- Requires Windows 7 SP2 or later. If it does not run, download the Visual C++ Redistributable.
Download ViviFire source code (ZIP)
- 95KB – Updated 14 December 2024
- Source code for the compiler, mostly in C++.