GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing iris.gecode.dev — Introduction IntroductionIris is a specification language for structured text formats. A program in Iris is a reader spec. It describes one format: which values a file contains, how they are laid out, how they are collected into arrays, and which conditions they must satisfy. Given a reader spec and an input file, Iris either returns the file’s contents as named, typed data or rejects the file with the position and the statement that failed. The formats Iris was built for are the benchmark and instance files of combinatorial problems, such as SAT formulas, travelling salesman instances and scheduling problems. Any line- and token-oriented text format is a candidate. The same reader spec works in the command-line tool, in a program that embeds an implementation, and in the playground. A first example: DIMACS CNFSection titled “A first example: DIMACS CNF”This small DIMACS CNF file describes a Boolean formula
with three variables and three clauses. A positive number names a variable;
a negative number negates it. Each clause ends with InputView full input The reader spec for DIMACS CNF in the format library skips
comment lines beginning with Reader specView full reader spec To try this reader without installing anything,
open the example in the playground.
To run it locally, build the CLI, then run
this command from the repository root. The paths are the library’s actual
files. The Read the inputRun from the repository root. $ iris read formats/dimacs-cnf/dimacs-cnf.iris formats/dimacs-cnf/cases/three-variables/input.txt --dznRead succeeded The data has the two integer counts and Invalid inputSection titled “Invalid input”This file also declares three variables, but its second clause uses the
literal InputView full input The range on each literal rejects it. Iris stops at the first failure and reports the input position, the value it found, and the line of the reader spec that rejected it: Read rejectedRun from the repository root. $ iris read formats/dimacs-cnf/dimacs-cnf.iris formats/dimacs-cnf/cases/literal-out-of-range/input.txt --dznInput rejected A failed read prints no partial data, and the CLI exits with status 1. Every
failure also has a stable error code, here
Iris and GecodeSection titled “Iris and Gecode”Iris began as the instance reader in the constraint solver Gecode, which uses reader specs to load benchmark files for its examples. The Iris Language Specification defines the language independently of Gecode, and its appendix C lists the deliberate differences from Gecode’s reader. The reader specs in the format library are Gecode’s. Rust is the reference implementation and the source of the command-line tool and the playground. The Python package binds it, and the TypeScript package runs it as WebAssembly. The C++ library and the Java library are native implementations; see other implementations. Where to go nextSection titled “Where to go next”
|
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |