Skip to content

main.aug ​

Checked-error benchmark · Source and specification

Files in this project

Code ​

aug
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
import validate from operations
int iterations = 20000
int index = 0
int checksum = 0
int failures = 0
while index < iterations:
    try:
        checksum = checksum + validate(value=index)
    catch FileError error:
        failures = failures + 1
    index = index + 1
print(value=checksum)
print(value=failures)
aug
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
import validate from operations
int iterations = 20000
int index = 0
int checksum = 0
int failures = 0
while index < iterations {
    try {
        checksum = checksum + validate(value=index)
    }
    catch FileError error {
        failures = failures + 1
    }
    index = index + 1
}
print(value=checksum)
print(value=failures)

Compiled specification ​

Interactions and sequences

Startup ​

It sets iterations to 20000. It sets index, checksum, and failures separately, each to 0. source

While index is less than iterations, it tries to increase checksum by validate with value from index. If this work raises FileError, it increases failures by 1. It increases index by 1. After the loop, it prints checksum. source

It prints failures. source

Dependencies ​

It uses validate from operations.

Built-in operations follow the language reference.

Last updated:

The world runs on language