The ViviFire Programming Language
ViviFire is a brand new open-source programming language with modern features and a familiar syntax. It offers object-oriented programming with genericity and traits, modularity, units of measure, and more.
Currently, ViviFire is at an alpha stage of development. The language is still evolving, and may change dramatically before it's done. If you are interested in how a language is created, join us and help make it great!
ViviFire is released under the MIT license.
Example programs
Hello World
Program Hello
Require ViviFire.IO
PrintLine "Hello, world!"
Generic Function
Program Generic
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
Program ZahnsConstruct
Require ViviFire.IO
Var sum = 0
For Each num In {2, 3, 5, 7, 11}
Begin
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
- 62KB – Updated 27 May 2023
- Parser demo and example code.
- Requires Windows 7 SP2 or later. Have a problem?
Download ViviFire source code (ZIP)
- 76KB – Updated 27 May 2023
- Source code for the compiler, mostly in C++.