• Stars
    star
    2,900
  • Rank 15,650 (Top 0.4 %)
  • Language
    Python
  • Created almost 12 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Vigil, the eternal morally vigilant programming language

Vigil is a very safe programming language, and an entry in the January 2013 PLT Games competition.

Many programming languages claim to take testing, contracts and safety seriously, but only Vigil is truly vigilant about not allowing code that fails to pass programmatic specifications.

Syntax and semantics

Vigil is very similar to Python with the minor proviso that you must provide a main() function which will be automatically called for you.

Infinitely more important than mere syntax and semantics is its addition of supreme moral vigilance. This is similar to contracts, but less legal and more medieval.

The implore statement to beseech your needs

Often, a function will require that parameters have certain desirable properties. A function in Vigil can state what it requires by using implore:

def square_root(n):
    implore n >= 0
    return math.sqrt(n)

If a caller fails to provide valid arguments, it is wrong and must be punished.

The swear statement to state what you provide in return

If a good caller meets its obligations, the onus is thus on you to fulfill your end of the bargain. You can state the oaths that you promise to uphold using swear:

def fib(n):
    if n < 2:
        result = n
    else:
        result = fib(n - 1) + fib(n - 2)

    # fib() never returns negative number.
    swear result >= 0
    return result

If a function fails to uphold what it has sworn to do, it is wrong and must be punished.

Unhandled exceptions

It goes without saying that any function that throws an exception which isn't caught is wrong and must be punished.

Runtime vigilance

This is where Vigil sets itself apart from weaker languages that lack the courage of their convictions. When a Vigil program is executed, Vigil itself will monitor all oaths (implorations and swears) that have been made. If an oath is broken, the offending function (the caller in the case of implore and the callee in the case of swear) will be duly punished.

How?

Simple: it will be deleted from your source code.

The only way to ensure your program meets its requirements is to absolutely forbid code that fails to do so. With Vigil, this shall be done for you automatically. After enough runs, Vigil promises that all remaining code meets its oaths.

Usage

Vigil is a command-line executable. Pass it the path to a file to run:

$ ./vigil example/hello.vg

The "example" directory has some to get you started.

FAQ

Is this serious?

Eternal moral vigilance is no laughing matter.

But isn't a language that deletes code crazy?

No, wanting to keep code that demonstrably has bugs according to its own specifications is crazy. What good could it possibly serve? It is corrupted and must be cleansed from your codebase.

Vigil will do this for you automatically.

Vigil deleted a function. Won't that cause the functions that call it to fail?

It would seem that those functions appear to be corrupted as well. Run Vigil again and it will take care of that for you. Several invocations may be required to fully excise all bugs from your code.

More Repositories

1

craftinginterpreters

Repository for the book "Crafting Interpreters"
HTML
8,949
star
2

game-programming-patterns

Source repo for the book
HTML
4,134
star
3

hauberk

A web-based roguelike written in Dart.
Dart
2,009
star
4

mark-sweep

A simple mark-sweep garbage collector in C
C
722
star
5

magpie

The Magpie programming language
Python
360
star
6

bantam

A simple demo app for Pratt parsing
Java
312
star
7

finch

The Finch programming language
C++
242
star
8

jasic

A complete interpreter for a dialect of BASIC in one Java sourcefile
Java
150
star
9

rooms-and-mazes

Animated demo code for a random dungeon generator
Dart
137
star
10

ui-as-code

Design work on improving Dart's syntax for UI code
Dart
121
star
11

amaranth

An open source roguelike written in C#
C#
120
star
12

journal

My blog, in all its statically-generated glory.
HTML
101
star
13

malison

A little terminal emulation package for Dart.
Dart
74
star
14

lark

The Lark programming language.
Java
59
star
15

piecemeal

Basic data structures your 2D Dart game may need.
Dart
52
star
16

wrenalyzer

Static analyzer for the Wren programming language
44
star
17

lisp2-gc

A simple implementation of the LISP2 mark-compact GC algorithm
C
38
star
18

malison-dotnet

A terminal emulation library in C#
C#
36
star
19

a-turn-based-game-loop

Demo code for http://journal.stuffwithstuff.com/2014/07/15/a-turn-based-game-loop/
Dart
28
star
20

markymark

A tiny static web server for previewing Markdown files
Dart
25
star
21

fov

Demo code for a blog post about field-of-view calculation
Dart
21
star
22

bulfinch

Just a little toy language to learn about register-based VMs.
Java
20
star
23

pattern_matching

A simple ML-like pattern-matching library in C#.
C#
18
star
24

bramble-dotnet

A set of utility classes and extension methods in C#
C#
17
star
25

bits

Tiny web page for converting between binary, decimal, hex and UTF-8
HTML
9
star
26

dep-external-libraries

Proposal for handling platform-specific code in Dart
Dart
8
star
27

temp_primary_constructors

Temporary repo for trying out a proposed Dart language feature
Dart
7
star
28

wren-sublime

A Sublime Package for the Wren programming language
6
star
29

multipleinheritance.js

A little hack to get multiple inheritance working in JavaScript.
JavaScript
6
star
30

settings

My personal settings, configurations, and dotfiles.
Shell
5
star
31

wren-atom

Atom package for Wren
CoffeeScript
4
star
32

linkedlist

Reversing a linked list
Go
4
star
33

magpie-csharp

The old C#-based Magpie programming language
C#
3
star
34

magpie-optionally-typed

The old single-dispatch optionally-typed flavor of the Magpie programming language.
C#
3
star
35

temp-flutter-examples

Temporary repo looking at some Flutter examples
Dart
2
star
36

dep-interface-libraries

DEP for configuration-specific code in Dart
2
star
37

gallery-constructors

Temporary repo to test out some potential changes around constructors in Dart
Dart
1
star
38

format-flutter

Temporary repo to apply an experimental dart format style to Flutter.
Dart
1
star
39

module_scrape

Temporary code for investigating a module system for Dart
Dart
1
star
40

temp_flutter_format

Temporary repo to experiment with some formatting styles in the Flutter repo
Dart
1
star
41

support

My personal repository for support files: things like color schemes, preferences, and other settings files that it's handy to have centrally accessible.
1
star