From e61ae7483030699917c267a341bb13d8cced40cc Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 12 Apr 2018 15:25:56 +0200 Subject: [PATCH 01/70] Lock the Cargo manifest\! --- .gitignore | 1 - Cargo.lock | 1789 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1789 insertions(+), 1 deletion(-) create mode 100644 Cargo.lock diff --git a/.gitignore b/.gitignore index 0dda90517..8e64e12be 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ *.swp -*.lock *.log examples/out/ perf.data diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 000000000..9cac3d376 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1789 @@ +[[package]] +name = "aho-corasick" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "aho-corasick" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arrayvec" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ascii-canvas" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atty" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atty" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bincode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bit-set" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bit-vec" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "boxfnonce" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "byteorder" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bytes" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cfg-if" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "compare" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "config" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde-hjson 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "crossbeam-deque" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-deque" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-utils" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-utils" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "csv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "data_structure_traits" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "hashmap_core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "diff" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "docopt" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dtoa" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "either" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ena" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "encode_unicode" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "env_logger" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "env_logger" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "errno" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "extprim" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fixedbitset" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures" +version = "0.2.0-beta" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "futures-executor 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "futures-stable 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-channel" +version = "0.2.0-beta" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-core" +version = "0.2.0-beta" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-executor" +version = "0.2.0-beta" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-io" +version = "0.2.0-beta" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-sink" +version = "0.2.0-beta" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-stable" +version = "0.2.0-beta" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "futures-executor 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "pin-api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-util" +version = "0.2.0-beta" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gcc" +version = "0.3.54" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "getopts" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "handlebars" +version = "0.28.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "hashmap_core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "humantime" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "immut_list" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "data_structure_traits 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "interval-heap" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "compare 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "iovec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ipc-channel" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itertools" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itertools" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itertools" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itoa" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lalrpop" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-intern 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-snap 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-util 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "petgraph 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lalrpop-intern" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lalrpop-snap" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-intern 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-util 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "petgraph 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lalrpop-util" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazycell" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.39" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "linked-hash-map" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "linked-list" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "log" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "matches" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "memchr" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memoffset" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "mio" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "net2" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nix" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nodrop" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "nom" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", + "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-bigint" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-complex" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-integer" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-iter" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-rational" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "num_cpus" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ordermap" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "owning_ref" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pbr" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pest" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "petgraph" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fixedbitset 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pin-api" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "prctl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "prettytable-rs" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "encode_unicode 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "proc-macro2" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quick-error" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quote" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rayon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rayon-core" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_termios" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "0.1.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "regex-syntax" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "regex-syntax" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "remove_dir_all" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-serialize" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc_version" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustfmt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", + "strings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustlex" +version = "0.3.3" +source = "git+https://github.com/ulysseB/rustlex.git#86116c3c8e95b064bd53bf2ce00b7456f0f83dec" +dependencies = [ + "rustlex_codegen 0.3.3 (git+https://github.com/ulysseB/rustlex.git)", +] + +[[package]] +name = "rustlex_codegen" +version = "0.3.3" +source = "git+https://github.com/ulysseB/rustlex.git#86116c3c8e95b064bd53bf2ce00b7456f0f83dec" +dependencies = [ + "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "rustlex_fsa 0.3.3 (git+https://github.com/ulysseB/rustlex.git)", +] + +[[package]] +name = "rustlex_fsa" +version = "0.3.3" +source = "git+https://github.com/ulysseB/rustlex.git#86116c3c8e95b064bd53bf2ce00b7456f0f83dec" +dependencies = [ + "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "scopeguard" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde-hjson" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_derive" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive_internals 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_derive_internals" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_test" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slab" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "slab" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "smallvec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "stable_deref_trait" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "std-semaphore" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strings" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "strsim" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "syn" +version = "0.12.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_errors" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_pos" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_syntax" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "extprim 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "telamon" +version = "0.2.0" +dependencies = [ + "boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "config 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "data_structure_traits 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "errno 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "immut_list 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "interval-heap 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ipc-channel 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-list 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pbr 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "prctl 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "prettytable-rs 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "std-semaphore 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "telamon-gen 1.0.0", + "telamon-utils 1.0.0", + "tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.0 (git+https://github.com/ulysseB/tokio-timer.git)", +] + +[[package]] +name = "telamon-gen" +version = "1.0.0" +dependencies = [ + "env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "handlebars 0.28.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-util 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rustfmt 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustlex 0.3.3 (git+https://github.com/ulysseB/rustlex.git)", + "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", + "telamon-utils 1.0.0", + "topological-sort 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "telamon-gen-test" +version = "0.1.0" +dependencies = [ + "env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "telamon-gen 1.0.0", + "telamon-utils 1.0.0", +] + +[[package]] +name = "telamon-kernels" +version = "0.1.0" +dependencies = [ + "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "telamon 0.2.0", + "telamon-utils 1.0.0", +] + +[[package]] +name = "telamon-utils" +version = "1.0.0" +dependencies = [ + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-list 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tempdir" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "term" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termcolor" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termion" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread-id" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread_local" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread_local" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-executor" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-io" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-reactor" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-threadpool" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-timer" +version = "0.2.0" +source = "git+https://github.com/ulysseB/tokio-timer.git#0dfa8c024eeb34bd8cfa84b4ecbd5baf9c108fab" +dependencies = [ + "futures 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "toml" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "topological-sort" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ucd-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-segmentation" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-width" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "utf8-ranges" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "utf8-ranges" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "uuid" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wincolor" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "yaml-rust" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" +"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4" +"checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" +"checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2" +"checksum atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d0fd4c0631f06448cc45a6bbb3b710ebb7ff8ccb96a0800c994afe23a70d5df2" +"checksum atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "af80143d6f7608d746df1520709e5d141c96f240b0e62b0aa41bdfb53374d9d4" +"checksum bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bda13183df33055cbb84b847becce220d392df502ebe7a4a78d7021771ed94d0" +"checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c" +"checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f" +"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" +"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" +"checksum boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cbec60c560f322d8e3cd403f91d8908cfd965fff53ba97154bd1b9d90149d98e" +"checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23" +"checksum bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1b7db437d718977f6dc9b2e3fd6fc343c02ac6b899b73fdd2179163447bd9ce9" +"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" +"checksum compare 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ea0095f6103c2a8b44acd6fd15960c801dafebf02e21940360833e0673f48ba7" +"checksum config 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e595d1735d8ab6b04906bbdcfc671cce2a5e609b6f8e92865e67331cc2f41ba4" +"checksum crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24ce9782d4d5c53674646a6a4c1863a21a8fc0cb649b3c94dfc16e45071dea19" +"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" +"checksum crossbeam-deque 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c1bdc73742c36f7f35ebcda81dbb33a7e0d33757d03a06d9ddca762712ec5ea2" +"checksum crossbeam-epoch 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "59796cc6cbbdc6bb319161349db0c3250ec73ec7fcb763a51065ec4e2e158552" +"checksum crossbeam-epoch 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9b4e2817eb773f770dcb294127c011e22771899c21d18fce7dd739c0b9832e81" +"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" +"checksum crossbeam-utils 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d636a8b3bcc1b409d7ffd3facef8f21dcb4009626adbd0c5e6c4305c07253c7b" +"checksum csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7ef22b37c7a51c564a365892c012dc0271221fdcc64c69b19ba4d6fa8bd96d9c" +"checksum data_structure_traits 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "98292bd3b24a11b38d7572cfaa03dc8ee8b7f8e800545edeb2a855d779224f1c" +"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" +"checksum docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab32ea6e284d87987066f21a9e809a73c14720571ef34516f0890b3d355ccfd8" +"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" +"checksum either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "740178ddf48b1a9e878e6d6509a1442a2d42fd2928aae8e7a6f8a36fb01981b3" +"checksum ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe5a5078ac8c506d3e4430763b1ba9b609b1286913e7d08e581d1c2de9b7e5" +"checksum encode_unicode 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c088ec0ed2282dcd054f2c124c0327f953563e6c75fdc6ff5141779596289830" +"checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" +"checksum env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0561146661ae44c579e993456bc76d11ce1e0c7d745e57b2fa7146b6e49fa2ad" +"checksum errno 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b2c858c42ac0b88532f48fca88b0ed947cad4f1f64d904bcd6c9f138f7b95d70" +"checksum extprim 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb09b6eb24a48a5c57729e4a60980bf538b3662c3bcec04b6c7908d7a0f3d9b9" +"checksum fixedbitset 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "85cb8fec437468d86dc7c83ca7cfc933341d561873275f22dd5eedefa63a6478" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0bab5b5e94f5c31fc764ba5dd9ad16568aae5d4825538c01d6bca680c9bf94a7" +"checksum futures 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "45af3b9fb6f97c12f7a3af62e4c31df558931ae781834ead417abe04dcb9ec9f" +"checksum futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "e3feaa3c573e6998c2d41dfb940482b76c1ef9b9150f6446cf5f12060b9a2ab8" +"checksum futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "90a83c1b1c895acbb7165f0057f6772523ca6df210730f74955c27449b5411cc" +"checksum futures-executor 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "936d1c79555e1cbd2dbc4b139420adb3a1ed64764779d8131d84045db26ddb92" +"checksum futures-io 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "05423a90af7b3fa6ca88034f0806553a59235b1a1098e32c4ffcbecf83f33045" +"checksum futures-sink 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "c99954270203f2c4c38cb8c0819648e8600eb5dbebd03f6ec35268f16bd98018" +"checksum futures-stable 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "d736f069fc69cb99ce13daebfa0bde4ade0a3b9703cd8b7c8ec38a8577bb45f0" +"checksum futures-util 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "674f3ba0fbc1e544de9776fb9d1c5c1cd72c5e17f1523e409a1c5642b57a734e" +"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb" +"checksum getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05" +"checksum handlebars 0.28.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1bed53dfb11098ec893ed54aa8b9828ffb98d28acbe56a49419935e5a8688ca9" +"checksum hashmap_core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "75919d1685421dc9ea9491c285bc0c0cf5525d166eec8a0f6d5462486d82ca89" +"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" +"checksum immut_list 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3629c418e9452f58ac93153b0409cba3f4f37594948db50e46b35f447ffaf035" +"checksum interval-heap 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "11274e5e8e89b8607cfedc2910b6626e998779b48a019151c7604d0adcb86ac6" +"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" +"checksum ipc-channel 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db9daf099728ac5390c73f54e6e3708f0c514d2b51f24373830f568702eadfca" +"checksum itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4833d6978da405305126af4ac88569b5d71ff758581ce5a987dbfa3755f694fc" +"checksum itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d3f2be4da1690a039e9ae5fd575f706a63ad5a2120f161b1d653c9da3930dd21" +"checksum itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450" +"checksum itoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92a9df60778f789c37f76778ae8d0a2471c41baa8b059d98a5873c978f549587" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum lalrpop 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fe7e84d1b798674f26dd7f2e7c0c92b5736f77866dadcf59c64b949ff40d00" +"checksum lalrpop-intern 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8af84a2fa97bb57e285c56b8303645cefa17c92ad115c4d711b3b4ba5bc5c197" +"checksum lalrpop-snap 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "395696fe1022abe294978648249b5edd854395a199b0e9e5579c7fab47b807d0" +"checksum lalrpop-util 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9d51721b6a49a70a02c02862e27c57069878fa6bf6689c20b755a45efc8c67" +"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" +"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d" +"checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef" +"checksum libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "f54263ad99207254cf58b5f701ecb432c717445ea2ee8af387334bdd1a03fdff" +"checksum linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd" +"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e" +"checksum linked-list 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a4dacf969043dc69f1f731b5042eb05e030d264bcf34f2242889fcbdc7a65f06" +"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" +"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2" +"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" +"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" +"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" +"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d" +"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" +"checksum mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "6d771e3ef92d58a8da8df7d6976bfca9371ed1de6619d9d5a5ce5b1f29b85bfe" +"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +"checksum net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "9044faf1413a1057267be51b5afba8eb1090bd2231c693664aa1db716fe1eae0" +"checksum nix 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b7fd5681d13fda646462cfbd4e5f2051279a89a544d50eb98c365b507246839f" +"checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" +"checksum nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b" +"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" +"checksum num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "81b483ea42927c463e191802e7334556b48e7875297564c0e9951bd3a0ae53e3" +"checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" +"checksum num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f8d26da319fb45674985c78f1d1caf99aa4941f785d384a2ae36d0740bc3e2fe" +"checksum num-iter 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "4b226df12c5a59b63569dd57fafb926d91b385dfce33d8074a412411b689d593" +"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" +"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" +"checksum num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dee092fcdf725aee04dd7da1d21debff559237d49ef1cb3e69bcb8ece44c7364" +"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" +"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" +"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +"checksum parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd9d732f2de194336fb02fe11f9eed13d9e76f13f4315b4d88a14ca411750cd" +"checksum parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "538ef00b7317875071d5e00f603f24d16f0b474c1a5fc0ccb8b454ca72eafa79" +"checksum pbr 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e048e3afebb6c454bb1c5d0fe73fda54698b4715d78ed8e7302447c37736d23a" +"checksum pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0a6dda33d67c26f0aac90d324ab2eb7239c819fc7b2552fe9faa4fe88441edc8" +"checksum petgraph 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "7a7e5234c228fbfa874c86a77f685886127f82e0aef602ad1d48333fcac6ad61" +"checksum pin-api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4806efe6dbda279bde1fe6e07de93e0a022487f290b5dee3e465793e1c34f7ad" +"checksum prctl 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "059a34f111a9dee2ce1ac2826a68b24601c4298cfeb1a587c3cb493d5ab46f52" +"checksum prettytable-rs 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "34dc1f4f6dddab3bf008ecfd4fd2a631b585fbf0af123f34c1324f51a034ff5f" +"checksum proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0" +"checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4" +"checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408" +"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" +"checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" +"checksum rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80e811e76f1dbf68abf87a759083d34600017fc4e10b6bd5ad84a700f9dba4b1" +"checksum rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d24ad214285a7729b174ed6d3bcfcb80177807f959d95fafd5bfc5c4f201ac8" +"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd" +"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" +"checksum regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "aec3f58d903a7d2a9dc2bf0e41a746f4530e0cab6b615494e058f67a3ef947fb" +"checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" +"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e" +"checksum regex-syntax 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b2550876c31dc914696a6c2e01cbce8afba79a93c8ae979d2fe051c0230b3756" +"checksum remove_dir_all 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5d2f806b0fcdabd98acd380dc8daef485e22bcb7cddc811d1337967f2528cf5" +"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" +"checksum rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a54aa04a10c68c1c4eacb4337fd883b435997ede17a9385784b990777686b09a" +"checksum rustfmt 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec940eed814db0fb7ab928c5f5025f97dc55d1c0e345e39dda2ce9f945557500" +"checksum rustlex 0.3.3 (git+https://github.com/ulysseB/rustlex.git)" = "" +"checksum rustlex_codegen 0.3.3 (git+https://github.com/ulysseB/rustlex.git)" = "" +"checksum rustlex_fsa 0.3.3 (git+https://github.com/ulysseB/rustlex.git)" = "" +"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" +"checksum serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe95aa0d46f04ce5c3a88bdcd4114ecd6144ed0b2725ebca2f1127744357807" +"checksum serde-hjson 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a2376ebb8976138927f48b49588ef73cde2f6591b8b3df22f4063e0f27b9bec" +"checksum serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "23b163a6ce7e1aa897919f9d8e40bd1f8a6f95342ed57727ae31387a01a7a356" +"checksum serde_derive_internals 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "370aa477297975243dc914d0b0e1234927520ec311de507a560fbd1c80f7ab8c" +"checksum serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "28556329a1d04efa036376c9588a0ed8655e202676d918733ca8a14740ee31be" +"checksum serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5" +"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23" +"checksum slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdeff4cd9ecff59ec7e3744cbca73dfe5ac35c2aedb2cfba8a1c715a18912e9d" +"checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9" +"checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b" +"checksum std-semaphore 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "33ae9eec00137a8eed469fb4148acd9fc6ac8c3f9b110f52cd34698c8b5bfa0e" +"checksum strings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa481ee1bc42fc3df8195f91f7cb43cf8f2b71b48bac40bf5381cfaf7e481f3c" +"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" +"checksum syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)" = "8c5bc2d6ff27891209efa5f63e9de78648d7801f085e4653701a692ce938d6fd" +"checksum syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3133289179676c9f5c5b2845bf5a2e127769f4889fcbada43035ef6bd662605e" +"checksum syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "30ab669fa003d208c681f874bbc76d91cc3d32550d16b5d9d2087cf477316470" +"checksum syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03815b9f04d95828770d9c974aa39c6e1f6ef3114eb77a3ce09008a0d15dd142" +"checksum tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f73eebdb68c14bcb24aef74ea96079830e7fa7b31a6106e42ea7ee887c1e134e" +"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" +"checksum termcolor 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "56c456352e44f9f91f774ddeeed27c1ec60a2455ed66d692059acfb1d731bda1" +"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" +"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" +"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963" +"checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098" +"checksum tokio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "490c5ff233997a62649c0a7b523b25a1cc6fab1389b3faed0d72e8bdcef7b0ad" +"checksum tokio-executor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46108c2aca0eb4b9a883bf37a28d122ca70f5318446f59f729cd1ff78a0bb5fb" +"checksum tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6af9eb326f64b2d6b68438e1953341e00ab3cf54de7e35d92bfc73af8555313a" +"checksum tokio-reactor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f21d00eb356854d502b81776cec931d12771e4ed6d198478d23ffd38c19279af" +"checksum tokio-threadpool 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "19a8656c45ae7893c9090ac5c98749e7ff904932973fabd541463f82628efacb" +"checksum tokio-timer 0.2.0 (git+https://github.com/ulysseB/tokio-timer.git)" = "" +"checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e" +"checksum topological-sort 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa7c7f42dea4b1b99439786f5633aeb9c14c1b53f75e282803c2ec2ad545873c" +"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" +"checksum unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8083c594e02b8ae1654ae26f0ade5158b119bd88ad0e8227a5d8fcd72407946" +"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" +"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" +"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" +"checksum uuid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "990fb49481275abe3c8e2a91339c009cd6146d9f38fc3413e4163d892cbaffbb" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767" +"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +"checksum yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57ab38ee1a4a266ed033496cf9af1828d8d6e6c1cfa5f643a2809effcae4d628" From 1d96bfe078668a98903cdf289960ef3407a65efd Mon Sep 17 00:00:00 2001 From: adjivas Date: Tue, 17 Apr 2018 14:22:51 +0200 Subject: [PATCH 02/70] pre-implementation of flex --- .travis.yml | 33 +- Cargo.lock | 1789 -------------------------------- telamon-gen/Cargo.toml | 4 +- telamon-gen/build.rs | 14 + telamon-gen/src/exh.l | 19 + telamon-gen/src/lexer.rs | 189 ---- telamon-gen/src/lexer/ffi.rs | 16 + telamon-gen/src/lexer/mod.rs | 49 + telamon-gen/src/lexer/token.rs | 12 + telamon-gen/src/lib.rs | 6 +- 10 files changed, 137 insertions(+), 1994 deletions(-) delete mode 100644 Cargo.lock create mode 100644 telamon-gen/src/exh.l delete mode 100644 telamon-gen/src/lexer.rs create mode 100644 telamon-gen/src/lexer/ffi.rs create mode 100644 telamon-gen/src/lexer/mod.rs create mode 100644 telamon-gen/src/lexer/token.rs diff --git a/.travis.yml b/.travis.yml index 99a382c20..8bd570998 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,18 +2,31 @@ language: rust cache: cargo sudo: false rust: -- nightly-2018-04-03 + - stable + - beta + - nightly +matrix: + allow_failures: + - rust: nightly + fast_finish: true +addons: + apt: + packages: + - flex +before_script: + - flex --version script: -- cargo build --verbose --all -- cargo test --verbose --all -- cargo doc --verbose --all + - cd telamon-gen + - cargo build --verbose --all + - cargo test --verbose --all + - cargo doc --verbose --all deploy: -- provider: pages - local-dir: target/doc - target-branch: gh-pages - skip-cleanup: true - keep-history: true - github-token: "$GITHUB_TOKEN" + - provider: pages + local-dir: target/doc + target-branch: gh-pages + skip-cleanup: true + keep-history: true + github-token: "$GITHUB_TOKEN" notifications: slack: rooms: diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 9cac3d376..000000000 --- a/Cargo.lock +++ /dev/null @@ -1,1789 +0,0 @@ -[[package]] -name = "aho-corasick" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "aho-corasick" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "arrayvec" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ascii-canvas" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "atty" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "atty" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bincode" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bit-set" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bit-vec" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bitflags" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bitflags" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "boxfnonce" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "byteorder" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bytes" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cfg-if" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "compare" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "config" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde-hjson 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "crossbeam-deque" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-epoch 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-deque" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-epoch 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-utils" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-utils" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "csv" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "data_structure_traits" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "hashmap_core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "diff" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "docopt" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "dtoa" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "either" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "ena" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "encode_unicode" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "env_logger" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "env_logger" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "errno" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "extprim" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fixedbitset" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "fnv" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "futures" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "futures" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-stable 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-channel" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-core" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-executor" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-io" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-sink" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-stable" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "pin-api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-util" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "gcc" -version = "0.3.54" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "getopts" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "handlebars" -version = "0.28.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "hashmap_core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "humantime" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "immut_list" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "data_structure_traits 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "interval-heap" -version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "compare 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "iovec" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ipc-channel" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "uuid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itertools" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itertools" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itertools" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itoa" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lalrpop" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-intern 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-snap 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-util 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "petgraph 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lalrpop-intern" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "lalrpop-snap" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-intern 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-util 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "petgraph 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lalrpop-util" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "lazy_static" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "lazy_static" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "lazycell" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.2.39" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "linked-hash-map" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "linked-hash-map" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "linked-list" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "log" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "matches" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "memchr" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memchr" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memchr" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memoffset" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "mio" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "miow" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "net2" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "nix" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "nodrop" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "nom" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-bigint" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-complex" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-integer" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-iter" -version = "0.1.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-rational" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-traits" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-traits" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "num_cpus" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ordermap" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "owning_ref" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "parking_lot" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "parking_lot_core" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pbr" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pest" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "petgraph" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fixedbitset 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pin-api" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "prctl" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "prettytable-rs" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "encode_unicode 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quick-error" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "quote" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.3.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rayon" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rayon-core" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "redox_syscall" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "redox_termios" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex" -version = "0.1.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex-syntax" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "regex-syntax" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "regex-syntax" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "remove_dir_all" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc_version" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustfmt" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", - "strings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustlex" -version = "0.3.3" -source = "git+https://github.com/ulysseB/rustlex.git#86116c3c8e95b064bd53bf2ce00b7456f0f83dec" -dependencies = [ - "rustlex_codegen 0.3.3 (git+https://github.com/ulysseB/rustlex.git)", -] - -[[package]] -name = "rustlex_codegen" -version = "0.3.3" -source = "git+https://github.com/ulysseB/rustlex.git#86116c3c8e95b064bd53bf2ce00b7456f0f83dec" -dependencies = [ - "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rustlex_fsa 0.3.3 (git+https://github.com/ulysseB/rustlex.git)", -] - -[[package]] -name = "rustlex_fsa" -version = "0.3.3" -source = "git+https://github.com/ulysseB/rustlex.git#86116c3c8e95b064bd53bf2ce00b7456f0f83dec" -dependencies = [ - "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "scopeguard" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde-hjson" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_derive" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive_internals 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_derive_internals" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_json" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_test" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "slab" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "slab" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "smallvec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "stable_deref_trait" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "std-semaphore" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "strings" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "strsim" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "syn" -version = "0.12.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syntex_errors" -version = "0.59.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syntex_pos" -version = "0.59.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syntex_syntax" -version = "0.59.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "extprim 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "telamon" -version = "0.2.0" -dependencies = [ - "boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "config 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "data_structure_traits 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "errno 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "immut_list 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "interval-heap 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ipc-channel 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "linked-list 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "pbr 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "prctl 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "prettytable-rs 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "std-semaphore 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "telamon-gen 1.0.0", - "telamon-utils 1.0.0", - "tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.0 (git+https://github.com/ulysseB/tokio-timer.git)", -] - -[[package]] -name = "telamon-gen" -version = "1.0.0" -dependencies = [ - "env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "handlebars 0.28.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-util 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rustfmt 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustlex 0.3.3 (git+https://github.com/ulysseB/rustlex.git)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", - "telamon-utils 1.0.0", - "topological-sort 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "telamon-gen-test" -version = "0.1.0" -dependencies = [ - "env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "telamon-gen 1.0.0", - "telamon-utils 1.0.0", -] - -[[package]] -name = "telamon-kernels" -version = "0.1.0" -dependencies = [ - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "telamon 0.2.0", - "telamon-utils 1.0.0", -] - -[[package]] -name = "telamon-utils" -version = "1.0.0" -dependencies = [ - "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "linked-list 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tempdir" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "term" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "termcolor" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "termion" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread-id" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread_local" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread_local" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "time" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-executor" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-io" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-reactor" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-threadpool" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-timer" -version = "0.2.0" -source = "git+https://github.com/ulysseB/tokio-timer.git#0dfa8c024eeb34bd8cfa84b4ecbd5baf9c108fab" -dependencies = [ - "futures 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "toml" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "topological-sort" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "ucd-util" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-segmentation" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-width" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "utf8-ranges" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "utf8-ranges" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "uuid" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wincolor" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "yaml-rust" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" -"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4" -"checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" -"checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2" -"checksum atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d0fd4c0631f06448cc45a6bbb3b710ebb7ff8ccb96a0800c994afe23a70d5df2" -"checksum atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "af80143d6f7608d746df1520709e5d141c96f240b0e62b0aa41bdfb53374d9d4" -"checksum bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bda13183df33055cbb84b847becce220d392df502ebe7a4a78d7021771ed94d0" -"checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c" -"checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f" -"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" -"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" -"checksum boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cbec60c560f322d8e3cd403f91d8908cfd965fff53ba97154bd1b9d90149d98e" -"checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23" -"checksum bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1b7db437d718977f6dc9b2e3fd6fc343c02ac6b899b73fdd2179163447bd9ce9" -"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" -"checksum compare 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ea0095f6103c2a8b44acd6fd15960c801dafebf02e21940360833e0673f48ba7" -"checksum config 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e595d1735d8ab6b04906bbdcfc671cce2a5e609b6f8e92865e67331cc2f41ba4" -"checksum crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24ce9782d4d5c53674646a6a4c1863a21a8fc0cb649b3c94dfc16e45071dea19" -"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" -"checksum crossbeam-deque 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c1bdc73742c36f7f35ebcda81dbb33a7e0d33757d03a06d9ddca762712ec5ea2" -"checksum crossbeam-epoch 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "59796cc6cbbdc6bb319161349db0c3250ec73ec7fcb763a51065ec4e2e158552" -"checksum crossbeam-epoch 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9b4e2817eb773f770dcb294127c011e22771899c21d18fce7dd739c0b9832e81" -"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" -"checksum crossbeam-utils 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d636a8b3bcc1b409d7ffd3facef8f21dcb4009626adbd0c5e6c4305c07253c7b" -"checksum csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7ef22b37c7a51c564a365892c012dc0271221fdcc64c69b19ba4d6fa8bd96d9c" -"checksum data_structure_traits 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "98292bd3b24a11b38d7572cfaa03dc8ee8b7f8e800545edeb2a855d779224f1c" -"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" -"checksum docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab32ea6e284d87987066f21a9e809a73c14720571ef34516f0890b3d355ccfd8" -"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" -"checksum either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "740178ddf48b1a9e878e6d6509a1442a2d42fd2928aae8e7a6f8a36fb01981b3" -"checksum ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe5a5078ac8c506d3e4430763b1ba9b609b1286913e7d08e581d1c2de9b7e5" -"checksum encode_unicode 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c088ec0ed2282dcd054f2c124c0327f953563e6c75fdc6ff5141779596289830" -"checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" -"checksum env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0561146661ae44c579e993456bc76d11ce1e0c7d745e57b2fa7146b6e49fa2ad" -"checksum errno 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b2c858c42ac0b88532f48fca88b0ed947cad4f1f64d904bcd6c9f138f7b95d70" -"checksum extprim 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb09b6eb24a48a5c57729e4a60980bf538b3662c3bcec04b6c7908d7a0f3d9b9" -"checksum fixedbitset 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "85cb8fec437468d86dc7c83ca7cfc933341d561873275f22dd5eedefa63a6478" -"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" -"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0bab5b5e94f5c31fc764ba5dd9ad16568aae5d4825538c01d6bca680c9bf94a7" -"checksum futures 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "45af3b9fb6f97c12f7a3af62e4c31df558931ae781834ead417abe04dcb9ec9f" -"checksum futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "e3feaa3c573e6998c2d41dfb940482b76c1ef9b9150f6446cf5f12060b9a2ab8" -"checksum futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "90a83c1b1c895acbb7165f0057f6772523ca6df210730f74955c27449b5411cc" -"checksum futures-executor 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "936d1c79555e1cbd2dbc4b139420adb3a1ed64764779d8131d84045db26ddb92" -"checksum futures-io 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "05423a90af7b3fa6ca88034f0806553a59235b1a1098e32c4ffcbecf83f33045" -"checksum futures-sink 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "c99954270203f2c4c38cb8c0819648e8600eb5dbebd03f6ec35268f16bd98018" -"checksum futures-stable 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "d736f069fc69cb99ce13daebfa0bde4ade0a3b9703cd8b7c8ec38a8577bb45f0" -"checksum futures-util 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "674f3ba0fbc1e544de9776fb9d1c5c1cd72c5e17f1523e409a1c5642b57a734e" -"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb" -"checksum getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05" -"checksum handlebars 0.28.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1bed53dfb11098ec893ed54aa8b9828ffb98d28acbe56a49419935e5a8688ca9" -"checksum hashmap_core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "75919d1685421dc9ea9491c285bc0c0cf5525d166eec8a0f6d5462486d82ca89" -"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" -"checksum immut_list 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3629c418e9452f58ac93153b0409cba3f4f37594948db50e46b35f447ffaf035" -"checksum interval-heap 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "11274e5e8e89b8607cfedc2910b6626e998779b48a019151c7604d0adcb86ac6" -"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" -"checksum ipc-channel 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db9daf099728ac5390c73f54e6e3708f0c514d2b51f24373830f568702eadfca" -"checksum itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4833d6978da405305126af4ac88569b5d71ff758581ce5a987dbfa3755f694fc" -"checksum itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d3f2be4da1690a039e9ae5fd575f706a63ad5a2120f161b1d653c9da3930dd21" -"checksum itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450" -"checksum itoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92a9df60778f789c37f76778ae8d0a2471c41baa8b059d98a5873c978f549587" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lalrpop 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fe7e84d1b798674f26dd7f2e7c0c92b5736f77866dadcf59c64b949ff40d00" -"checksum lalrpop-intern 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8af84a2fa97bb57e285c56b8303645cefa17c92ad115c4d711b3b4ba5bc5c197" -"checksum lalrpop-snap 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "395696fe1022abe294978648249b5edd854395a199b0e9e5579c7fab47b807d0" -"checksum lalrpop-util 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9d51721b6a49a70a02c02862e27c57069878fa6bf6689c20b755a45efc8c67" -"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" -"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d" -"checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef" -"checksum libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "f54263ad99207254cf58b5f701ecb432c717445ea2ee8af387334bdd1a03fdff" -"checksum linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd" -"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e" -"checksum linked-list 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a4dacf969043dc69f1f731b5042eb05e030d264bcf34f2242889fcbdc7a65f06" -"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2" -"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" -"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" -"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d" -"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" -"checksum mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "6d771e3ef92d58a8da8df7d6976bfca9371ed1de6619d9d5a5ce5b1f29b85bfe" -"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -"checksum net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "9044faf1413a1057267be51b5afba8eb1090bd2231c693664aa1db716fe1eae0" -"checksum nix 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b7fd5681d13fda646462cfbd4e5f2051279a89a544d50eb98c365b507246839f" -"checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" -"checksum nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b" -"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" -"checksum num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "81b483ea42927c463e191802e7334556b48e7875297564c0e9951bd3a0ae53e3" -"checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" -"checksum num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f8d26da319fb45674985c78f1d1caf99aa4941f785d384a2ae36d0740bc3e2fe" -"checksum num-iter 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "4b226df12c5a59b63569dd57fafb926d91b385dfce33d8074a412411b689d593" -"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" -"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" -"checksum num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dee092fcdf725aee04dd7da1d21debff559237d49ef1cb3e69bcb8ece44c7364" -"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" -"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" -"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" -"checksum parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd9d732f2de194336fb02fe11f9eed13d9e76f13f4315b4d88a14ca411750cd" -"checksum parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "538ef00b7317875071d5e00f603f24d16f0b474c1a5fc0ccb8b454ca72eafa79" -"checksum pbr 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e048e3afebb6c454bb1c5d0fe73fda54698b4715d78ed8e7302447c37736d23a" -"checksum pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0a6dda33d67c26f0aac90d324ab2eb7239c819fc7b2552fe9faa4fe88441edc8" -"checksum petgraph 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "7a7e5234c228fbfa874c86a77f685886127f82e0aef602ad1d48333fcac6ad61" -"checksum pin-api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4806efe6dbda279bde1fe6e07de93e0a022487f290b5dee3e465793e1c34f7ad" -"checksum prctl 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "059a34f111a9dee2ce1ac2826a68b24601c4298cfeb1a587c3cb493d5ab46f52" -"checksum prettytable-rs 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "34dc1f4f6dddab3bf008ecfd4fd2a631b585fbf0af123f34c1324f51a034ff5f" -"checksum proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0" -"checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4" -"checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408" -"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" -"checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" -"checksum rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80e811e76f1dbf68abf87a759083d34600017fc4e10b6bd5ad84a700f9dba4b1" -"checksum rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d24ad214285a7729b174ed6d3bcfcb80177807f959d95fafd5bfc5c4f201ac8" -"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" -"checksum regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "aec3f58d903a7d2a9dc2bf0e41a746f4530e0cab6b615494e058f67a3ef947fb" -"checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" -"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e" -"checksum regex-syntax 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b2550876c31dc914696a6c2e01cbce8afba79a93c8ae979d2fe051c0230b3756" -"checksum remove_dir_all 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5d2f806b0fcdabd98acd380dc8daef485e22bcb7cddc811d1337967f2528cf5" -"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -"checksum rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a54aa04a10c68c1c4eacb4337fd883b435997ede17a9385784b990777686b09a" -"checksum rustfmt 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec940eed814db0fb7ab928c5f5025f97dc55d1c0e345e39dda2ce9f945557500" -"checksum rustlex 0.3.3 (git+https://github.com/ulysseB/rustlex.git)" = "" -"checksum rustlex_codegen 0.3.3 (git+https://github.com/ulysseB/rustlex.git)" = "" -"checksum rustlex_fsa 0.3.3 (git+https://github.com/ulysseB/rustlex.git)" = "" -"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" -"checksum serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe95aa0d46f04ce5c3a88bdcd4114ecd6144ed0b2725ebca2f1127744357807" -"checksum serde-hjson 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a2376ebb8976138927f48b49588ef73cde2f6591b8b3df22f4063e0f27b9bec" -"checksum serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "23b163a6ce7e1aa897919f9d8e40bd1f8a6f95342ed57727ae31387a01a7a356" -"checksum serde_derive_internals 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "370aa477297975243dc914d0b0e1234927520ec311de507a560fbd1c80f7ab8c" -"checksum serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "28556329a1d04efa036376c9588a0ed8655e202676d918733ca8a14740ee31be" -"checksum serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5" -"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23" -"checksum slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdeff4cd9ecff59ec7e3744cbca73dfe5ac35c2aedb2cfba8a1c715a18912e9d" -"checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9" -"checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b" -"checksum std-semaphore 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "33ae9eec00137a8eed469fb4148acd9fc6ac8c3f9b110f52cd34698c8b5bfa0e" -"checksum strings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa481ee1bc42fc3df8195f91f7cb43cf8f2b71b48bac40bf5381cfaf7e481f3c" -"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" -"checksum syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)" = "8c5bc2d6ff27891209efa5f63e9de78648d7801f085e4653701a692ce938d6fd" -"checksum syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3133289179676c9f5c5b2845bf5a2e127769f4889fcbada43035ef6bd662605e" -"checksum syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "30ab669fa003d208c681f874bbc76d91cc3d32550d16b5d9d2087cf477316470" -"checksum syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03815b9f04d95828770d9c974aa39c6e1f6ef3114eb77a3ce09008a0d15dd142" -"checksum tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f73eebdb68c14bcb24aef74ea96079830e7fa7b31a6106e42ea7ee887c1e134e" -"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" -"checksum termcolor 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "56c456352e44f9f91f774ddeeed27c1ec60a2455ed66d692059acfb1d731bda1" -"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" -"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" -"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" -"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963" -"checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098" -"checksum tokio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "490c5ff233997a62649c0a7b523b25a1cc6fab1389b3faed0d72e8bdcef7b0ad" -"checksum tokio-executor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46108c2aca0eb4b9a883bf37a28d122ca70f5318446f59f729cd1ff78a0bb5fb" -"checksum tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6af9eb326f64b2d6b68438e1953341e00ab3cf54de7e35d92bfc73af8555313a" -"checksum tokio-reactor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f21d00eb356854d502b81776cec931d12771e4ed6d198478d23ffd38c19279af" -"checksum tokio-threadpool 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "19a8656c45ae7893c9090ac5c98749e7ff904932973fabd541463f82628efacb" -"checksum tokio-timer 0.2.0 (git+https://github.com/ulysseB/tokio-timer.git)" = "" -"checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e" -"checksum topological-sort 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa7c7f42dea4b1b99439786f5633aeb9c14c1b53f75e282803c2ec2ad545873c" -"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" -"checksum unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8083c594e02b8ae1654ae26f0ade5158b119bd88ad0e8227a5d8fcd72407946" -"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" -"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" -"checksum uuid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "990fb49481275abe3c8e2a91339c009cd6146d9f38fc3413e4163d892cbaffbb" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767" -"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -"checksum yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57ab38ee1a4a266ed033496cf9af1828d8d6e6c1cfa5f643a2809effcae4d628" diff --git a/telamon-gen/Cargo.toml b/telamon-gen/Cargo.toml index d65213841..47ef54f98 100644 --- a/telamon-gen/Cargo.toml +++ b/telamon-gen/Cargo.toml @@ -10,6 +10,8 @@ name = "cli_gen" [build-dependencies] lalrpop = "0.14.0" +cc = "1.0" +libc = "0.2" [dependencies] env_logger = "0.5.5" @@ -20,11 +22,11 @@ lazy_static = "1.0.0" log = "0.4.1" regex = "0.2.9" rustfmt = "0.10.0" -rustlex = { git = "https://github.com/ulysseB/rustlex.git" } serde = "1.0.32" serde_derive = "1.0.32" serde_json = "1.0.11" topological-sort = "0.1.0" +libc = "0.2" [dependencies.telamon-utils] path = "../telamon-utils" diff --git a/telamon-gen/build.rs b/telamon-gen/build.rs index cc3af9915..ad96b096d 100644 --- a/telamon-gen/build.rs +++ b/telamon-gen/build.rs @@ -1,9 +1,23 @@ +extern crate cc; extern crate lalrpop; +use std::process::Command; + /// Adds a dependency to the build script. fn add_dependency(dep: &str) { println!("cargo:rerun-if-changed={}", dep); } fn main() { + // Compile the lexer. + Command::new("flex") + .arg("-oexh.c") + .arg("src/exh.l") + .status() + .expect("failed to execute Flex's process"); + + cc::Build::new() + .file("exh.c") + .compile("exh.a"); + // Compile the parser. add_dependency("src/parser.lalrpop"); lalrpop::Configuration::new().use_cargo_dir_conventions().process().unwrap(); diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l new file mode 100644 index 000000000..b47a740aa --- /dev/null +++ b/telamon-gen/src/exh.l @@ -0,0 +1,19 @@ +%option reentrant +%option noyywrap + +%{ + int lines = 0; + + enum token { + COMMENT, + OTHER, + }; +%} + +/* 6 Patterns § http://westes.github.io/flex/manual/Patterns.html#Patterns */ +%% +^["/"{2}|"/"{3}].+ { ++lines; return COMMENT; } +[a-zA-Z][a-zA-Z0-9]* { ++lines; return OTHER; } + +<> return EOF; +%% diff --git a/telamon-gen/src/lexer.rs b/telamon-gen/src/lexer.rs deleted file mode 100644 index 61a0401b2..000000000 --- a/telamon-gen/src/lexer.rs +++ /dev/null @@ -1,189 +0,0 @@ -/// Tokens from the textual representation of constraints. -use ir; -use std; - -#[derive(Debug)] -pub enum Token { - ValueIdent(String), ChoiceIdent(String), Var(String), Doc(String), CmpOp(ir::CmpOp), - InvalidToken(String), Code(String), CounterKind(ir::CounterKind), Bool(bool), - CounterVisibility(ir::CounterVisibility), - And, Trigger, When, Alias, Counter, Define, Enum, Equal, Forall, In, Is, Not, Require, - Requires, Value, End, Symmetric, AntiSymmetric, Arrow, Colon, Comma, LParen, RParen, - BitOr, Or, SetDefKey(ir::SetDefKey), Set, SubsetOf, SetIdent(String), Base, Disjoint, - Quotient, Of, Divide, -} - -rustlex! Lexer { - property comment: String = String::new(); - - let NUM = ['0'-'9']; - let ALPHA = ['a'-'z''A'-'Z''_']; - let ALPHA_NUM = ALPHA | NUM; - - let WHITESPACE = [' ''\t''\r''\n']+; - let COMMENT = "//"[^'/''\n'][^'\n']* | "//"; - let BLANK = WHITESPACE | COMMENT; - let C_COMMENT_BEG = "/*"; - let C_COMMENT_END = "*/"; - - let ALIAS = "alias"; - let COUNTER = "counter"; - let DEFINE = "define"; - let ENUM = "enum"; - let FORALL = "forall"; - let IN = "in"; - let IS = "is"; - let NOT = "not"; - let PRODUCT = "mul"; - let REQUIRE = "require"; - let REQUIRES = "requires"; - let SUM = "sum"; - let VALUE = "value"; - let END = "end"; - let SYMMETRIC = "symmetric"; - let ANTISYMMETRIC = "antisymmetric"; - let ARROW = "->"; - let WHEN = "when"; - let TRIGGER = "trigger"; - let HALF = "half"; - let HIDDEN = "internal"; - let BASE = "base"; - - let SET = "set"; - let SUBSETOF = "subsetof"; - let ITEM_TYPE = "item_type"; - let ID_TYPE = "id_type"; - let ITEM_GETTER = "item_getter"; - let ID_GETTER = "id_getter"; - let ITER = "iterator"; - let FROM_SUPERSET = "from_superset"; - let ADD_TO_SET = "add_to_set"; - let PREFIX = "var_prefix"; - let NEW_OBJS = "new_objs"; - let DISJOINT = "disjoint"; - let REVERSE = "reverse"; - let QUOTIENT = "quotient"; - let OF = "of"; - let TRUE = "true"; - let FALSE = "false"; - - let COLON = ":"; - let COMMA = ","; - let LPAREN = "("; - let RPAREN = ")"; - let BIT_OR = "|"; - let OR = "||"; - let AND = "&&"; - let GT = ">"; - let LT = "<"; - let GE = ">="; - let LE = "<="; - let EQUALS = "=="; - let NOT_EQUALS = "!="; - let EQUAL = "="; - let DIVIDE = "/"; - - let CHOICE_IDENT = ['a'-'z']['a'-'z''_''0'-'9']*; - let VALUE_IDENT = ['A'-'Z']['A'-'Z''_''0'-'9']*; - let SET_IDENT = ['A'-'Z']['A'-'Z''a'-'z''_''0'-'9']*; - let VAR = '$' ALPHA_NUM+; - let CODE = '\"'[^'\n''\"']*'\"'; - let DOC = "///"; - - INITIAL { - . => |lex: &mut Lexer| Some(Token::InvalidToken(lex.yystr())), - BLANK => |_: &mut Lexer| None, - C_COMMENT_BEG => |lex: &mut Lexer| { lex.COMMENT_MODE(); None }, - CHOICE_IDENT => |lex: &mut Lexer| Some(Token::ChoiceIdent(lex.yystr())), - SET_IDENT => |lex: &mut Lexer| Some(Token::SetIdent(lex.yystr())), - VALUE_IDENT => |lex: &mut Lexer| Some(Token::ValueIdent(lex.yystr())), - VAR => |lex: &mut Lexer| Some(Token::Var(lex.yystr()[1..].to_string())), - CODE => |lex: &mut Lexer | { - let mut code = lex.yystr()[1..].to_string(); - code.pop(); - Some(Token::Code(code)) - }, - ALIAS => |_: &mut Lexer| Some(Token::Alias), - COUNTER => |_: &mut Lexer| Some(Token::Counter), - DEFINE => |_: &mut Lexer| Some(Token::Define), - ENUM => |_: &mut Lexer| Some(Token::Enum), - FORALL => |_: &mut Lexer| Some(Token::Forall), - IN => |_: &mut Lexer| Some(Token::In), - IS => |_: &mut Lexer| Some(Token::Is), - NOT => |_: &mut Lexer| Some(Token::Not), - PRODUCT => |_: &mut Lexer| Some(Token::CounterKind(ir::CounterKind::Mul)), - REQUIRE => |_: &mut Lexer| Some(Token::Require), - REQUIRES => |_: &mut Lexer| Some(Token::Requires), - SUM => |_: &mut Lexer| Some(Token::CounterKind(ir::CounterKind::Add)), - VALUE => |_: &mut Lexer| Some(Token::Value), - WHEN => |_: &mut Lexer| Some(Token::When), - TRIGGER => |_: &mut Lexer| Some(Token::Trigger), - HALF => |_: &mut Lexer| - Some(Token::CounterVisibility(ir::CounterVisibility::NoMax)), - HIDDEN => |_: &mut Lexer| - Some(Token::CounterVisibility(ir::CounterVisibility::HiddenMax)), - BASE => |_: &mut Lexer| Some(Token::Base), - - ITEM_TYPE => |_: &mut Lexer| Some(Token::SetDefKey(ir::SetDefKey::ItemType)), - NEW_OBJS => |_: &mut Lexer| Some(Token::SetDefKey(ir::SetDefKey::NewObjs)), - ID_TYPE => |_: &mut Lexer| Some(Token::SetDefKey(ir::SetDefKey::IdType)), - ITEM_GETTER => |_: &mut Lexer| Some(Token::SetDefKey(ir::SetDefKey::ItemGetter)), - ID_GETTER => |_: &mut Lexer| Some(Token::SetDefKey(ir::SetDefKey::IdGetter)), - ITER => |_: &mut Lexer| Some(Token::SetDefKey(ir::SetDefKey::Iter)), - PREFIX => |_: &mut Lexer| Some(Token::SetDefKey(ir::SetDefKey::Prefix)), - REVERSE => |_: &mut Lexer| Some(Token::SetDefKey(ir::SetDefKey::Reverse)), - ADD_TO_SET => |_: &mut Lexer| Some(Token::SetDefKey(ir::SetDefKey::AddToSet)), - FROM_SUPERSET => |_: &mut Lexer| - Some(Token::SetDefKey(ir::SetDefKey::FromSuperset)), - SET => |_: &mut Lexer| Some(Token::Set), - SUBSETOF => |_: &mut Lexer| Some(Token::SubsetOf), - DISJOINT => |_: &mut Lexer| Some(Token::Disjoint), - QUOTIENT => |_: &mut Lexer| Some(Token::Quotient), - OF => |_: &mut Lexer| Some(Token::Of), - TRUE => |_: &mut Lexer| Some(Token::Bool(true)), - FALSE => |_: &mut Lexer| Some(Token::Bool(false)), - - - COLON => |_: &mut Lexer| Some(Token::Colon), - COMMA => |_: &mut Lexer| Some(Token::Comma), - LPAREN => |_: &mut Lexer| Some(Token::LParen), - RPAREN => |_: &mut Lexer| Some(Token::RParen), - BIT_OR => |_: &mut Lexer| Some(Token::BitOr), - OR => |_: &mut Lexer| Some(Token::Or), - AND => |_: &mut Lexer| Some(Token::And), - GT => |_: &mut Lexer| Some(Token::CmpOp(ir::CmpOp::Gt)), - LT => |_: &mut Lexer| Some(Token::CmpOp(ir::CmpOp::Lt)), - GE => |_: &mut Lexer| Some(Token::CmpOp(ir::CmpOp::Geq)), - LE => |_: &mut Lexer| Some(Token::CmpOp(ir::CmpOp::Leq)), - EQUALS => |_: &mut Lexer| Some(Token::CmpOp(ir::CmpOp::Eq)), - NOT_EQUALS => |_: &mut Lexer| Some(Token::CmpOp(ir::CmpOp::Neq)), - EQUAL => |_: &mut Lexer| Some(Token::Equal), - DOC => |lex: &mut Lexer| { lex.DOC_MODE(); None }, - END => |_: &mut Lexer| Some(Token::End), - SYMMETRIC => |_: &mut Lexer| Some(Token::Symmetric), - ANTISYMMETRIC => |_: &mut Lexer| Some(Token::AntiSymmetric), - ARROW => |_: &mut Lexer| Some(Token::Arrow), - DIVIDE => |_: &mut Lexer| Some(Token::Divide), - } - - DOC_MODE { - . => |lex: &mut Lexer| { - let s = lex.yystr(); - lex.comment.push_str(&s); - None - }, - WHITESPACE* '\n' => |lex: &mut Lexer| { - lex.INITIAL(); - Some(Token::Doc(std::mem::replace(&mut lex.comment, String::new()))) - }, - WHITESPACE* '\n' WHITESPACE* DOC => |_: &mut Lexer| None, - } - - COMMENT_MODE { - . => |_: &mut Lexer| None, - C_COMMENT_END => |lex: &mut Lexer| { - lex.INITIAL(); - None - } - } -} diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs new file mode 100644 index 000000000..9fdb0e243 --- /dev/null +++ b/telamon-gen/src/lexer/ffi.rs @@ -0,0 +1,16 @@ +use ::libc; + +/// https://westes.github.io/flex/manual/About-yyscan_005ft.html +pub type YyScan = *const libc::c_void; +pub type YyBufferState = *const libc::c_void; + +extern { + pub static lines: libc::c_int; + + pub fn yylex_init(scanner: *const YyScan) -> libc::c_int; + pub fn yy_scan_string(yy_str: *const libc::c_char, yyscanner: YyScan) -> YyBufferState; + pub fn yylex(yyscanner: YyScan) -> libc::c_int; + pub fn yyget_text(yyscanner: YyScan) -> *const libc::c_char; + pub fn yy_delete_buffer(b: YyBufferState, yyscanner: YyScan); + pub fn yylex_destroy(yyscanner: YyScan) -> libc::c_int; +} diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs new file mode 100644 index 000000000..5aed48b56 --- /dev/null +++ b/telamon-gen/src/lexer/mod.rs @@ -0,0 +1,49 @@ +/// Tokens from the textual representation of constraints. + +mod ffi; +mod token; + +use std::{io,ptr}; + +use ::libc; +pub use self::token::Token; + +pub struct Lexer { + scanner: ffi::YyScan, + buffer: ffi::YyBufferState, +} + +impl Lexer { + pub fn new(input: &mut io::Read) -> Self { + let mut buffer = Vec::new(); + + input.read_to_end(&mut buffer); + unsafe { + let scanner: ffi::YyScan = ptr::null(); + + ffi::yylex_init(&scanner); // https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html#index-yylex_005finit + Lexer { + scanner: scanner, + buffer: ffi::yy_scan_string(buffer.as_ptr() as *const _, scanner), // https://westes.github.io/flex/manual/Multiple-Input-Buffers.html + } + } + } +} + +impl Drop for Lexer { + fn drop(&mut self) { + unsafe { + libc::write(1, b"\n".as_ptr() as *const _, 1); + ffi::yy_delete_buffer(self.buffer, self.scanner); // https://westes.github.io/flex/manual/Multiple-Input-Buffers.html + ffi::yylex_destroy(self.scanner); // https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html#index-yylex_005finit + } + } +} + +impl Iterator for Lexer { + type Item = Token; + + fn next(&mut self) -> Option { + None + } +} diff --git a/telamon-gen/src/lexer/token.rs b/telamon-gen/src/lexer/token.rs new file mode 100644 index 000000000..2599f83c2 --- /dev/null +++ b/telamon-gen/src/lexer/token.rs @@ -0,0 +1,12 @@ +use ir; + +#[derive(Debug)] +pub enum Token { + ValueIdent(String), ChoiceIdent(String), Var(String), Doc(String), CmpOp(ir::CmpOp), + InvalidToken(String), Code(String), CounterKind(ir::CounterKind), Bool(bool), + CounterVisibility(ir::CounterVisibility), + And, Trigger, When, Alias, Counter, Define, Enum, Equal, Forall, In, Is, Not, Require, + Requires, Value, End, Symmetric, AntiSymmetric, Arrow, Colon, Comma, LParen, RParen, + BitOr, Or, SetDefKey(ir::SetDefKey), Set, SubsetOf, SetIdent(String), Base, Disjoint, + Quotient, Of, Divide, +} diff --git a/telamon-gen/src/lib.rs b/telamon-gen/src/lib.rs index 52f080813..42d0c669b 100644 --- a/telamon-gen/src/lib.rs +++ b/telamon-gen/src/lib.rs @@ -1,10 +1,5 @@ #![feature(drain_filter)] -#![feature(plugin)] -#![plugin(rustlex)] -#![allow(plugin_as_library)] -extern crate rustlex; - #[cfg(test)] extern crate env_logger; extern crate handlebars; #[macro_use] extern crate lazy_static; @@ -18,6 +13,7 @@ extern crate serde_json; #[macro_use] extern crate telamon_utils as utils; extern crate topological_sort; +extern crate libc; mod ast; mod constraint; From 9bd95b7d1a1b7fb8167f3a2c858ba248982de200 Mon Sep 17 00:00:00 2001 From: adjivas Date: Tue, 17 Apr 2018 18:03:41 +0200 Subject: [PATCH 03/70] reconfigure travis as nightly --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8bd570998..d21522651 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,8 @@ rust: - nightly matrix: allow_failures: - - rust: nightly + - stable + - beta fast_finish: true addons: apt: @@ -17,9 +18,9 @@ before_script: - flex --version script: - cd telamon-gen - - cargo build --verbose --all - - cargo test --verbose --all - - cargo doc --verbose --all + - cargo build --verbose + - cargo test --verbose + - cargo doc --verbose deploy: - provider: pages local-dir: target/doc From 3bff133bbba5de7b0ce930b1913ccd892cbe6aaf Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 18 Apr 2018 17:21:26 +0200 Subject: [PATCH 04/70] naive first implementation of C part exh-lang's lexer --- telamon-gen/src/exh.l | 231 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 223 insertions(+), 8 deletions(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index b47a740aa..721248a77 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -2,18 +2,233 @@ %option noyywrap %{ - int lines = 0; + int lines = 0; - enum token { - COMMENT, - OTHER, - }; + union yylval { + int val; + float fval; + char sym; + } yylval; + + enum token { + VALUEIDENT, + CHOICEIDENT, + VAR, + DOC, + CMPOP, + INVALIDTOKEN, + CODE, + COUNTERKIND, + BOOL, + COUNTERVISIBILITY, + AND, + TRIGGER, + WHEN, + ALIAS, + COUNTER, + DEFINE, + ENUM, + EQUAL, + FORALL, + IN, + IS, + NOT, + REQUIRE, + REQUIRES, + VALUE, + END, + SYMMETRIC, + ANTISYMMETRIC, + ARROW, + COLON, + COMMA, + LPAREN, + RPAREN, + BITOR, + OR, + SETDEFKEY, + SET, + SUBSETOF, + SETIDENT, + BASE, + DISJOINT, + QUOTIENT, + OF, + DIVIDE, + }; + + enum counter_kind { + ADD, + MUL, + }; + + enum counter_visibility { + NOMAX, + HIDDENMAX, + FULL, + }; + + enum cmp_op { + LT, + GT, + LEQ, + GEQ, + EQ, + NEQ, + }; + + enum set_def_key { + ITEMTYPE, + IDTYPE, + ITEMGETTER, + IDGETTER, + ITER, + FROMSUPERSET, + PREFIX, + NEWOBJS, + REVERSE, + ADDTOSET, + }; %} +num ['0'-'9'] +alpha ['a'-'z''A'-'Z''_'] +alpha_num alpha | num + +whitespace [' ''\t''\r''\n']+ +comment "//"[^'/''\n'][^'\n']* | "//" +blank whitespace | comment +c_comment_beg "/*" +c_comment_end "*/" + +alias "alias" +counter "counter" +define "define" +enum "enum" +forall "forall" +in "in" +is "is" +not "not" +product "mul" +require "require" +requires "requires" +sum "sum" +value "value" +end "end" +symmetric "symmetric" +antisymmetric "antisymmetric" +arrow "->" +when "when" +trigger "trigger" +half "half" +hidden "internal" +base "base" + +set "set" +subsetof "subsetof" +item_type "item_type" +id_type "id_type" +item_getter "item_getter" +id_getter "id_getter" +iter "iterator" +from_superset "from_superset" +add_to_set "add_to_set" +prefix "var_prefix" +new_objs "new_objs" +disjoint "disjoint" +reverse "reverse" +quotient "quotient" +of "of" +true "true" +false "false" + +colon ":" +comma "," +lparen "(" +rparen ")" +bit_or "|" +or "||" +and "&&" +gt ">" +lt "<" +ge ">=" +le "<=" +equals "==" +not_equals "!=" +equal "=" +divide "/" + +choice_ident ['a'-'z']['a'-'z''_''0'-'9']* +value_ident ['A'-'Z']['A'-'Z''_''0'-'9']* +set_ident ['A'-'Z']['A'-'Z''a'-'z''_''0'-'9']* +var '$' alpha_num+ +code '\"'[^'\n''\"']*'\"' +doc "///" + +/* https://github.com/a-haas/Compilation/blob/6fe46a65d64decdb648feba790bb7b1d2980ca0a/yacc/setparser.l */ + /* 6 Patterns § http://westes.github.io/flex/manual/Patterns.html#Patterns */ %% -^["/"{2}|"/"{3}].+ { ++lines; return COMMENT; } -[a-zA-Z][a-zA-Z0-9]* { ++lines; return OTHER; } -<> return EOF; +. {return INVALIDTOKEN;} +{choice_ident} {return CHOICEIDENT;} +{set_ident} {return SETIDENT;} +{value_ident} {return VALUEIDENT;} +{alias} {return ALIAS;} +{counter} {return COUNTER;} +{define} {return DEFINE;} +{enum} {return ENUM;} +{forall} {return FORALL;} +{in} {return IN;} +{is} {return IS;} +{not} {return NOT;} +{product} {yylval.val = MUL; return COUNTERKIND;} +{require} {return REQUIRE;} +{requires} {return REQUIRES;} +{sum} {yylval.val = ADD; return COUNTERKIND;} +{value} {return VALUE;} +{when} {return WHEN;} +{trigger} {return TRIGGER;} +{half} {yylval.val = NOMAX; return COUNTERVISIBILITY;} +{hidden} {yylval.val = HIDDENMAX; return COUNTERVISIBILITY;} +{base} {return BASE;} + +{item_type} {yylval.val = ITEMTYPE; return SETDEFKEY;} +{new_objs} {yylval.val = NEWOBJS; return SETDEFKEY;} +{id_type} {yylval.val = IDTYPE; return SETDEFKEY;} +{item_getter} {yylval.val = ITEMGETTER; return SETDEFKEY;} +{id_getter} {yylval.val = IDGETTER; return SETDEFKEY;} +{iter} {yylval.val = ITER; return SETDEFKEY;} +{prefix} {yylval.val = PREFIX; return SETDEFKEY;} +{reverse} {yylval.val = REVERSE; return SETDEFKEY;} +{add_to_set} {yylval.val = ADDTOSET; return SETDEFKEY;} +{from_superset} {yylval.val = FROMSUPERSET; return SETDEFKEY;} +{set} {return SET;} +{subsetof} {return SUBSETOF;} +{disjoint} {return DISJOINT;} +{quotient} {return QUOTIENT;} +{of} {return OF;} +{true} {yylval.val = 1; return BOOL;} +{false} {yylval.val = 0; return BOOL;} +{colon} {return COLON;} +{comma} {return COMMA;} +{lparen} {return LPAREN;} +{rparen} {return RPAREN;} +{bit_or} {return BITOR;} +{or} {return OR;} +{and} {return AND;} +{gt} {yylval.val = GT; return CMPOP;} +{lt} {yylval.val = LT; return CMPOP;} +{ge} {yylval.val = GEQ; return CMPOP;} +{le} {yylval.val = LEQ; return CMPOP;} +{equals} {yylval.val = EQ; return CMPOP;} +{not_equals} {yylval.val = NEQ; return CMPOP;} +{equal} {return EQUAL;} +{doc} {} +{end} {return END;} +{symmetric} {return SYMMETRIC;} +{antisymmetric} {return ANTISYMMETRIC;} +{arrow} {return ARROW;} +{divide} {return DIVIDE;} +<> {return EOF;} %% From b0c45940165cbc65f028f7f2c2867d02d03cdee1 Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 18 Apr 2018 17:32:51 +0200 Subject: [PATCH 05/70] C union representation --- telamon-gen/src/exh.l | 4 ---- telamon-gen/src/lexer/ffi.rs | 7 ++++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index 721248a77..f14bcf4f8 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -2,12 +2,8 @@ %option noyywrap %{ - int lines = 0; - union yylval { int val; - float fval; - char sym; } yylval; enum token { diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index 9fdb0e243..6acd430bd 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -4,8 +4,13 @@ use ::libc; pub type YyScan = *const libc::c_void; pub type YyBufferState = *const libc::c_void; +#[repr(C)] +pub union YyLval { + val: libc::c_int, +} + extern { - pub static lines: libc::c_int; + pub static yylval: YyLval; pub fn yylex_init(scanner: *const YyScan) -> libc::c_int; pub fn yy_scan_string(yy_str: *const libc::c_char, yyscanner: YyScan) -> YyBufferState; From 7c5c3fcd4d08ebf03a39140e70548680ee84f236 Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 18 Apr 2018 18:34:59 +0200 Subject: [PATCH 06/70] Enumeration CmpOp --- .travis.yml | 7 --- telamon-gen/src/lexer/ffi.rs | 65 ++++++++++++++++++++++++++- telamon-gen/src/lexer/mod.rs | 87 +++++++++++++++++++++++++++++++----- 3 files changed, 141 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index d21522651..91bc49405 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,14 +2,7 @@ language: rust cache: cargo sudo: false rust: - - stable - - beta - nightly -matrix: - allow_failures: - - stable - - beta - fast_finish: true addons: apt: packages: diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index 6acd430bd..b6cba4061 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -4,9 +4,72 @@ use ::libc; pub type YyScan = *const libc::c_void; pub type YyBufferState = *const libc::c_void; +#[derive(Copy, Clone)] #[repr(C)] pub union YyLval { val: libc::c_int, + pub cmp_op: CmpOp, +} + +#[derive(Copy, Clone, Debug)] +#[repr(C)] +pub enum YyToken { + ValueIdent, + ChoiceIdent, + Var, + Doc, + CmpOp, + InvalidToken, + Code, + CounterKind, + Bool, + CounterVisibility, + And, + Trigger, + When, + Alias, + Counter, + Define, + Enum, + Equal, + Forall, + In, + Is, + Not, + Require, + Requires, + Value, + End, + Symmetric, + AntiSymmetric, + Arrow, + Colon, + Comma, + LParen, + RParen, + BitOr, + Or, + SetDefkey, + Set, + SubsetOf, + SetIdent, + Base, + Disjoint, + Quotient, + Of, + Divide, + EOF = libc::EOF as _, +} + +#[derive(Copy, Clone, Debug)] +#[repr(C)] +pub enum CmpOp { + Lt, + Gt, + Leq, + Geq, + Eq, + Neq, } extern { @@ -14,7 +77,7 @@ extern { pub fn yylex_init(scanner: *const YyScan) -> libc::c_int; pub fn yy_scan_string(yy_str: *const libc::c_char, yyscanner: YyScan) -> YyBufferState; - pub fn yylex(yyscanner: YyScan) -> libc::c_int; + pub fn yylex(yyscanner: YyScan) -> YyToken; pub fn yyget_text(yyscanner: YyScan) -> *const libc::c_char; pub fn yy_delete_buffer(b: YyBufferState, yyscanner: YyScan); pub fn yylex_destroy(yyscanner: YyScan) -> libc::c_int; diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index 5aed48b56..0178c5cc6 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -3,14 +3,28 @@ mod ffi; mod token; +use ir; use std::{io,ptr}; -use ::libc; pub use self::token::Token; +use self::ffi::{ + YyScan, + YyBufferState, + yylex_init, + yy_scan_string, + yy_delete_buffer, + yylex_destroy, + yylex, + YyToken, + yylval, + + CmpOp +}; + pub struct Lexer { - scanner: ffi::YyScan, - buffer: ffi::YyBufferState, + scanner: YyScan, + buffer: YyBufferState, } impl Lexer { @@ -19,12 +33,12 @@ impl Lexer { input.read_to_end(&mut buffer); unsafe { - let scanner: ffi::YyScan = ptr::null(); + let scanner: YyScan = ptr::null(); - ffi::yylex_init(&scanner); // https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html#index-yylex_005finit + yylex_init(&scanner); // https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html#index-yylex_005finit Lexer { scanner: scanner, - buffer: ffi::yy_scan_string(buffer.as_ptr() as *const _, scanner), // https://westes.github.io/flex/manual/Multiple-Input-Buffers.html + buffer: yy_scan_string(buffer.as_ptr() as *const _, scanner), // https://westes.github.io/flex/manual/Multiple-Input-Buffers.html } } } @@ -33,9 +47,8 @@ impl Lexer { impl Drop for Lexer { fn drop(&mut self) { unsafe { - libc::write(1, b"\n".as_ptr() as *const _, 1); - ffi::yy_delete_buffer(self.buffer, self.scanner); // https://westes.github.io/flex/manual/Multiple-Input-Buffers.html - ffi::yylex_destroy(self.scanner); // https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html#index-yylex_005finit + yy_delete_buffer(self.buffer, self.scanner); // https://westes.github.io/flex/manual/Multiple-Input-Buffers.html + yylex_destroy(self.scanner); // https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html#index-yylex_005finit } } } @@ -44,6 +57,60 @@ impl Iterator for Lexer { type Item = Token; fn next(&mut self) -> Option { - None + unsafe { + match yylex(self.scanner) { + YyToken::EOF => None, + YyToken::Alias => Some(Token::Alias), + YyToken::Counter => Some(Token::Counter), + YyToken::Define => Some(Token::Define), + YyToken::Enum => Some(Token::Enum), + YyToken::Forall => Some(Token::Forall), + YyToken::In => Some(Token::In), + YyToken::Is => Some(Token::Is), + YyToken::Not => Some(Token::Not), +// YyToken::Product => Some(Token::Product), +// YyToken::Require => Some(Token::RequireKind), + YyToken::Requires => Some(Token::Requires), +// YyToken::Sum => Some(Token::RequireKind), + YyToken::Value => Some(Token::Value), + YyToken::When => Some(Token::When), + YyToken::Trigger => Some(Token::Trigger), +// YyToken::Half => Some(Token::CounterVisibility), +// YyToken::HIDDEN => Some(Token::CounterVisibility), + YyToken::Base => Some(Token::Base), + YyToken::Set => Some(Token::Set), + YyToken::SubsetOf => Some(Token::SubsetOf), + YyToken::Disjoint => Some(Token::Disjoint), + YyToken::Quotient => Some(Token::Quotient), + YyToken::Of => Some(Token::Of), + + YyToken::Colon => Some(Token::Colon), + YyToken::Comma => Some(Token::Comma), + YyToken::LParen => Some(Token::LParen), + YyToken::RParen => Some(Token::RParen), + YyToken::BitOr => Some(Token::BitOr), + YyToken::Or => Some(Token::Or), + YyToken::And => Some(Token::And), + YyToken::CmpOp => { + match yylval.cmp_op { + CmpOp::Gt => Some(Token::CmpOp(ir::CmpOp::Gt)), + CmpOp::Lt => Some(Token::CmpOp(ir::CmpOp::Lt)), + CmpOp::Geq => Some(Token::CmpOp(ir::CmpOp::Geq)), + CmpOp::Leq => Some(Token::CmpOp(ir::CmpOp::Leq)), + _ => None, + } + }, +// YyToken::Equals => Some(Token::CmpOp(ir::CmpOp::Eq)), +// YyToken::NotEquals => Some(Token::CmpOp(ir::CmpOp::Neq)), + YyToken::Equal => Some(Token::Equal), +// YyToken::Doc => Some(Token::Doc), + YyToken::End => Some(Token::End), + YyToken::Symmetric => Some(Token::Symmetric), + YyToken::AntiSymmetric => Some(Token::AntiSymmetric), + YyToken::Arrow => Some(Token::Arrow), + YyToken::Divide => Some(Token::Divide), + _ => unimplemented!(), + } + } } } From 0f24f57475848c00bd59152d0b70aa12b5d7c03d Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 19 Apr 2018 18:49:13 +0200 Subject: [PATCH 07/70] add yystr rules and incomplet test --- telamon-gen/src/exh.l | 6 +++ telamon-gen/src/ir/choice.rs | 1 + telamon-gen/src/ir/filter.rs | 1 + telamon-gen/src/ir/mod.rs | 1 + telamon-gen/src/ir/set.rs | 3 +- telamon-gen/src/lexer/ffi.rs | 23 ++++----- telamon-gen/src/lexer/mod.rs | 92 ++++++++++++++++++++++++++---------- telamon-gen/src/lib.rs | 2 +- telamon-gen/tests/lexer.rs | 14 ++++++ 9 files changed, 103 insertions(+), 40 deletions(-) create mode 100644 telamon-gen/tests/lexer.rs diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index f14bcf4f8..648923329 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -53,14 +53,20 @@ DIVIDE, }; + // Indicates whether a counter sums or adds. enum counter_kind { ADD, MUL, }; + // Indicates how a counter exposes how its maximum value. + // The variants are ordered by increasing amount of information available. enum counter_visibility { + // Only the minimal value is computed and stored. NOMAX, + // Both the min and max are stored, but only the min is exposed. HIDDENMAX, + // Both the min and the max value are exposed. FULL, }; diff --git a/telamon-gen/src/ir/choice.rs b/telamon-gen/src/ir/choice.rs index cc8d5f9c3..f1e6eb152 100644 --- a/telamon-gen/src/ir/choice.rs +++ b/telamon-gen/src/ir/choice.rs @@ -189,6 +189,7 @@ pub enum ChoiceDef { /// Indicates how a counter exposes how its maximum value. The variants are ordered by /// increasing amount of information available. #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize)] +#[repr(C)] pub enum CounterVisibility { /// Only the minimal value is computed and stored. NoMax, diff --git a/telamon-gen/src/ir/filter.rs b/telamon-gen/src/ir/filter.rs index a1e8480e7..39f91b6a5 100644 --- a/telamon-gen/src/ir/filter.rs +++ b/telamon-gen/src/ir/filter.rs @@ -380,6 +380,7 @@ impl Adaptable for Condition { /// A compariason operator. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[repr(C)] pub enum CmpOp { Lt, Gt, Leq, Geq, Eq, Neq } impl CmpOp { diff --git a/telamon-gen/src/ir/mod.rs b/telamon-gen/src/ir/mod.rs index cf6552af6..dba471f93 100644 --- a/telamon-gen/src/ir/mod.rs +++ b/telamon-gen/src/ir/mod.rs @@ -247,6 +247,7 @@ impl Default for IrDesc { /// Indicates whether a counter sums or adds. #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)] +#[repr(C)] pub enum CounterKind { Add, Mul } impl CounterKind { diff --git a/telamon-gen/src/ir/set.rs b/telamon-gen/src/ir/set.rs index 0d9888971..6d1696cf6 100644 --- a/telamon-gen/src/ir/set.rs +++ b/telamon-gen/src/ir/set.rs @@ -307,7 +307,8 @@ enum ReverseSet { None, } -#[derive(Debug, Hash, PartialEq, Eq, Serialize)] +#[derive(Debug, Hash, PartialEq, Eq, Serialize, Copy, Clone)] +#[repr(C)] pub enum SetDefKey { ItemType, IdType, diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index b6cba4061..29ae8ff97 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -1,4 +1,5 @@ use ::libc; +use ::ir; /// https://westes.github.io/flex/manual/About-yyscan_005ft.html pub type YyScan = *const libc::c_void; @@ -7,13 +8,18 @@ pub type YyBufferState = *const libc::c_void; #[derive(Copy, Clone)] #[repr(C)] pub union YyLval { - val: libc::c_int, - pub cmp_op: CmpOp, + pub val: libc::c_int, + pub cmp_op: ir::CmpOp, + pub boolean: bool, + pub counter_kind: ir::CounterKind, + pub counter_visibility: ir::CounterVisibility, + pub set_def_key: ir::SetDefKey, } #[derive(Copy, Clone, Debug)] #[repr(C)] pub enum YyToken { + Blank, ValueIdent, ChoiceIdent, Var, @@ -61,24 +67,13 @@ pub enum YyToken { EOF = libc::EOF as _, } -#[derive(Copy, Clone, Debug)] -#[repr(C)] -pub enum CmpOp { - Lt, - Gt, - Leq, - Geq, - Eq, - Neq, -} - extern { pub static yylval: YyLval; pub fn yylex_init(scanner: *const YyScan) -> libc::c_int; pub fn yy_scan_string(yy_str: *const libc::c_char, yyscanner: YyScan) -> YyBufferState; pub fn yylex(yyscanner: YyScan) -> YyToken; - pub fn yyget_text(yyscanner: YyScan) -> *const libc::c_char; + pub fn yyget_text(yyscanner: YyScan) -> *mut libc::c_char; pub fn yy_delete_buffer(b: YyBufferState, yyscanner: YyScan); pub fn yylex_destroy(yyscanner: YyScan) -> libc::c_int; } diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index 0178c5cc6..6b5db2297 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -3,10 +3,13 @@ mod ffi; mod token; -use ir; use std::{io,ptr}; -pub use self::token::Token; +pub use self::token::Token; + +use libc; + +use std::ffi::CStr; use self::ffi::{ YyScan, @@ -18,8 +21,7 @@ use self::ffi::{ yylex, YyToken, yylval, - - CmpOp + yyget_text, }; pub struct Lexer { @@ -31,7 +33,13 @@ impl Lexer { pub fn new(input: &mut io::Read) -> Self { let mut buffer = Vec::new(); - input.read_to_end(&mut buffer); + input.read_to_end(&mut buffer).unwrap(); + Lexer::from(buffer) + } +} + +impl From> for Lexer { + fn from(buffer:Vec) -> Self { unsafe { let scanner: YyScan = ptr::null(); @@ -59,7 +67,51 @@ impl Iterator for Lexer { fn next(&mut self) -> Option { unsafe { match yylex(self.scanner) { - YyToken::EOF => None, + YyToken::InvalidToken => { + let out = ffi::yyget_text(self.scanner); + + CStr::from_ptr(out) + .to_str().ok() + .and_then(|s: &str| Some(Token::InvalidToken(s.to_owned()))) + }, + YyToken::Blank => None, + // C_CommentBeg + YyToken::ChoiceIdent => { + let out = ffi::yyget_text(self.scanner); + + CStr::from_ptr(out) + .to_str().ok() + .and_then(|s: &str| Some(Token::ChoiceIdent(s.to_owned()))) + }, + YyToken::SetIdent => { + let out = ffi::yyget_text(self.scanner); + + CStr::from_ptr(out) + .to_str().ok() + .and_then(|s: &str| Some(Token::SetIdent(s.to_owned()))) + }, + YyToken::ValueIdent => { + let out = ffi::yyget_text(self.scanner); + + CStr::from_ptr(out) + .to_str().ok() + .and_then(|s: &str| Some(Token::ValueIdent(s.to_owned()))) + }, + YyToken::Var => { + let out = ffi::yyget_text(self.scanner); + + CStr::from_ptr(out.offset(1)) + .to_str().ok() + .and_then(|s: &str| Some(Token::Var(s.to_owned()))) + }, + YyToken::Code => { + let out = ffi::yyget_text(self.scanner); + + *out.offset(libc::strlen(out) as _) = b'\0' as _; + CStr::from_ptr(out.offset(1)) + .to_str().ok() + .and_then(|s: &str| Some(Token::Code(s.to_owned()))) + }, YyToken::Alias => Some(Token::Alias), YyToken::Counter => Some(Token::Counter), YyToken::Define => Some(Token::Define), @@ -68,22 +120,21 @@ impl Iterator for Lexer { YyToken::In => Some(Token::In), YyToken::Is => Some(Token::Is), YyToken::Not => Some(Token::Not), -// YyToken::Product => Some(Token::Product), -// YyToken::Require => Some(Token::RequireKind), + YyToken::Require => Some(Token::Require), YyToken::Requires => Some(Token::Requires), -// YyToken::Sum => Some(Token::RequireKind), + YyToken::CounterKind => Some(Token::CounterKind(yylval.counter_kind)), YyToken::Value => Some(Token::Value), YyToken::When => Some(Token::When), YyToken::Trigger => Some(Token::Trigger), -// YyToken::Half => Some(Token::CounterVisibility), -// YyToken::HIDDEN => Some(Token::CounterVisibility), + YyToken::CounterVisibility => Some(Token::CounterVisibility(yylval.counter_visibility)), YyToken::Base => Some(Token::Base), + YyToken::SetDefkey => Some(Token::SetDefKey(yylval.set_def_key)), YyToken::Set => Some(Token::Set), YyToken::SubsetOf => Some(Token::SubsetOf), YyToken::Disjoint => Some(Token::Disjoint), YyToken::Quotient => Some(Token::Quotient), YyToken::Of => Some(Token::Of), - + YyToken::Bool => Some(Token::Bool(yylval.boolean)), YyToken::Colon => Some(Token::Colon), YyToken::Comma => Some(Token::Comma), YyToken::LParen => Some(Token::LParen), @@ -91,17 +142,7 @@ impl Iterator for Lexer { YyToken::BitOr => Some(Token::BitOr), YyToken::Or => Some(Token::Or), YyToken::And => Some(Token::And), - YyToken::CmpOp => { - match yylval.cmp_op { - CmpOp::Gt => Some(Token::CmpOp(ir::CmpOp::Gt)), - CmpOp::Lt => Some(Token::CmpOp(ir::CmpOp::Lt)), - CmpOp::Geq => Some(Token::CmpOp(ir::CmpOp::Geq)), - CmpOp::Leq => Some(Token::CmpOp(ir::CmpOp::Leq)), - _ => None, - } - }, -// YyToken::Equals => Some(Token::CmpOp(ir::CmpOp::Eq)), -// YyToken::NotEquals => Some(Token::CmpOp(ir::CmpOp::Neq)), + YyToken::CmpOp => Some(Token::CmpOp(yylval.cmp_op)), YyToken::Equal => Some(Token::Equal), // YyToken::Doc => Some(Token::Doc), YyToken::End => Some(Token::End), @@ -109,7 +150,10 @@ impl Iterator for Lexer { YyToken::AntiSymmetric => Some(Token::AntiSymmetric), YyToken::Arrow => Some(Token::Arrow), YyToken::Divide => Some(Token::Divide), - _ => unimplemented!(), + YyToken::EOF => None, + YyToken::Doc => { + None + }, } } } diff --git a/telamon-gen/src/lib.rs b/telamon-gen/src/lib.rs index 42d0c669b..48f848f31 100644 --- a/telamon-gen/src/lib.rs +++ b/telamon-gen/src/lib.rs @@ -19,7 +19,7 @@ mod ast; mod constraint; mod flat_filter; mod ir; -mod lexer; +pub mod lexer; generated_file!(parser); mod print; mod truth_table; diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs new file mode 100644 index 000000000..d06c8dae0 --- /dev/null +++ b/telamon-gen/tests/lexer.rs @@ -0,0 +1,14 @@ +extern crate telamon_gen; + +use telamon_gen::lexer::Lexer; + +#[test] +fn single_enum() { + let mut ll: Lexer = Lexer::from( + b"define enum foo(): + end".to_vec()); + + while let Some(token) = ll.next() { + println!("{:?}", token); + } +} From ea3cbdd5d569998bc4112bb274c4a37d3ee8df51 Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 20 Apr 2018 16:34:36 +0200 Subject: [PATCH 08/70] fixe a bit of F/lex syntax with first short test --- telamon-gen/src/exh.l | 267 +++++++++++++++++---------------- telamon-gen/src/lexer/mod.rs | 1 + telamon-gen/src/lexer/token.rs | 2 +- telamon-gen/tests/lexer.rs | 16 +- 4 files changed, 148 insertions(+), 138 deletions(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index 648923329..8f0251114 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -2,11 +2,14 @@ %option noyywrap %{ + #include + union yylval { int val; } yylval; enum token { + BLANK, VALUEIDENT, CHOICEIDENT, VAR, @@ -94,143 +97,143 @@ %} num ['0'-'9'] -alpha ['a'-'z''A'-'Z''_'] -alpha_num alpha | num - -whitespace [' ''\t''\r''\n']+ -comment "//"[^'/''\n'][^'\n']* | "//" -blank whitespace | comment -c_comment_beg "/*" -c_comment_end "*/" - -alias "alias" -counter "counter" -define "define" -enum "enum" -forall "forall" -in "in" -is "is" -not "not" -product "mul" -require "require" -requires "requires" -sum "sum" -value "value" -end "end" -symmetric "symmetric" -antisymmetric "antisymmetric" -arrow "->" -when "when" -trigger "trigger" -half "half" -hidden "internal" -base "base" - -set "set" -subsetof "subsetof" -item_type "item_type" -id_type "id_type" -item_getter "item_getter" -id_getter "id_getter" -iter "iterator" -from_superset "from_superset" -add_to_set "add_to_set" -prefix "var_prefix" -new_objs "new_objs" -disjoint "disjoint" -reverse "reverse" -quotient "quotient" -of "of" -true "true" -false "false" - -colon ":" -comma "," -lparen "(" -rparen ")" -bit_or "|" -or "||" -and "&&" -gt ">" -lt "<" -ge ">=" -le "<=" -equals "==" -not_equals "!=" -equal "=" -divide "/" - -choice_ident ['a'-'z']['a'-'z''_''0'-'9']* -value_ident ['A'-'Z']['A'-'Z''_''0'-'9']* -set_ident ['A'-'Z']['A'-'Z''a'-'z''_''0'-'9']* -var '$' alpha_num+ -code '\"'[^'\n''\"']*'\"' -doc "///" +alpha ['a'-'z''A'-'Z''_'] +alpha_num {alpha}|{num} + +whitespace [' ''\t''\r''\n']+ +comment "//"[^'/''\n'][^'\n']*|"//" +blank {whitespace}|{comment} +c_comment_beg "/*" +c_comment_end "*/" + +alias "alias" +counter "counter" +define "define" +enum "enum" +forall "forall" +in "in" +is "is" +not "not" +product "mul" +require "require" +requires "requires" +sum "sum" +value "value" +end "end" +symmetric "symmetric" +antisymmetric "antisymmetric" +arrow "->" +when "when" +trigger "trigger" +half "half" +hidden "internal" +base "base" + +set "set" +subsetof "subsetof" +item_type "item_type" +id_type "id_type" +item_getter "item_getter" +id_getter "id_getter" +iter "iterator" +from_superset "from_superset" +add_to_set "add_to_set" +prefix "var_prefix" +new_objs "new_objs" +disjoint "disjoint" +reverse "reverse" +quotient "quotient" +of "of" +true "true" +false "false" + +colon ":" +comma "," +lparen "(" +rparen ")" +bit_or "|" +or "||" +and "&&" +gt ">" +lt "<" +ge ">=" +le "<=" +equals "==" +not_equals "!=" +equal "=" +divide "/" + +choice_ident [a-z][a-z_0-9]* +value_ident [A-Z][A-Z_0-9]* +set_ident [A-Z][A-Za-z_0-9]* +var '$' alpha_num+ +code '\"'[^'\n''\"']*'\"' +doc "///" /* https://github.com/a-haas/Compilation/blob/6fe46a65d64decdb648feba790bb7b1d2980ca0a/yacc/setparser.l */ /* 6 Patterns § http://westes.github.io/flex/manual/Patterns.html#Patterns */ %% -. {return INVALIDTOKEN;} -{choice_ident} {return CHOICEIDENT;} -{set_ident} {return SETIDENT;} -{value_ident} {return VALUEIDENT;} -{alias} {return ALIAS;} -{counter} {return COUNTER;} -{define} {return DEFINE;} -{enum} {return ENUM;} -{forall} {return FORALL;} -{in} {return IN;} -{is} {return IS;} -{not} {return NOT;} -{product} {yylval.val = MUL; return COUNTERKIND;} -{require} {return REQUIRE;} -{requires} {return REQUIRES;} -{sum} {yylval.val = ADD; return COUNTERKIND;} -{value} {return VALUE;} -{when} {return WHEN;} -{trigger} {return TRIGGER;} -{half} {yylval.val = NOMAX; return COUNTERVISIBILITY;} -{hidden} {yylval.val = HIDDENMAX; return COUNTERVISIBILITY;} -{base} {return BASE;} - -{item_type} {yylval.val = ITEMTYPE; return SETDEFKEY;} -{new_objs} {yylval.val = NEWOBJS; return SETDEFKEY;} -{id_type} {yylval.val = IDTYPE; return SETDEFKEY;} -{item_getter} {yylval.val = ITEMGETTER; return SETDEFKEY;} -{id_getter} {yylval.val = IDGETTER; return SETDEFKEY;} -{iter} {yylval.val = ITER; return SETDEFKEY;} -{prefix} {yylval.val = PREFIX; return SETDEFKEY;} -{reverse} {yylval.val = REVERSE; return SETDEFKEY;} -{add_to_set} {yylval.val = ADDTOSET; return SETDEFKEY;} -{from_superset} {yylval.val = FROMSUPERSET; return SETDEFKEY;} -{set} {return SET;} -{subsetof} {return SUBSETOF;} -{disjoint} {return DISJOINT;} -{quotient} {return QUOTIENT;} -{of} {return OF;} -{true} {yylval.val = 1; return BOOL;} -{false} {yylval.val = 0; return BOOL;} -{colon} {return COLON;} -{comma} {return COMMA;} -{lparen} {return LPAREN;} -{rparen} {return RPAREN;} -{bit_or} {return BITOR;} -{or} {return OR;} -{and} {return AND;} -{gt} {yylval.val = GT; return CMPOP;} -{lt} {yylval.val = LT; return CMPOP;} -{ge} {yylval.val = GEQ; return CMPOP;} -{le} {yylval.val = LEQ; return CMPOP;} -{equals} {yylval.val = EQ; return CMPOP;} -{not_equals} {yylval.val = NEQ; return CMPOP;} -{equal} {return EQUAL;} + // . { return INVALIDTOKEN; } +{alias} { return ALIAS; } +{counter} { return COUNTER; } +{define} { return DEFINE; } +{enum} { return ENUM; } +{forall} { return FORALL; } +{in} { return IN; } +{is} { return IS; } +{not} { return NOT; } +{product} {yylval.val = MUL; return COUNTERKIND; } +{require} { return REQUIRE; } +{requires} { return REQUIRES; } +{sum} {yylval.val = ADD; return COUNTERKIND; } +{value} { return VALUE; } +{when} { return WHEN; } +{trigger} { return TRIGGER; } +{half} {yylval.val = NOMAX; return COUNTERVISIBILITY; } +{hidden} {yylval.val = HIDDENMAX; return COUNTERVISIBILITY; } +{base} { return BASE; } + +{item_type} {yylval.val = ITEMTYPE; return SETDEFKEY; } +{new_objs} {yylval.val = NEWOBJS; return SETDEFKEY; } +{id_type} {yylval.val = IDTYPE; return SETDEFKEY; } +{item_getter} {yylval.val = ITEMGETTER; return SETDEFKEY; } +{id_getter} {yylval.val = IDGETTER; return SETDEFKEY; } +{iter} {yylval.val = ITER; return SETDEFKEY; } +{prefix} {yylval.val = PREFIX; return SETDEFKEY; } +{reverse} {yylval.val = REVERSE; return SETDEFKEY; } +{add_to_set} {yylval.val = ADDTOSET; return SETDEFKEY; } +{from_superset} {yylval.val = FROMSUPERSET; return SETDEFKEY; } +{set} { return SET; } +{subsetof} { return SUBSETOF; } +{disjoint} { return DISJOINT; } +{quotient} { return QUOTIENT; } +{of} { return OF; } +{true} {yylval.val = 1; return BOOL; } +{false} {yylval.val = 0; return BOOL; } + +{colon} { return COLON; } +{lparen} { return LPAREN; } +{rparen} { return RPAREN; } +{bit_or} { return BITOR; } +{or} { return OR; } +{and} { return AND; } +{gt} {yylval.val = GT; return CMPOP; } +{lt} {yylval.val = LT; return CMPOP; } +{ge} {yylval.val = GEQ; return CMPOP; } +{le} {yylval.val = LEQ; return CMPOP; } +{equals} {yylval.val = EQ; return CMPOP; } +{not_equals} {yylval.val = NEQ; return CMPOP; } {doc} {} -{end} {return END;} -{symmetric} {return SYMMETRIC;} -{antisymmetric} {return ANTISYMMETRIC;} -{arrow} {return ARROW;} -{divide} {return DIVIDE;} -<> {return EOF;} +{end} { return END; } +{symmetric} { return SYMMETRIC; } +{antisymmetric} { return ANTISYMMETRIC; } +{arrow} { return ARROW; } +{divide} { return DIVIDE; } +{choice_ident} { return CHOICEIDENT; } +{value_ident} { return VALUEIDENT; } +{set_ident} { return SETIDENT; } +{blank} { return BLANK; } +<> { return EOF; } %% diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index 6b5db2297..a1443c36b 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -67,6 +67,7 @@ impl Iterator for Lexer { fn next(&mut self) -> Option { unsafe { match yylex(self.scanner) { + YyToken::Blank => self.next(), YyToken::InvalidToken => { let out = ffi::yyget_text(self.scanner); diff --git a/telamon-gen/src/lexer/token.rs b/telamon-gen/src/lexer/token.rs index 2599f83c2..b2f80d999 100644 --- a/telamon-gen/src/lexer/token.rs +++ b/telamon-gen/src/lexer/token.rs @@ -1,6 +1,6 @@ use ir; -#[derive(Debug)] +#[derive(Debug, PartialEq)] pub enum Token { ValueIdent(String), ChoiceIdent(String), Var(String), Doc(String), CmpOp(ir::CmpOp), InvalidToken(String), Code(String), CounterKind(ir::CounterKind), Bool(bool), diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index d06c8dae0..d728ec920 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -1,14 +1,20 @@ extern crate telamon_gen; -use telamon_gen::lexer::Lexer; +use telamon_gen::lexer::{Lexer,Token}; #[test] fn single_enum() { - let mut ll: Lexer = Lexer::from( + let ll: Lexer = Lexer::from( b"define enum foo(): end".to_vec()); - while let Some(token) = ll.next() { - println!("{:?}", token); - } + assert_eq!(ll.collect::>(), vec![ + Token::Define, + Token::Enum, + Token::ChoiceIdent(String::from("foo")), + Token::LParen, + Token::RParen, + Token::Colon, + Token::End + ]); } From 2ebdcd0a4f8ee780ac5a80923035e65f64f60551 Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 20 Apr 2018 18:02:49 +0200 Subject: [PATCH 09/70] add second test for code's token --- telamon-gen/src/exh.l | 7 +++++-- telamon-gen/src/lexer/mod.rs | 3 ++- telamon-gen/src/lib.rs | 2 +- telamon-gen/tests/lexer.rs | 18 ++++++++++++++++++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index 8f0251114..077c6c4f1 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -166,8 +166,8 @@ divide "/" choice_ident [a-z][a-z_0-9]* value_ident [A-Z][A-Z_0-9]* set_ident [A-Z][A-Za-z_0-9]* -var '$' alpha_num+ -code '\"'[^'\n''\"']*'\"' +var '$'alpha_num+ +code \"[^\n\"]*\" doc "///" /* https://github.com/a-haas/Compilation/blob/6fe46a65d64decdb648feba790bb7b1d2980ca0a/yacc/setparser.l */ @@ -231,6 +231,9 @@ doc "///" {antisymmetric} { return ANTISYMMETRIC; } {arrow} { return ARROW; } {divide} { return DIVIDE; } + +{var} { return VAR; } +{code} { return CODE; } {choice_ident} { return CHOICEIDENT; } {value_ident} { return VALUEIDENT; } {set_ident} { return SETIDENT; } diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index a1443c36b..c8dc6cd3d 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -107,8 +107,9 @@ impl Iterator for Lexer { }, YyToken::Code => { let out = ffi::yyget_text(self.scanner); + let len = libc::strlen(out)-1; - *out.offset(libc::strlen(out) as _) = b'\0' as _; + *out.offset(len as _) = b'\0' as _; CStr::from_ptr(out.offset(1)) .to_str().ok() .and_then(|s: &str| Some(Token::Code(s.to_owned()))) diff --git a/telamon-gen/src/lib.rs b/telamon-gen/src/lib.rs index 48f848f31..a299d16f6 100644 --- a/telamon-gen/src/lib.rs +++ b/telamon-gen/src/lib.rs @@ -18,7 +18,7 @@ extern crate libc; mod ast; mod constraint; mod flat_filter; -mod ir; +pub mod ir; pub mod lexer; generated_file!(parser); mod print; diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index d728ec920..9dcf95de0 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -1,6 +1,24 @@ extern crate telamon_gen; use telamon_gen::lexer::{Lexer,Token}; +use telamon_gen::ir::SetDefKey; + +#[test] +fn counter_alloc() { + let ll: Lexer = Lexer::from( + b"set Instruction: + id_type = \"ir::inst::Obj\" + end".to_vec()); + + assert_eq!(ll.collect::>(), vec![ + Token::Set, + Token::SetIdent(String::from("Instruction")), + Token::Colon, + Token::SetDefKey(SetDefKey::IdType), + Token::Code(String::from("ir::inst::Obj")), + Token::End + ]); +} #[test] fn single_enum() { From b2086193bd906a9778c592a2ebe3af0124a29b89 Mon Sep 17 00:00:00 2001 From: adjivas Date: Tue, 24 Apr 2018 19:30:56 +0200 Subject: [PATCH 10/70] reset test as a complet list of token, add of a null character to the end of all inputs, this need a investigation to found another syntax --- telamon-gen/src/exh.l | 8 +- telamon-gen/tests/lexer.rs | 266 +++++++++++++++++++++++++++++++++---- 2 files changed, 242 insertions(+), 32 deletions(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index 077c6c4f1..dd9eecd93 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -166,7 +166,7 @@ divide "/" choice_ident [a-z][a-z_0-9]* value_ident [A-Z][A-Z_0-9]* set_ident [A-Z][A-Za-z_0-9]* -var '$'alpha_num+ +var ['$'alpha_num+] code \"[^\n\"]*\" doc "///" @@ -175,7 +175,6 @@ doc "///" /* 6 Patterns § http://westes.github.io/flex/manual/Patterns.html#Patterns */ %% - // . { return INVALIDTOKEN; } {alias} { return ALIAS; } {counter} { return COUNTER; } {define} { return DEFINE; } @@ -206,14 +205,15 @@ doc "///" {add_to_set} {yylval.val = ADDTOSET; return SETDEFKEY; } {from_superset} {yylval.val = FROMSUPERSET; return SETDEFKEY; } {set} { return SET; } +{of} { return OF; } {subsetof} { return SUBSETOF; } {disjoint} { return DISJOINT; } {quotient} { return QUOTIENT; } -{of} { return OF; } {true} {yylval.val = 1; return BOOL; } {false} {yylval.val = 0; return BOOL; } {colon} { return COLON; } +{comma} { return COMMA; } {lparen} { return LPAREN; } {rparen} { return RPAREN; } {bit_or} { return BITOR; } @@ -225,6 +225,7 @@ doc "///" {le} {yylval.val = LEQ; return CMPOP; } {equals} {yylval.val = EQ; return CMPOP; } {not_equals} {yylval.val = NEQ; return CMPOP; } +{equal} { return EQUAL; } {doc} {} {end} { return END; } {symmetric} { return SYMMETRIC; } @@ -239,4 +240,5 @@ doc "///" {set_ident} { return SETIDENT; } {blank} { return BLANK; } <> { return EOF; } +. { return INVALIDTOKEN; } %% diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index 9dcf95de0..372b05e1c 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -1,38 +1,246 @@ extern crate telamon_gen; use telamon_gen::lexer::{Lexer,Token}; -use telamon_gen::ir::SetDefKey; +use telamon_gen::ir::{CounterKind, CounterVisibility, SetDefKey, CmpOp}; #[test] -fn counter_alloc() { - let ll: Lexer = Lexer::from( - b"set Instruction: - id_type = \"ir::inst::Obj\" - end".to_vec()); - - assert_eq!(ll.collect::>(), vec![ - Token::Set, - Token::SetIdent(String::from("Instruction")), - Token::Colon, - Token::SetDefKey(SetDefKey::IdType), - Token::Code(String::from("ir::inst::Obj")), - Token::End +fn token() { + // Blank + assert_eq!(Lexer::from(b" \0".to_vec()).collect::>(), vec![]); + // Invalid's Token + assert_eq!(Lexer::from(b"!\0".to_vec()).collect::>(), vec![ + Token::InvalidToken(String::from("!")), ]); -} - -#[test] -fn single_enum() { - let ll: Lexer = Lexer::from( - b"define enum foo(): - end".to_vec()); - - assert_eq!(ll.collect::>(), vec![ - Token::Define, - Token::Enum, - Token::ChoiceIdent(String::from("foo")), - Token::LParen, - Token::RParen, - Token::Colon, + // ChoiceIdent's Token + assert_eq!(Lexer::from(b"az_09\0".to_vec()).collect::>(), vec![ + Token::ChoiceIdent(String::from("az_09")) + ]); + // SetIdent's Token + assert_eq!(Lexer::from(b"Az_09\0".to_vec()).collect::>(), vec![ + Token::SetIdent(String::from("Az_09")) + ]); + // ValueIdent's Token + assert_eq!(Lexer::from(b"AZ_09\0".to_vec()).collect::>(), vec![ + Token::ValueIdent(String::from("AZ_09")) + ]); + // Var's Token +// assert_eq!(Lexer::from(b"$v\0".to_vec()).collect::>(), vec![ +// Token::Var(String::from("v")), +// ]); + // Code's Token + assert_eq!(Lexer::from(b"\"ir::...\"\0".to_vec()).collect::>(), vec![ + Token::Code(String::from("ir::...")), + ]); + // Alias's Token + assert_eq!(Lexer::from(b"alias\0".to_vec()).collect::>(), vec![ + Token::Alias + ]); + // Counter's Token + assert_eq!(Lexer::from(b"counter\0".to_vec()).collect::>(), vec![ + Token::Counter + ]); + // Define's Token + assert_eq!(Lexer::from(b"define\0".to_vec()).collect::>(), vec![ + Token::Define + ]); + // Enum's Token + assert_eq!(Lexer::from(b"enum\0".to_vec()).collect::>(), vec![ + Token::Enum + ]); + // Forall's Token + assert_eq!(Lexer::from(b"forall\0".to_vec()).collect::>(), vec![ + Token::Forall + ]); + // In's Token + assert_eq!(Lexer::from(b"in\0".to_vec()).collect::>(), vec![ + Token::In + ]); + // Is's Token + assert_eq!(Lexer::from(b"is\0".to_vec()).collect::>(), vec![ + Token::Is + ]); + // Not's Token + assert_eq!(Lexer::from(b"not\0".to_vec()).collect::>(), vec![ + Token::Not + ]); + // Require's Token + assert_eq!(Lexer::from(b"require\0".to_vec()).collect::>(), vec![ + Token::Require + ]); + // Mul's CounterKind Token + assert_eq!(Lexer::from(b"mul\0".to_vec()).collect::>(), vec![ + Token::CounterKind(CounterKind::Mul) + ]); + // Sum's CounterKind Token + assert_eq!(Lexer::from(b"sum\0".to_vec()).collect::>(), vec![ + Token::CounterKind(CounterKind::Add) + ]); + // Value's Token + assert_eq!(Lexer::from(b"value\0".to_vec()).collect::>(), vec![ + Token::Value + ]); + // When's Token + assert_eq!(Lexer::from(b"when\0".to_vec()).collect::>(), vec![ + Token::When + ]); + // Trigger's Token + assert_eq!(Lexer::from(b"trigger\0".to_vec()).collect::>(), vec![ + Token::Trigger + ]); + // NoMax's CounterVisibility Token + assert_eq!(Lexer::from(b"half\0".to_vec()).collect::>(), vec![ + Token::CounterVisibility(CounterVisibility::NoMax) + ]); + // HiddenMax's CounterVisibility Token + assert_eq!(Lexer::from(b"internal\0".to_vec()).collect::>(), vec![ + Token::CounterVisibility(CounterVisibility::HiddenMax) + ]); + // Base's Token + assert_eq!(Lexer::from(b"base\0".to_vec()).collect::>(), vec![ + Token::Base + ]); + // item_type's SetDefKey Token + assert_eq!(Lexer::from(b"item_type\0".to_vec()).collect::>(), vec![ + Token::SetDefKey(SetDefKey::ItemType) + ]); + // NewObjs's SetDefKey Token + assert_eq!(Lexer::from(b"new_objs\0".to_vec()).collect::>(), vec![ + Token::SetDefKey(SetDefKey::NewObjs) + ]); + // IdType's SetDefKey Token + assert_eq!(Lexer::from(b"id_type\0".to_vec()).collect::>(), vec![ + Token::SetDefKey(SetDefKey::IdType) + ]); + // ItemGetter's SetDefKey Token + assert_eq!(Lexer::from(b"item_getter\0".to_vec()).collect::>(), vec![ + Token::SetDefKey(SetDefKey::ItemGetter) + ]); + // IdGetter's SetDefKey Token + assert_eq!(Lexer::from(b"id_getter\0".to_vec()).collect::>(), vec![ + Token::SetDefKey(SetDefKey::IdGetter) + ]); + // Iter's SetDefKey Token + assert_eq!(Lexer::from(b"iterator\0".to_vec()).collect::>(), vec![ + Token::SetDefKey(SetDefKey::Iter) + ]); + // Prefix's SetDefKey Token + assert_eq!(Lexer::from(b"var_prefix\0".to_vec()).collect::>(), vec![ + Token::SetDefKey(SetDefKey::Prefix) + ]); + // Reverse's SetDefKey Token + assert_eq!(Lexer::from(b"reverse\0".to_vec()).collect::>(), vec![ + Token::SetDefKey(SetDefKey::Reverse) + ]); + // AddToSet's SetDefKey Token + assert_eq!(Lexer::from(b"add_to_set\0".to_vec()).collect::>(), vec![ + Token::SetDefKey(SetDefKey::AddToSet) + ]); + // FromSuperset's SetDefKey Token + assert_eq!(Lexer::from(b"from_superset\0".to_vec()).collect::>(), vec![ + Token::SetDefKey(SetDefKey::FromSuperset) + ]); + // Set's Token + assert_eq!(Lexer::from(b"set\0".to_vec()).collect::>(), vec![ + Token::Set + ]); + // SubsetOf's Token + assert_eq!(Lexer::from(b"subsetof\0".to_vec()).collect::>(), vec![ + Token::SubsetOf + ]); + // Disjoint's Token + assert_eq!(Lexer::from(b"disjoint\0".to_vec()).collect::>(), vec![ + Token::Disjoint + ]); + // Quotient's Token + assert_eq!(Lexer::from(b"quotient\0".to_vec()).collect::>(), vec![ + Token::Quotient + ]); + // Of's Token + assert_eq!(Lexer::from(b"of\0".to_vec()).collect::>(), vec![ + Token::Of + ]); + // False's Bool Token + assert_eq!(Lexer::from(b"false\0".to_vec()).collect::>(), vec![ + Token::Bool(false) + ]); + // True's Bool Token + assert_eq!(Lexer::from(b"true\0".to_vec()).collect::>(), vec![ + Token::Bool(true) + ]); + // Colon's Token + assert_eq!(Lexer::from(b":\0".to_vec()).collect::>(), vec![ + Token::Colon + ]); + // Comma's Token + assert_eq!(Lexer::from(b",\0".to_vec()).collect::>(), vec![ + Token::Comma + ]); + // LParen's Token + assert_eq!(Lexer::from(b"(\0".to_vec()).collect::>(), vec![ + Token::LParen + ]); + // RParen's Token + assert_eq!(Lexer::from(b")\0".to_vec()).collect::>(), vec![ + Token::RParen + ]); + // Bitor's Token + assert_eq!(Lexer::from(b"|\0".to_vec()).collect::>(), vec![ + Token::BitOr + ]); + // Or's Token + assert_eq!(Lexer::from(b"||\0".to_vec()).collect::>(), vec![ + Token::Or + ]); + // And's Token + assert_eq!(Lexer::from(b"&&\0".to_vec()).collect::>(), vec![ + Token::And + ]); + // Gt's CmpOp Token + assert_eq!(Lexer::from(b">\0".to_vec()).collect::>(), vec![ + Token::CmpOp(CmpOp::Gt) + ]); + // Lt's CmpOp Token + assert_eq!(Lexer::from(b"<\0".to_vec()).collect::>(), vec![ + Token::CmpOp(CmpOp::Lt) + ]); + // Ge's CmpOp Token + assert_eq!(Lexer::from(b">=\0".to_vec()).collect::>(), vec![ + Token::CmpOp(CmpOp::Geq) + ]); + // Le's CmpOp Token + assert_eq!(Lexer::from(b"<=\0".to_vec()).collect::>(), vec![ + Token::CmpOp(CmpOp::Leq) + ]); + // Eq's CmpOp Token + assert_eq!(Lexer::from(b"==\0".to_vec()).collect::>(), vec![ + Token::CmpOp(CmpOp::Eq) + ]); + // Neq's CmpOp Token + assert_eq!(Lexer::from(b"!=\0".to_vec()).collect::>(), vec![ + Token::CmpOp(CmpOp::Neq) + ]); + // Equal's Token + assert_eq!(Lexer::from(b"=\0".to_vec()).collect::>(), vec![ + Token::Equal + ]); + // End's Token + assert_eq!(Lexer::from(b"end\0".to_vec()).collect::>(), vec![ Token::End ]); + // Symmetric's Token + assert_eq!(Lexer::from(b"symmetric\0".to_vec()).collect::>(), vec![ + Token::Symmetric + ]); + // AntiSymmetric's Token + assert_eq!(Lexer::from(b"antisymmetric\0".to_vec()).collect::>(), vec![ + Token::AntiSymmetric + ]); + // Arrow's Token + assert_eq!(Lexer::from(b"->\0".to_vec()).collect::>(), vec![ + Token::Arrow + ]); + // Divide's Token + assert_eq!(Lexer::from(b"/\0".to_vec()).collect::>(), vec![ + Token::Divide + ]); } From 473f57c3fd42bc666e35b3a1a28beaf8ea320b13 Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 25 Apr 2018 10:48:20 +0200 Subject: [PATCH 11/70] fixe test --- telamon-gen/src/exh.l | 10 +++++----- telamon-gen/tests/lexer.rs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index dd9eecd93..e34675570 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -96,12 +96,12 @@ }; %} -num ['0'-'9'] -alpha ['a'-'z''A'-'Z''_'] +num [0-9] +alpha [a-zA-Z_] alpha_num {alpha}|{num} -whitespace [' ''\t''\r''\n']+ -comment "//"[^'/''\n'][^'\n']*|"//" +whitespace [ \t\r\n]+ +comment "//"[^/\n][^\n]*|"//" blank {whitespace}|{comment} c_comment_beg "/*" c_comment_end "*/" @@ -166,7 +166,7 @@ divide "/" choice_ident [a-z][a-z_0-9]* value_ident [A-Z][A-Z_0-9]* set_ident [A-Z][A-Za-z_0-9]* -var ['$'alpha_num+] +var \${alpha_num}+ code \"[^\n\"]*\" doc "///" diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index 372b05e1c..b98f09ca3 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -24,9 +24,9 @@ fn token() { Token::ValueIdent(String::from("AZ_09")) ]); // Var's Token -// assert_eq!(Lexer::from(b"$v\0".to_vec()).collect::>(), vec![ -// Token::Var(String::from("v")), -// ]); + assert_eq!(Lexer::from(b"$vV\0".to_vec()).collect::>(), vec![ + Token::Var(String::from("vV")), + ]); // Code's Token assert_eq!(Lexer::from(b"\"ir::...\"\0".to_vec()).collect::>(), vec![ Token::Code(String::from("ir::...")), From 86ad6fedc2c11106b47069f263e6d48e2c57f36a Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 25 Apr 2018 11:47:46 +0200 Subject: [PATCH 12/70] not need null character, solve it with yy_scan_bytes function --- telamon-gen/src/lexer/ffi.rs | 3 + telamon-gen/src/lexer/mod.rs | 5 +- telamon-gen/tests/lexer.rs | 120 +++++++++++++++++------------------ 3 files changed, 66 insertions(+), 62 deletions(-) diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index 29ae8ff97..361bdc01a 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -4,6 +4,7 @@ use ::ir; /// https://westes.github.io/flex/manual/About-yyscan_005ft.html pub type YyScan = *const libc::c_void; pub type YyBufferState = *const libc::c_void; +pub type YySize = libc::size_t; #[derive(Copy, Clone)] #[repr(C)] @@ -72,6 +73,8 @@ extern { pub fn yylex_init(scanner: *const YyScan) -> libc::c_int; pub fn yy_scan_string(yy_str: *const libc::c_char, yyscanner: YyScan) -> YyBufferState; + pub fn yy_scan_buffer(base: *const libc::c_char, size: YySize, yyscanner: YyScan) -> YyBufferState; + pub fn yy_scan_bytes(base: *const libc::c_char, len: libc::c_int, yyscanner: YyScan) -> YyBufferState; pub fn yylex(yyscanner: YyScan) -> YyToken; pub fn yyget_text(yyscanner: YyScan) -> *mut libc::c_char; pub fn yy_delete_buffer(b: YyBufferState, yyscanner: YyScan); diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index c8dc6cd3d..d2afd0326 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -15,7 +15,8 @@ use self::ffi::{ YyScan, YyBufferState, yylex_init, - yy_scan_string, + yy_scan_buffer, + yy_scan_bytes, yy_delete_buffer, yylex_destroy, yylex, @@ -46,7 +47,7 @@ impl From> for Lexer { yylex_init(&scanner); // https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html#index-yylex_005finit Lexer { scanner: scanner, - buffer: yy_scan_string(buffer.as_ptr() as *const _, scanner), // https://westes.github.io/flex/manual/Multiple-Input-Buffers.html + buffer: yy_scan_bytes(buffer.as_ptr() as *const _, buffer.len() as _, scanner), // https://westes.github.io/flex/manual/Multiple-Input-Buffers.html } } } diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index b98f09ca3..07d85636c 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -6,241 +6,241 @@ use telamon_gen::ir::{CounterKind, CounterVisibility, SetDefKey, CmpOp}; #[test] fn token() { // Blank - assert_eq!(Lexer::from(b" \0".to_vec()).collect::>(), vec![]); + assert_eq!(Lexer::from(b" ".to_vec()).collect::>(), vec![]); // Invalid's Token - assert_eq!(Lexer::from(b"!\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"!".to_vec()).collect::>(), vec![ Token::InvalidToken(String::from("!")), ]); // ChoiceIdent's Token - assert_eq!(Lexer::from(b"az_09\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"az_09".to_vec()).collect::>(), vec![ Token::ChoiceIdent(String::from("az_09")) ]); // SetIdent's Token - assert_eq!(Lexer::from(b"Az_09\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"Az_09".to_vec()).collect::>(), vec![ Token::SetIdent(String::from("Az_09")) ]); // ValueIdent's Token - assert_eq!(Lexer::from(b"AZ_09\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"AZ_09".to_vec()).collect::>(), vec![ Token::ValueIdent(String::from("AZ_09")) ]); // Var's Token - assert_eq!(Lexer::from(b"$vV\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"$vV".to_vec()).collect::>(), vec![ Token::Var(String::from("vV")), ]); // Code's Token - assert_eq!(Lexer::from(b"\"ir::...\"\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"\"ir::...\"".to_vec()).collect::>(), vec![ Token::Code(String::from("ir::...")), ]); // Alias's Token - assert_eq!(Lexer::from(b"alias\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"alias".to_vec()).collect::>(), vec![ Token::Alias ]); // Counter's Token - assert_eq!(Lexer::from(b"counter\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"counter".to_vec()).collect::>(), vec![ Token::Counter ]); // Define's Token - assert_eq!(Lexer::from(b"define\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"define".to_vec()).collect::>(), vec![ Token::Define ]); // Enum's Token - assert_eq!(Lexer::from(b"enum\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"enum".to_vec()).collect::>(), vec![ Token::Enum ]); // Forall's Token - assert_eq!(Lexer::from(b"forall\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"forall".to_vec()).collect::>(), vec![ Token::Forall ]); // In's Token - assert_eq!(Lexer::from(b"in\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"in".to_vec()).collect::>(), vec![ Token::In ]); // Is's Token - assert_eq!(Lexer::from(b"is\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"is".to_vec()).collect::>(), vec![ Token::Is ]); // Not's Token - assert_eq!(Lexer::from(b"not\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"not".to_vec()).collect::>(), vec![ Token::Not ]); // Require's Token - assert_eq!(Lexer::from(b"require\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"require".to_vec()).collect::>(), vec![ Token::Require ]); // Mul's CounterKind Token - assert_eq!(Lexer::from(b"mul\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"mul".to_vec()).collect::>(), vec![ Token::CounterKind(CounterKind::Mul) ]); // Sum's CounterKind Token - assert_eq!(Lexer::from(b"sum\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"sum".to_vec()).collect::>(), vec![ Token::CounterKind(CounterKind::Add) ]); // Value's Token - assert_eq!(Lexer::from(b"value\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"value".to_vec()).collect::>(), vec![ Token::Value ]); // When's Token - assert_eq!(Lexer::from(b"when\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"when".to_vec()).collect::>(), vec![ Token::When ]); // Trigger's Token - assert_eq!(Lexer::from(b"trigger\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"trigger".to_vec()).collect::>(), vec![ Token::Trigger ]); // NoMax's CounterVisibility Token - assert_eq!(Lexer::from(b"half\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"half".to_vec()).collect::>(), vec![ Token::CounterVisibility(CounterVisibility::NoMax) ]); // HiddenMax's CounterVisibility Token - assert_eq!(Lexer::from(b"internal\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"internal".to_vec()).collect::>(), vec![ Token::CounterVisibility(CounterVisibility::HiddenMax) ]); // Base's Token - assert_eq!(Lexer::from(b"base\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"base".to_vec()).collect::>(), vec![ Token::Base ]); // item_type's SetDefKey Token - assert_eq!(Lexer::from(b"item_type\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"item_type".to_vec()).collect::>(), vec![ Token::SetDefKey(SetDefKey::ItemType) ]); // NewObjs's SetDefKey Token - assert_eq!(Lexer::from(b"new_objs\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"new_objs".to_vec()).collect::>(), vec![ Token::SetDefKey(SetDefKey::NewObjs) ]); // IdType's SetDefKey Token - assert_eq!(Lexer::from(b"id_type\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"id_type".to_vec()).collect::>(), vec![ Token::SetDefKey(SetDefKey::IdType) ]); // ItemGetter's SetDefKey Token - assert_eq!(Lexer::from(b"item_getter\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"item_getter".to_vec()).collect::>(), vec![ Token::SetDefKey(SetDefKey::ItemGetter) ]); // IdGetter's SetDefKey Token - assert_eq!(Lexer::from(b"id_getter\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"id_getter".to_vec()).collect::>(), vec![ Token::SetDefKey(SetDefKey::IdGetter) ]); // Iter's SetDefKey Token - assert_eq!(Lexer::from(b"iterator\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"iterator".to_vec()).collect::>(), vec![ Token::SetDefKey(SetDefKey::Iter) ]); // Prefix's SetDefKey Token - assert_eq!(Lexer::from(b"var_prefix\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"var_prefix".to_vec()).collect::>(), vec![ Token::SetDefKey(SetDefKey::Prefix) ]); // Reverse's SetDefKey Token - assert_eq!(Lexer::from(b"reverse\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"reverse".to_vec()).collect::>(), vec![ Token::SetDefKey(SetDefKey::Reverse) ]); // AddToSet's SetDefKey Token - assert_eq!(Lexer::from(b"add_to_set\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"add_to_set".to_vec()).collect::>(), vec![ Token::SetDefKey(SetDefKey::AddToSet) ]); // FromSuperset's SetDefKey Token - assert_eq!(Lexer::from(b"from_superset\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"from_superset".to_vec()).collect::>(), vec![ Token::SetDefKey(SetDefKey::FromSuperset) ]); // Set's Token - assert_eq!(Lexer::from(b"set\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"set".to_vec()).collect::>(), vec![ Token::Set ]); // SubsetOf's Token - assert_eq!(Lexer::from(b"subsetof\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"subsetof".to_vec()).collect::>(), vec![ Token::SubsetOf ]); // Disjoint's Token - assert_eq!(Lexer::from(b"disjoint\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"disjoint".to_vec()).collect::>(), vec![ Token::Disjoint ]); // Quotient's Token - assert_eq!(Lexer::from(b"quotient\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"quotient".to_vec()).collect::>(), vec![ Token::Quotient ]); // Of's Token - assert_eq!(Lexer::from(b"of\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"of".to_vec()).collect::>(), vec![ Token::Of ]); // False's Bool Token - assert_eq!(Lexer::from(b"false\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"false".to_vec()).collect::>(), vec![ Token::Bool(false) ]); // True's Bool Token - assert_eq!(Lexer::from(b"true\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"true".to_vec()).collect::>(), vec![ Token::Bool(true) ]); // Colon's Token - assert_eq!(Lexer::from(b":\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b":".to_vec()).collect::>(), vec![ Token::Colon ]); // Comma's Token - assert_eq!(Lexer::from(b",\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b",".to_vec()).collect::>(), vec![ Token::Comma ]); // LParen's Token - assert_eq!(Lexer::from(b"(\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"(".to_vec()).collect::>(), vec![ Token::LParen ]); // RParen's Token - assert_eq!(Lexer::from(b")\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b")".to_vec()).collect::>(), vec![ Token::RParen ]); // Bitor's Token - assert_eq!(Lexer::from(b"|\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"|".to_vec()).collect::>(), vec![ Token::BitOr ]); // Or's Token - assert_eq!(Lexer::from(b"||\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"||".to_vec()).collect::>(), vec![ Token::Or ]); // And's Token - assert_eq!(Lexer::from(b"&&\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"&&".to_vec()).collect::>(), vec![ Token::And ]); // Gt's CmpOp Token - assert_eq!(Lexer::from(b">\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b">".to_vec()).collect::>(), vec![ Token::CmpOp(CmpOp::Gt) ]); // Lt's CmpOp Token - assert_eq!(Lexer::from(b"<\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"<".to_vec()).collect::>(), vec![ Token::CmpOp(CmpOp::Lt) ]); // Ge's CmpOp Token - assert_eq!(Lexer::from(b">=\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b">=".to_vec()).collect::>(), vec![ Token::CmpOp(CmpOp::Geq) ]); // Le's CmpOp Token - assert_eq!(Lexer::from(b"<=\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"<=".to_vec()).collect::>(), vec![ Token::CmpOp(CmpOp::Leq) ]); // Eq's CmpOp Token - assert_eq!(Lexer::from(b"==\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"==".to_vec()).collect::>(), vec![ Token::CmpOp(CmpOp::Eq) ]); // Neq's CmpOp Token - assert_eq!(Lexer::from(b"!=\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"!=".to_vec()).collect::>(), vec![ Token::CmpOp(CmpOp::Neq) ]); // Equal's Token - assert_eq!(Lexer::from(b"=\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"=".to_vec()).collect::>(), vec![ Token::Equal ]); // End's Token - assert_eq!(Lexer::from(b"end\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"end".to_vec()).collect::>(), vec![ Token::End ]); // Symmetric's Token - assert_eq!(Lexer::from(b"symmetric\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"symmetric".to_vec()).collect::>(), vec![ Token::Symmetric ]); // AntiSymmetric's Token - assert_eq!(Lexer::from(b"antisymmetric\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"antisymmetric".to_vec()).collect::>(), vec![ Token::AntiSymmetric ]); // Arrow's Token - assert_eq!(Lexer::from(b"->\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"->".to_vec()).collect::>(), vec![ Token::Arrow ]); // Divide's Token - assert_eq!(Lexer::from(b"/\0".to_vec()).collect::>(), vec![ + assert_eq!(Lexer::from(b"/".to_vec()).collect::>(), vec![ Token::Divide ]); } From 499cff225e877255bc3bd0276f7a4668f403e94f Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 25 Apr 2018 14:36:48 +0200 Subject: [PATCH 13/70] implementation of c comment --- telamon-gen/src/exh.l | 6 ++++++ telamon-gen/tests/lexer.rs | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index e34675570..41194bcc1 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -1,6 +1,8 @@ %option reentrant %option noyywrap +%x C_COMMENT + %{ #include @@ -175,6 +177,10 @@ doc "///" /* 6 Patterns § http://westes.github.io/flex/manual/Patterns.html#Patterns */ %% +{c_comment_beg} {BEGIN(C_COMMENT);} +{c_comment_end} {BEGIN(INITIAL);} +. {} + {alias} { return ALIAS; } {counter} { return COUNTER; } {define} { return DEFINE; } diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index 07d85636c..85c93ac91 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -4,7 +4,7 @@ use telamon_gen::lexer::{Lexer,Token}; use telamon_gen::ir::{CounterKind, CounterVisibility, SetDefKey, CmpOp}; #[test] -fn token() { +fn initial() { // Blank assert_eq!(Lexer::from(b" ".to_vec()).collect::>(), vec![]); // Invalid's Token @@ -244,3 +244,10 @@ fn token() { Token::Divide ]); } + +#[test] +fn comment_mode() { + // C_COMMENT's Token + assert_eq!(Lexer::from(b"/* comment */ ".to_vec()).collect::>(), vec![]); + assert_eq!(Lexer::from(b"/* comment \n comment */ ".to_vec()).collect::>(), vec![]); +} From 9bfb3c6c7f90251c93fabb046e4108148c143179 Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 25 Apr 2018 16:03:16 +0200 Subject: [PATCH 14/70] naive implementation of DOC token --- telamon-gen/src/exh.l | 27 +++++++++++++++++---------- telamon-gen/src/lexer/mod.rs | 12 ++++++++---- telamon-gen/tests/lexer.rs | 8 ++++++++ 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index 41194bcc1..d653d487d 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -105,9 +105,13 @@ alpha_num {alpha}|{num} whitespace [ \t\r\n]+ comment "//"[^/\n][^\n]*|"//" blank {whitespace}|{comment} + c_comment_beg "/*" c_comment_end "*/" +outer_line_doc "///".* +line_comment "//".* + alias "alias" counter "counter" define "define" @@ -181,6 +185,9 @@ doc "///" {c_comment_end} {BEGIN(INITIAL);} . {} +{outer_line_doc} { yytext += 3;return DOC;} +{line_comment} { yytext += 2;return DOC;} + {alias} { return ALIAS; } {counter} { return COUNTER; } {define} { return DEFINE; } @@ -215,8 +222,8 @@ doc "///" {subsetof} { return SUBSETOF; } {disjoint} { return DISJOINT; } {quotient} { return QUOTIENT; } -{true} {yylval.val = 1; return BOOL; } -{false} {yylval.val = 0; return BOOL; } +{true} {yylval.val = 1; return BOOL; } +{false} {yylval.val = 0; return BOOL; } {colon} { return COLON; } {comma} { return COMMA; } @@ -225,12 +232,12 @@ doc "///" {bit_or} { return BITOR; } {or} { return OR; } {and} { return AND; } -{gt} {yylval.val = GT; return CMPOP; } -{lt} {yylval.val = LT; return CMPOP; } -{ge} {yylval.val = GEQ; return CMPOP; } -{le} {yylval.val = LEQ; return CMPOP; } -{equals} {yylval.val = EQ; return CMPOP; } -{not_equals} {yylval.val = NEQ; return CMPOP; } +{gt} {yylval.val = GT; return CMPOP; } +{lt} {yylval.val = LT; return CMPOP; } +{ge} {yylval.val = GEQ; return CMPOP; } +{le} {yylval.val = LEQ; return CMPOP; } +{equals} {yylval.val = EQ; return CMPOP; } +{not_equals} {yylval.val = NEQ; return CMPOP; } {equal} { return EQUAL; } {doc} {} {end} { return END; } @@ -239,8 +246,8 @@ doc "///" {arrow} { return ARROW; } {divide} { return DIVIDE; } -{var} { return VAR; } -{code} { return CODE; } +{var} { yytext += 1; return VAR; } +{code} { yytext += 1; return CODE; } {choice_ident} { return CHOICEIDENT; } {value_ident} { return VALUEIDENT; } {set_ident} { return SETIDENT; } diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index d2afd0326..7fe124ad2 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -102,7 +102,7 @@ impl Iterator for Lexer { YyToken::Var => { let out = ffi::yyget_text(self.scanner); - CStr::from_ptr(out.offset(1)) + CStr::from_ptr(out) .to_str().ok() .and_then(|s: &str| Some(Token::Var(s.to_owned()))) }, @@ -111,7 +111,7 @@ impl Iterator for Lexer { let len = libc::strlen(out)-1; *out.offset(len as _) = b'\0' as _; - CStr::from_ptr(out.offset(1)) + CStr::from_ptr(out) .to_str().ok() .and_then(|s: &str| Some(Token::Code(s.to_owned()))) }, @@ -147,7 +147,6 @@ impl Iterator for Lexer { YyToken::And => Some(Token::And), YyToken::CmpOp => Some(Token::CmpOp(yylval.cmp_op)), YyToken::Equal => Some(Token::Equal), -// YyToken::Doc => Some(Token::Doc), YyToken::End => Some(Token::End), YyToken::Symmetric => Some(Token::Symmetric), YyToken::AntiSymmetric => Some(Token::AntiSymmetric), @@ -155,8 +154,13 @@ impl Iterator for Lexer { YyToken::Divide => Some(Token::Divide), YyToken::EOF => None, YyToken::Doc => { - None + let out = ffi::yyget_text(self.scanner); + + CStr::from_ptr(out) + .to_str().ok() + .and_then(|s: &str| Some(Token::Doc(s.to_owned()))) }, + } } } diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index 85c93ac91..ca2679415 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -251,3 +251,11 @@ fn comment_mode() { assert_eq!(Lexer::from(b"/* comment */ ".to_vec()).collect::>(), vec![]); assert_eq!(Lexer::from(b"/* comment \n comment */ ".to_vec()).collect::>(), vec![]); } + +#[test] +fn doc_mode() { + // Doc's Token + assert_eq!(Lexer::from(b"/// comment".to_vec()).collect::>(), vec![ + Token::Doc(String::from(" comment")) + ]); +} From 12d8251893a5bde9babb32b40488fee6fc7197e9 Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 25 Apr 2018 16:16:42 +0200 Subject: [PATCH 15/70] Blank Token as mute (not needed by Gen) --- telamon-gen/src/exh.l | 10 ++++------ telamon-gen/src/lexer/ffi.rs | 1 - telamon-gen/src/lexer/mod.rs | 18 +++++++----------- telamon-gen/tests/lexer.rs | 2 -- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index d653d487d..0bbdc7ce4 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -11,7 +11,6 @@ } yylval; enum token { - BLANK, VALUEIDENT, CHOICEIDENT, VAR, @@ -174,15 +173,16 @@ value_ident [A-Z][A-Z_0-9]* set_ident [A-Z][A-Za-z_0-9]* var \${alpha_num}+ code \"[^\n\"]*\" -doc "///" /* https://github.com/a-haas/Compilation/blob/6fe46a65d64decdb648feba790bb7b1d2980ca0a/yacc/setparser.l */ /* 6 Patterns § http://westes.github.io/flex/manual/Patterns.html#Patterns */ %% -{c_comment_beg} {BEGIN(C_COMMENT);} -{c_comment_end} {BEGIN(INITIAL);} +{blank} {} + +{c_comment_beg} { BEGIN(C_COMMENT); } +{c_comment_end} { BEGIN(INITIAL); } . {} {outer_line_doc} { yytext += 3;return DOC;} @@ -239,7 +239,6 @@ doc "///" {equals} {yylval.val = EQ; return CMPOP; } {not_equals} {yylval.val = NEQ; return CMPOP; } {equal} { return EQUAL; } -{doc} {} {end} { return END; } {symmetric} { return SYMMETRIC; } {antisymmetric} { return ANTISYMMETRIC; } @@ -251,7 +250,6 @@ doc "///" {choice_ident} { return CHOICEIDENT; } {value_ident} { return VALUEIDENT; } {set_ident} { return SETIDENT; } -{blank} { return BLANK; } <> { return EOF; } . { return INVALIDTOKEN; } %% diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index 361bdc01a..2f33c31f9 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -20,7 +20,6 @@ pub union YyLval { #[derive(Copy, Clone, Debug)] #[repr(C)] pub enum YyToken { - Blank, ValueIdent, ChoiceIdent, Var, diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index 7fe124ad2..9f873f114 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -68,7 +68,6 @@ impl Iterator for Lexer { fn next(&mut self) -> Option { unsafe { match yylex(self.scanner) { - YyToken::Blank => self.next(), YyToken::InvalidToken => { let out = ffi::yyget_text(self.scanner); @@ -76,8 +75,6 @@ impl Iterator for Lexer { .to_str().ok() .and_then(|s: &str| Some(Token::InvalidToken(s.to_owned()))) }, - YyToken::Blank => None, - // C_CommentBeg YyToken::ChoiceIdent => { let out = ffi::yyget_text(self.scanner); @@ -115,6 +112,13 @@ impl Iterator for Lexer { .to_str().ok() .and_then(|s: &str| Some(Token::Code(s.to_owned()))) }, + YyToken::Doc => { + let out = ffi::yyget_text(self.scanner); + + CStr::from_ptr(out) + .to_str().ok() + .and_then(|s: &str| Some(Token::Doc(s.to_owned()))) + }, YyToken::Alias => Some(Token::Alias), YyToken::Counter => Some(Token::Counter), YyToken::Define => Some(Token::Define), @@ -153,14 +157,6 @@ impl Iterator for Lexer { YyToken::Arrow => Some(Token::Arrow), YyToken::Divide => Some(Token::Divide), YyToken::EOF => None, - YyToken::Doc => { - let out = ffi::yyget_text(self.scanner); - - CStr::from_ptr(out) - .to_str().ok() - .and_then(|s: &str| Some(Token::Doc(s.to_owned()))) - }, - } } } diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index ca2679415..460d0e343 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -5,8 +5,6 @@ use telamon_gen::ir::{CounterKind, CounterVisibility, SetDefKey, CmpOp}; #[test] fn initial() { - // Blank - assert_eq!(Lexer::from(b" ".to_vec()).collect::>(), vec![]); // Invalid's Token assert_eq!(Lexer::from(b"!".to_vec()).collect::>(), vec![ Token::InvalidToken(String::from("!")), From a16802389113518cf9c32bf7a04559035b049f5c Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 25 Apr 2018 16:45:05 +0200 Subject: [PATCH 16/70] mute c warning of generated by f/lex's unused variables --- telamon-gen/build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/telamon-gen/build.rs b/telamon-gen/build.rs index ad96b096d..ee803c4be 100644 --- a/telamon-gen/build.rs +++ b/telamon-gen/build.rs @@ -16,6 +16,7 @@ fn main() { cc::Build::new() .file("exh.c") + .flag("-Wunused-parameter") .compile("exh.a"); // Compile the parser. From c428e28e4a1f36e9c63ecdcfe2fa1da140c8b0bd Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 25 Apr 2018 16:45:52 +0200 Subject: [PATCH 17/70] remove unnecessary ffi prefix --- telamon-gen/src/lexer/mod.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index 9f873f114..767316a06 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -15,7 +15,6 @@ use self::ffi::{ YyScan, YyBufferState, yylex_init, - yy_scan_buffer, yy_scan_bytes, yy_delete_buffer, yylex_destroy, @@ -69,42 +68,42 @@ impl Iterator for Lexer { unsafe { match yylex(self.scanner) { YyToken::InvalidToken => { - let out = ffi::yyget_text(self.scanner); + let out = yyget_text(self.scanner); CStr::from_ptr(out) .to_str().ok() .and_then(|s: &str| Some(Token::InvalidToken(s.to_owned()))) }, YyToken::ChoiceIdent => { - let out = ffi::yyget_text(self.scanner); + let out = yyget_text(self.scanner); CStr::from_ptr(out) .to_str().ok() .and_then(|s: &str| Some(Token::ChoiceIdent(s.to_owned()))) }, YyToken::SetIdent => { - let out = ffi::yyget_text(self.scanner); + let out = yyget_text(self.scanner); CStr::from_ptr(out) .to_str().ok() .and_then(|s: &str| Some(Token::SetIdent(s.to_owned()))) }, YyToken::ValueIdent => { - let out = ffi::yyget_text(self.scanner); + let out = yyget_text(self.scanner); CStr::from_ptr(out) .to_str().ok() .and_then(|s: &str| Some(Token::ValueIdent(s.to_owned()))) }, YyToken::Var => { - let out = ffi::yyget_text(self.scanner); + let out = yyget_text(self.scanner); CStr::from_ptr(out) .to_str().ok() .and_then(|s: &str| Some(Token::Var(s.to_owned()))) }, YyToken::Code => { - let out = ffi::yyget_text(self.scanner); + let out = yyget_text(self.scanner); let len = libc::strlen(out)-1; *out.offset(len as _) = b'\0' as _; @@ -113,7 +112,7 @@ impl Iterator for Lexer { .and_then(|s: &str| Some(Token::Code(s.to_owned()))) }, YyToken::Doc => { - let out = ffi::yyget_text(self.scanner); + let out = yyget_text(self.scanner); CStr::from_ptr(out) .to_str().ok() From bf84ae3fb7ee8b4e7569a023a2e7945f1c4120d4 Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 25 Apr 2018 17:14:21 +0200 Subject: [PATCH 18/70] allow dead code for ffi --- telamon-gen/src/lexer/ffi.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index 2f33c31f9..f4b652220 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -1,3 +1,4 @@ +#![allow(dead_code)] use ::libc; use ::ir; From 05ab085df38fc6cacccf813a90f352b2405e354e Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 25 Apr 2018 17:15:08 +0200 Subject: [PATCH 19/70] allow unused {function,variable,parameter} for {F/lex,C} --- telamon-gen/build.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/telamon-gen/build.rs b/telamon-gen/build.rs index ee803c4be..d1181e722 100644 --- a/telamon-gen/build.rs +++ b/telamon-gen/build.rs @@ -16,7 +16,9 @@ fn main() { cc::Build::new() .file("exh.c") - .flag("-Wunused-parameter") + .flag("-Wno-unused-parameter") + .flag("-Wno-unused-variable") + .flag_if_supported("-Wno-unused-function") .compile("exh.a"); // Compile the parser. From 8b5294b194c07e60e851b1bc2bb020ed682d1059 Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 26 Apr 2018 13:29:01 +0200 Subject: [PATCH 20/70] fixe dependency gcc as cc, see issue #3 --- Cargo.toml | 2 +- build.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5dcb7f787..fdaa741d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ path = "examples/sgemm_low.rs" required-features = ["cuda"] [build-dependencies] -gcc = "0.3.54" +cc = "1.0" [build-dependencies.telamon-gen] path = "telamon-gen" diff --git a/build.rs b/build.rs index d5423aad4..cdd1b4ddd 100644 --- a/build.rs +++ b/build.rs @@ -1,5 +1,5 @@ //! Rust script to compile non-rust files. -extern crate gcc; +extern crate cc; extern crate telamon_gen; use std::path::Path; @@ -11,10 +11,10 @@ fn add_dependency(dep: &str) { println!("cargo:rerun-if-changed={}", dep); } /// Compiles and links the cuda wrapper and libraries. fn compile_link_cuda() { - gcc::Build::new() - .flag("-Werror") - .file("src/device/cuda/api/wrapper.c") - .compile("libdevice_cuda_wrapper.a"); + cc::Build::new() + .flag("-Werror") + .file("src/device/cuda/api/wrapper.c") + .compile("libdevice_cuda_wrapper.a"); add_dependency("src/device/cuda/api/wrapper.c"); add_lib("cuda"); add_lib("curand"); From 8d2387c721d84a61c46fae115d66f61d9b774f6a Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 26 Apr 2018 13:30:42 +0200 Subject: [PATCH 21/70] rewrite DOC token with a start condition --- telamon-gen/src/exh.l | 22 ++++++++++++---------- telamon-gen/tests/lexer.rs | 16 +++++++++++++++- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index 0bbdc7ce4..57ca2ff8a 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -2,6 +2,7 @@ %option noyywrap %x C_COMMENT +%x LINE_DOC %{ #include @@ -102,14 +103,14 @@ alpha [a-zA-Z_] alpha_num {alpha}|{num} whitespace [ \t\r\n]+ -comment "//"[^/\n][^\n]*|"//" -blank {whitespace}|{comment} +blank {whitespace} c_comment_beg "/*" c_comment_end "*/" -outer_line_doc "///".* -line_comment "//".* +outer_line_doc "///" +line_comment "//" +doc {outer_line_doc}|{line_comment} alias "alias" counter "counter" @@ -179,14 +180,15 @@ code \"[^\n\"]*\" /* 6 Patterns § http://westes.github.io/flex/manual/Patterns.html#Patterns */ %% -{blank} {} - {c_comment_beg} { BEGIN(C_COMMENT); } {c_comment_end} { BEGIN(INITIAL); } . {} -{outer_line_doc} { yytext += 3;return DOC;} -{line_comment} { yytext += 2;return DOC;} +{doc} { BEGIN(LINE_DOC); } +\n { BEGIN(INITIAL); } +[^\n]* { return DOC; } + +{blank} {} {alias} { return ALIAS; } {counter} { return COUNTER; } @@ -245,8 +247,8 @@ code \"[^\n\"]*\" {arrow} { return ARROW; } {divide} { return DIVIDE; } -{var} { yytext += 1; return VAR; } -{code} { yytext += 1; return CODE; } +{var} { yytext++; return VAR; } +{code} { yytext++; return CODE; } {choice_ident} { return CHOICEIDENT; } {value_ident} { return VALUEIDENT; } {set_ident} { return SETIDENT; } diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index 460d0e343..fa8c7b111 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -252,8 +252,22 @@ fn comment_mode() { #[test] fn doc_mode() { - // Doc's Token + // Outer Line Doc's Token assert_eq!(Lexer::from(b"/// comment".to_vec()).collect::>(), vec![ Token::Doc(String::from(" comment")) ]); + // Outer Line MultiDoc's Token + assert_eq!(Lexer::from(b"/// comment \n /// comment".to_vec()).collect::>(), vec![ + Token::Doc(String::from(" comment ")), + Token::Doc(String::from(" comment")) + ]); + // Line Comment Doc's Token + assert_eq!(Lexer::from(b"// comment".to_vec()).collect::>(), vec![ + Token::Doc(String::from(" comment")) + ]); + // Line Comment MultiDoc's Token + assert_eq!(Lexer::from(b"// comment \n // comment".to_vec()).collect::>(), vec![ + Token::Doc(String::from(" comment ")), + Token::Doc(String::from(" comment")) + ]); } From e054856559edb3f31cb399762093fef826291d5c Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 26 Apr 2018 17:39:51 +0200 Subject: [PATCH 22/70] fixe // comment --- telamon-gen/src/parser.lalrpop | 8 +++++++- telamon-gen/tests/lexer.rs | 3 --- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/telamon-gen/src/parser.lalrpop b/telamon-gen/src/parser.lalrpop index 4c12f8747..81b6961aa 100644 --- a/telamon-gen/src/parser.lalrpop +++ b/telamon-gen/src/parser.lalrpop @@ -138,6 +138,12 @@ choice_instance: ast::ChoiceInstance = { }, }; +doc: String = { + )+> => { + lines.concat() + } +}; + #[inline] non_empty_list: Vec = { SEP)*> => { @@ -158,7 +164,7 @@ extern { set_ident => Token::SetIdent(), var => Token::Var(), code => Token::Code(), - doc => Token::Doc(), + doc_line => Token::Doc(), boolean => Token::Bool(), counter_kind => Token::CounterKind(), cmp_op => Token::CmpOp(), diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index fa8c7b111..66d1b8f84 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -263,11 +263,8 @@ fn doc_mode() { ]); // Line Comment Doc's Token assert_eq!(Lexer::from(b"// comment".to_vec()).collect::>(), vec![ - Token::Doc(String::from(" comment")) ]); // Line Comment MultiDoc's Token assert_eq!(Lexer::from(b"// comment \n // comment".to_vec()).collect::>(), vec![ - Token::Doc(String::from(" comment ")), - Token::Doc(String::from(" comment")) ]); } From 2493f7f0a1e31920bf5411e0c701f7334349d711 Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 26 Apr 2018 17:40:33 +0200 Subject: [PATCH 23/70] retarget test for cc_test --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 91bc49405..cbb9dd4c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,8 @@ script: - cargo build --verbose - cargo test --verbose - cargo doc --verbose + - cd cc_tests + - cargo test --verbose deploy: - provider: pages local-dir: target/doc From d29bc3b82fcb2703bab9b59e7e8296b5b97d4d1d Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 26 Apr 2018 17:49:34 +0200 Subject: [PATCH 24/70] comment rule --- telamon-gen/src/exh.l | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index 57ca2ff8a..1055da29a 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -103,14 +103,13 @@ alpha [a-zA-Z_] alpha_num {alpha}|{num} whitespace [ \t\r\n]+ -blank {whitespace} +comment "//"[^/\n][^\n]*|"//" +blank {comment}|{whitespace} c_comment_beg "/*" c_comment_end "*/" -outer_line_doc "///" -line_comment "//" -doc {outer_line_doc}|{line_comment} +doc "///" alias "alias" counter "counter" From c9e49e6a3fe23eace2673e3bf33d4f41acf42620 Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 26 Apr 2018 17:50:26 +0200 Subject: [PATCH 25/70] ast doc recursive concat --- telamon-gen/src/ast.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/telamon-gen/src/ast.rs b/telamon-gen/src/ast.rs index 78217a591..adcc33a10 100644 --- a/telamon-gen/src/ast.rs +++ b/telamon-gen/src/ast.rs @@ -10,6 +10,7 @@ use std::collections::{BTreeSet, hash_map}; use utils::*; /// Syntaxic tree for the constraint description. +#[derive(Debug)] pub struct Ast { pub statements: Vec } impl Ast { From 341c17b769fe60f02f1ee376915e01a47d60e499 Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 26 Apr 2018 18:37:21 +0200 Subject: [PATCH 26/70] enable all compilation --- .travis.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index cbb9dd4c2..9e908b9e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,12 +10,10 @@ addons: before_script: - flex --version script: - - cd telamon-gen - - cargo build --verbose - - cargo test --verbose - - cargo doc --verbose - - cd cc_tests - - cargo test --verbose + - cargo build --verbose --all + - cargo test --verbose --all + - cargo doc --verbose --all + deploy: - provider: pages local-dir: target/doc From a22991c82e7beea042dbeef9fad3b9440fa59434 Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 26 Apr 2018 19:38:28 +0200 Subject: [PATCH 27/70] prepare travis PR --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9e908b9e0..144f1bf9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: rust cache: cargo sudo: false rust: - - nightly + - nightly addons: apt: packages: @@ -13,7 +13,6 @@ script: - cargo build --verbose --all - cargo test --verbose --all - cargo doc --verbose --all - deploy: - provider: pages local-dir: target/doc @@ -25,8 +24,8 @@ notifications: slack: rooms: secure: bhOU59RYPbvA8GXYtL4JTGjKRbrOFyni2wjAV0gWQqwP9lkzYWlYDlsoHOFIR+DLhwN0Or2d5Sw47Ic3NLGrzhPOFcXNBhoRUy4QBUPWaKETEJbqjG/UvYRbfGr7ajosQdL1pDMuem8NFXdNcSCgnHu9Wgtim1EjO82rdc4YGPSCcHkfHpCncM435vXcDhtdz/ks9pF4igmJH0frhXTAkngckggaR2xx1cUAlrc4ztc03goe+uFC3Iti1QAp2DGMFx9hLvV1CjATeqSA4/65idUS0aEWccK2tNwLjp3nL3LAwwymCr4OWS8wCD0p1lk3Fvcc3FTX2fw6TfGciaFNCwAO+0FD5tJD+Uez+QllN4cufKrbwQo9ZlRP0fFsx38QJ1FeK8k/uk0hR7MzqypzkCNwG6NBI98L71P2sFvA15gELuI9sWhx655PwFzmjNwYw/zCeimp9pi+bNbYoWjckkwbN7ArwJjPt47vv/bIJbo/NrmNxFghZm4RTQW45prolMUqGO9AeIMf7oP24pPdEv3v9oH7lF/97tCBLt9Nd7LhwizK6nG/VFFCofwdIfBqlGDwJufN3UoMqVezkHqRuZa+tDgU9SuUrfAe1XnAc1+HbDzza55LM+3tzHn4sPr1jmlLIEHww2Yub4GpxBJYl+8MhusRbGhedqtpqeLk3LE= - on_success: change - on_failure: change + on_success: change + on_failure: change env: global: secure: ZLjUSECDu2ewLa2eJ8DepE7b3tuQxR81tbUxFtSBKKj6IVZPppzS7CUcVZxE46Xp+pug9KKApACOfqfqil5hRaSHKtqoVoOf/sYPJs+xA3JdmVBmqVYj0YViCA5WCxVU1J5BIEDVLTqJy7y3zBy8OYP2fNquNLEBUL7r0jn/+tjbuZfrwzN2PUqL/l7YyQVT/UgdpaXzVkvAcjGEL4nXpcSLb+a0g49PSQNcJhoLiYoZziUZH6buKllBzyBszBk4f/yO+wrvs334FaVw0DBbngIyUcQyzJT56eck22AJXlTl88DpJOUPakFTTJ1oa7UG6MTD46QMp2F/LK+ASNXwT5Q1OIsk67/CltZiWLXGBmdaAX2CJXor5vClNX3kEs0jCVCxMAOwfCmbTAz9cklb0rsoHXWYO3E39L3JhcVeZjwIvfI31d1cFrTjEwIVnUBQLmPYJyp9ndjc4kj7X/NUwD9SqrquIoEDW6mtCHlGmIDnkMJYQXNEwnoenFsSA+nbq9f/zoZVYUxmPYmRyHTCSNHVABUKYp3sK7HsRREwYwLm5slADH+K5loNYcxPgVJuH+mP7SAnJ6A8BTe4qxZK/bxjGr3ltSumWN2Ao9eC+PiAxG2QXGXHNeBtnrX0QxGkYZ5hjZndfAovjxjSsQ1kObnOOdwCSw4V93zFNzHthOQ= From 7500bf92fe7cce7ca7ec6db59b6f5639f57eca6a Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 26 Apr 2018 20:00:32 +0200 Subject: [PATCH 28/70] add feature lex, need this feature to generate the lexer, or else a default lexer will be used --- Cargo.toml | 2 + telamon-gen/Cargo.toml | 3 + telamon-gen/build.rs | 20 +- telamon-gen/exh.c | 2504 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 2522 insertions(+), 7 deletions(-) create mode 100644 telamon-gen/exh.c diff --git a/Cargo.toml b/Cargo.toml index fdaa741d0..669ed6e65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -86,6 +86,8 @@ cuda = [] default = [] format_exh = [] mppa = [] +lex = [] + [profile.bench] [profile.release] diff --git a/telamon-gen/Cargo.toml b/telamon-gen/Cargo.toml index 47ef54f98..ed1314de0 100644 --- a/telamon-gen/Cargo.toml +++ b/telamon-gen/Cargo.toml @@ -4,6 +4,9 @@ build = "build.rs" name = "telamon-gen" version = "1.0.0" +[features] +lex = [] + [[bin]] doc = false name = "cli_gen" diff --git a/telamon-gen/build.rs b/telamon-gen/build.rs index d1181e722..3c0d29088 100644 --- a/telamon-gen/build.rs +++ b/telamon-gen/build.rs @@ -1,18 +1,24 @@ extern crate cc; extern crate lalrpop; -use std::process::Command; /// Adds a dependency to the build script. fn add_dependency(dep: &str) { println!("cargo:rerun-if-changed={}", dep); } fn main() { - // Compile the lexer. - Command::new("flex") - .arg("-oexh.c") - .arg("src/exh.l") - .status() - .expect("failed to execute Flex's process"); + // Compile the lexer.(`LEX="flex" cargo build --features "lex"`) + #[cfg(feature = "lex")] + { + use std::{env,process::Command}; + + let bin = env::var("LEX").unwrap_or(String::from("flex")); + + Command::new(bin) + .arg("-oexh.c") + .arg("src/exh.l") + .status() + .expect("failed to execute Flex's process"); + } cc::Build::new() .file("exh.c") diff --git a/telamon-gen/exh.c b/telamon-gen/exh.c new file mode 100644 index 000000000..530b75460 --- /dev/null +++ b/telamon-gen/exh.c @@ -0,0 +1,2504 @@ +#line 2 "exh.c" + +#line 4 "exh.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 39 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void yypop_buffer_state (yyscan_t yyscanner ); + +static void yyensure_buffer_stack (yyscan_t yyscanner ); +static void yy_load_buffer_state (yyscan_t yyscanner ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); + +void *yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void yyfree (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap(yyscanner) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 68 +#define YY_END_OF_BUFFER 69 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[256] = + { 0, + 0, 0, 0, 0, 6, 6, 69, 67, 7, 7, + 67, 67, 67, 67, 45, 46, 44, 67, 61, 43, + 51, 56, 50, 65, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 47, 3, 68, 3, 6, 5, 7, 55, + 0, 63, 62, 49, 60, 1, 7, 53, 54, 52, + 65, 66, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 13, 14, 64, 64, + 64, 64, 37, 64, 64, 64, 64, 64, 64, 64, + 64, 48, 2, 6, 7, 4, 64, 64, 64, 64, + + 64, 64, 64, 57, 64, 64, 64, 64, 64, 64, + 64, 64, 16, 64, 15, 64, 64, 64, 36, 64, + 19, 64, 64, 64, 64, 64, 64, 7, 64, 64, + 64, 25, 64, 64, 64, 11, 64, 64, 64, 23, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 41, 64, 64, 21, 64, 8, 64, 64, + 64, 64, 42, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 20, 64, 64, + 64, 64, 10, 64, 12, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + + 64, 64, 9, 64, 64, 64, 28, 64, 64, 64, + 64, 64, 64, 17, 33, 64, 64, 22, 64, 64, + 64, 39, 64, 64, 24, 64, 64, 31, 27, 40, + 18, 38, 64, 64, 64, 64, 64, 30, 64, 26, + 58, 64, 34, 64, 64, 64, 32, 64, 64, 29, + 64, 64, 59, 35, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 4, 5, 1, 6, 1, 7, 1, 8, + 9, 10, 1, 11, 12, 1, 13, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 15, 1, 16, + 17, 18, 1, 1, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 1, 1, 1, 1, 20, 1, 21, 22, 23, 24, + + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 31, 1, 46, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[47] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 1, 1, 1, 1, 4, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 1 + } ; + +static yyconst flex_int16_t yy_base[265] = + { 0, + 0, 0, 44, 45, 285, 284, 286, 289, 47, 49, + 268, 279, 0, 276, 289, 289, 289, 264, 43, 289, + 264, 263, 262, 43, 34, 257, 242, 35, 242, 38, + 0, 254, 41, 233, 36, 247, 231, 246, 42, 232, + 248, 240, 221, 289, 289, 253, 0, 289, 67, 289, + 260, 289, 0, 289, 289, 289, 251, 289, 289, 289, + 58, 0, 0, 239, 233, 221, 221, 218, 232, 218, + 50, 224, 217, 219, 221, 232, 211, 0, 225, 217, + 205, 207, 0, 211, 42, 205, 60, 211, 56, 54, + 218, 289, 289, 0, 0, 289, 222, 220, 211, 214, + + 204, 208, 206, 0, 202, 195, 212, 199, 205, 61, + 205, 56, 0, 209, 0, 188, 186, 201, 0, 186, + 0, 191, 196, 197, 180, 200, 185, 0, 178, 178, + 177, 0, 175, 180, 178, 0, 187, 179, 190, 0, + 184, 163, 169, 186, 184, 169, 174, 173, 163, 175, + 174, 171, 0, 172, 160, 0, 160, 0, 149, 168, + 167, 162, 0, 158, 150, 148, 151, 152, 63, 145, + 162, 158, 144, 142, 140, 139, 153, 0, 139, 156, + 142, 136, 0, 139, 0, 131, 131, 145, 148, 143, + 122, 131, 135, 130, 138, 137, 126, 122, 121, 133, + + 118, 123, 0, 115, 118, 128, 0, 120, 111, 114, + 111, 109, 107, 107, 0, 119, 115, 0, 117, 117, + 116, 0, 115, 101, 0, 98, 112, 0, 0, 0, + 0, 0, 113, 106, 94, 93, 94, 0, 104, 0, + 0, 81, 0, 83, 74, 64, 0, 71, 74, 0, + 75, 56, 0, 0, 289, 103, 107, 111, 113, 115, + 92, 119, 123, 127 + } ; + +static yyconst flex_int16_t yy_def[265] = + { 0, + 255, 1, 256, 256, 257, 257, 255, 255, 255, 255, + 255, 258, 259, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 260, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 255, 255, 255, 255, 262, 255, 255, 255, + 258, 255, 259, 255, 255, 255, 263, 255, 255, 255, + 260, 260, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 255, 255, 262, 264, 255, 261, 261, 261, 261, + + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 264, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, + 261, 261, 261, 261, 0, 255, 255, 255, 255, 255, + 255, 255, 255, 255 + } ; + +static yyconst flex_int16_t yy_nxt[336] = + { 0, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 8, + 17, 18, 19, 8, 20, 21, 22, 23, 24, 8, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 31, + 31, 31, 34, 35, 36, 31, 37, 38, 39, 40, + 31, 41, 42, 31, 31, 43, 45, 45, 49, 49, + 49, 49, 56, 46, 46, 57, 61, 64, 72, 69, + 81, 61, 61, 70, 76, 65, 86, 66, 49, 49, + 82, 61, 73, 104, 77, 74, 61, 61, 117, 78, + 79, 120, 87, 118, 123, 125, 88, 141, 144, 190, + 105, 126, 121, 145, 63, 254, 124, 253, 252, 251, + + 142, 250, 191, 44, 44, 44, 44, 47, 47, 47, + 47, 51, 249, 51, 51, 53, 53, 62, 62, 94, + 248, 94, 94, 95, 247, 95, 95, 128, 246, 128, + 128, 245, 244, 243, 242, 241, 240, 239, 238, 237, + 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, + 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, + 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, + 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, + 196, 195, 194, 193, 192, 189, 188, 187, 186, 185, + 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, + + 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, + 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, + 154, 153, 152, 151, 150, 149, 148, 147, 146, 143, + 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, + 130, 129, 127, 122, 119, 116, 115, 114, 113, 112, + 111, 110, 109, 108, 107, 106, 103, 102, 101, 100, + 99, 98, 97, 96, 52, 93, 92, 91, 90, 89, + 85, 84, 83, 80, 75, 71, 68, 67, 60, 59, + 58, 55, 54, 52, 50, 255, 48, 48, 7, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255 + } ; + +static yyconst flex_int16_t yy_chk[336] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 3, 4, 9, 9, + 10, 10, 19, 3, 4, 19, 24, 25, 30, 28, + 35, 24, 24, 28, 33, 25, 39, 25, 49, 49, + 35, 61, 30, 71, 33, 30, 61, 61, 85, 33, + 33, 87, 39, 85, 89, 90, 39, 110, 112, 169, + 71, 90, 87, 112, 261, 252, 89, 251, 249, 248, + + 110, 246, 169, 256, 256, 256, 256, 257, 257, 257, + 257, 258, 245, 258, 258, 259, 259, 260, 260, 262, + 244, 262, 262, 263, 242, 263, 263, 264, 239, 264, + 264, 237, 236, 235, 234, 233, 227, 226, 224, 223, + 221, 220, 219, 217, 216, 214, 213, 212, 211, 210, + 209, 208, 206, 205, 204, 202, 201, 200, 199, 198, + 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, + 187, 186, 184, 182, 181, 180, 179, 177, 176, 175, + 174, 173, 172, 171, 170, 168, 167, 166, 165, 164, + 162, 161, 160, 159, 157, 155, 154, 152, 151, 150, + + 149, 148, 147, 146, 145, 144, 143, 142, 141, 139, + 138, 137, 135, 134, 133, 131, 130, 129, 127, 126, + 125, 124, 123, 122, 120, 118, 117, 116, 114, 111, + 109, 108, 107, 106, 105, 103, 102, 101, 100, 99, + 98, 97, 91, 88, 86, 84, 82, 81, 80, 79, + 77, 76, 75, 74, 73, 72, 70, 69, 68, 67, + 66, 65, 64, 57, 51, 46, 43, 42, 41, 40, + 38, 37, 36, 34, 32, 29, 27, 26, 23, 22, + 21, 18, 14, 12, 11, 7, 6, 5, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "src/exh.l" + + +#line 8 "src/exh.l" + #include + + union yylval { + int val; + } yylval; + + enum token { + VALUEIDENT, + CHOICEIDENT, + VAR, + DOC, + CMPOP, + INVALIDTOKEN, + CODE, + COUNTERKIND, + BOOL, + COUNTERVISIBILITY, + AND, + TRIGGER, + WHEN, + ALIAS, + COUNTER, + DEFINE, + ENUM, + EQUAL, + FORALL, + IN, + IS, + NOT, + REQUIRE, + REQUIRES, + VALUE, + END, + SYMMETRIC, + ANTISYMMETRIC, + ARROW, + COLON, + COMMA, + LPAREN, + RPAREN, + BITOR, + OR, + SETDEFKEY, + SET, + SUBSETOF, + SETIDENT, + BASE, + DISJOINT, + QUOTIENT, + OF, + DIVIDE, + }; + + // Indicates whether a counter sums or adds. + enum counter_kind { + ADD, + MUL, + }; + + // Indicates how a counter exposes how its maximum value. + // The variants are ordered by increasing amount of information available. + enum counter_visibility { + // Only the minimal value is computed and stored. + NOMAX, + // Both the min and max are stored, but only the min is exposed. + HIDDENMAX, + // Both the min and the max value are exposed. + FULL, + }; + + enum cmp_op { + LT, + GT, + LEQ, + GEQ, + EQ, + NEQ, + }; + + enum set_def_key { + ITEMTYPE, + IDTYPE, + ITEMGETTER, + IDGETTER, + ITER, + FROMSUPERSET, + PREFIX, + NEWOBJS, + REVERSE, + ADDTOSET, + }; +/* https://github.com/a-haas/Compilation/blob/6fe46a65d64decdb648feba790bb7b1d2980ca0a/yacc/setparser.l */ +/* 6 Patterns § http://westes.github.io/flex/manual/Patterns.html#Patterns */ +#line 689 "exh.c" + +#define INITIAL 0 +#define C_COMMENT 1 +#define LINE_DOC 2 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + yy_size_t yy_n_chars; + yy_size_t yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + +int yylex_init (yyscan_t* scanner); + +int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (yyscan_t yyscanner ); + +int yyget_debug (yyscan_t yyscanner ); + +void yyset_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *yyget_in (yyscan_t yyscanner ); + +void yyset_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *yyget_out (yyscan_t yyscanner ); + +void yyset_out (FILE * out_str ,yyscan_t yyscanner ); + +yy_size_t yyget_leng (yyscan_t yyscanner ); + +char *yyget_text (yyscan_t yyscanner ); + +int yyget_lineno (yyscan_t yyscanner ); + +void yyset_lineno (int line_number ,yyscan_t yyscanner ); + +int yyget_column (yyscan_t yyscanner ); + +void yyset_column (int column_no ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (yyscan_t yyscanner ); +#else +extern int yywrap (yyscan_t yyscanner ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (yyscan_t yyscanner); + +#define YY_DECL int yylex (yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + yy_load_buffer_state(yyscanner ); + } + + { +#line 180 "src/exh.l" + + +#line 946 "exh.c" + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 256 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 289 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 182 "src/exh.l" +{ BEGIN(C_COMMENT); } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 183 "src/exh.l" +{ BEGIN(INITIAL); } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 184 "src/exh.l" +{} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 186 "src/exh.l" +{ BEGIN(LINE_DOC); } + YY_BREAK +case 5: +/* rule 5 can match eol */ +YY_RULE_SETUP +#line 187 "src/exh.l" +{ BEGIN(INITIAL); } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 188 "src/exh.l" +{ return DOC; } + YY_BREAK +case 7: +/* rule 7 can match eol */ +YY_RULE_SETUP +#line 190 "src/exh.l" +{} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 192 "src/exh.l" +{ return ALIAS; } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 193 "src/exh.l" +{ return COUNTER; } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 194 "src/exh.l" +{ return DEFINE; } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 195 "src/exh.l" +{ return ENUM; } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 196 "src/exh.l" +{ return FORALL; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 197 "src/exh.l" +{ return IN; } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 198 "src/exh.l" +{ return IS; } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 199 "src/exh.l" +{ return NOT; } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 200 "src/exh.l" +{yylval.val = MUL; return COUNTERKIND; } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 201 "src/exh.l" +{ return REQUIRE; } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 202 "src/exh.l" +{ return REQUIRES; } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 203 "src/exh.l" +{yylval.val = ADD; return COUNTERKIND; } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 204 "src/exh.l" +{ return VALUE; } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 205 "src/exh.l" +{ return WHEN; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 206 "src/exh.l" +{ return TRIGGER; } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 207 "src/exh.l" +{yylval.val = NOMAX; return COUNTERVISIBILITY; } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 208 "src/exh.l" +{yylval.val = HIDDENMAX; return COUNTERVISIBILITY; } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 209 "src/exh.l" +{ return BASE; } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 211 "src/exh.l" +{yylval.val = ITEMTYPE; return SETDEFKEY; } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 212 "src/exh.l" +{yylval.val = NEWOBJS; return SETDEFKEY; } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 213 "src/exh.l" +{yylval.val = IDTYPE; return SETDEFKEY; } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 214 "src/exh.l" +{yylval.val = ITEMGETTER; return SETDEFKEY; } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 215 "src/exh.l" +{yylval.val = IDGETTER; return SETDEFKEY; } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 216 "src/exh.l" +{yylval.val = ITER; return SETDEFKEY; } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 217 "src/exh.l" +{yylval.val = PREFIX; return SETDEFKEY; } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 218 "src/exh.l" +{yylval.val = REVERSE; return SETDEFKEY; } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 219 "src/exh.l" +{yylval.val = ADDTOSET; return SETDEFKEY; } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 220 "src/exh.l" +{yylval.val = FROMSUPERSET; return SETDEFKEY; } + YY_BREAK +case 36: +YY_RULE_SETUP +#line 221 "src/exh.l" +{ return SET; } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 222 "src/exh.l" +{ return OF; } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 223 "src/exh.l" +{ return SUBSETOF; } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 224 "src/exh.l" +{ return DISJOINT; } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 225 "src/exh.l" +{ return QUOTIENT; } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 226 "src/exh.l" +{yylval.val = 1; return BOOL; } + YY_BREAK +case 42: +YY_RULE_SETUP +#line 227 "src/exh.l" +{yylval.val = 0; return BOOL; } + YY_BREAK +case 43: +YY_RULE_SETUP +#line 229 "src/exh.l" +{ return COLON; } + YY_BREAK +case 44: +YY_RULE_SETUP +#line 230 "src/exh.l" +{ return COMMA; } + YY_BREAK +case 45: +YY_RULE_SETUP +#line 231 "src/exh.l" +{ return LPAREN; } + YY_BREAK +case 46: +YY_RULE_SETUP +#line 232 "src/exh.l" +{ return RPAREN; } + YY_BREAK +case 47: +YY_RULE_SETUP +#line 233 "src/exh.l" +{ return BITOR; } + YY_BREAK +case 48: +YY_RULE_SETUP +#line 234 "src/exh.l" +{ return OR; } + YY_BREAK +case 49: +YY_RULE_SETUP +#line 235 "src/exh.l" +{ return AND; } + YY_BREAK +case 50: +YY_RULE_SETUP +#line 236 "src/exh.l" +{yylval.val = GT; return CMPOP; } + YY_BREAK +case 51: +YY_RULE_SETUP +#line 237 "src/exh.l" +{yylval.val = LT; return CMPOP; } + YY_BREAK +case 52: +YY_RULE_SETUP +#line 238 "src/exh.l" +{yylval.val = GEQ; return CMPOP; } + YY_BREAK +case 53: +YY_RULE_SETUP +#line 239 "src/exh.l" +{yylval.val = LEQ; return CMPOP; } + YY_BREAK +case 54: +YY_RULE_SETUP +#line 240 "src/exh.l" +{yylval.val = EQ; return CMPOP; } + YY_BREAK +case 55: +YY_RULE_SETUP +#line 241 "src/exh.l" +{yylval.val = NEQ; return CMPOP; } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 242 "src/exh.l" +{ return EQUAL; } + YY_BREAK +case 57: +YY_RULE_SETUP +#line 243 "src/exh.l" +{ return END; } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 244 "src/exh.l" +{ return SYMMETRIC; } + YY_BREAK +case 59: +YY_RULE_SETUP +#line 245 "src/exh.l" +{ return ANTISYMMETRIC; } + YY_BREAK +case 60: +YY_RULE_SETUP +#line 246 "src/exh.l" +{ return ARROW; } + YY_BREAK +case 61: +YY_RULE_SETUP +#line 247 "src/exh.l" +{ return DIVIDE; } + YY_BREAK +case 62: +YY_RULE_SETUP +#line 249 "src/exh.l" +{ yytext++; return VAR; } + YY_BREAK +case 63: +YY_RULE_SETUP +#line 250 "src/exh.l" +{ yytext++; return CODE; } + YY_BREAK +case 64: +YY_RULE_SETUP +#line 251 "src/exh.l" +{ return CHOICEIDENT; } + YY_BREAK +case 65: +YY_RULE_SETUP +#line 252 "src/exh.l" +{ return VALUEIDENT; } + YY_BREAK +case 66: +YY_RULE_SETUP +#line 253 "src/exh.l" +{ return SETIDENT; } + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(C_COMMENT): +case YY_STATE_EOF(LINE_DOC): +#line 254 "src/exh.l" +{ return EOF; } + YY_BREAK +case 67: +YY_RULE_SETUP +#line 255 "src/exh.l" +{ return INVALIDTOKEN; } + YY_BREAK +case 68: +YY_RULE_SETUP +#line 256 "src/exh.l" +ECHO; + YY_BREAK +#line 1351 "exh.c" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( yywrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + yy_size_t new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 256 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + register char *yy_cp = yyg->yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 256 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 255); + + (void)yyg; + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) +{ + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_cp = yyg->yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yyg->yy_hold_char; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register yy_size_t number_to_move = yyg->yy_n_chars + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + yyg->yytext_ptr = yy_bp; + yyg->yy_hold_char = *yy_cp; + yyg->yy_c_buf_p = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap(yyscanner ) ) + return EOF; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + yy_load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void yy_load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * @param yyscanner The scanner object. + */ + void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ,yyscanner ); + + yyfree((void *) b ,yyscanner ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(yyscanner); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void yypop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (yyscan_t yyscanner) +{ + yy_size_t num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + yy_size_t i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int yyget_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int yyget_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +yy_size_t yyget_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *yyget_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void yyset_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void yyset_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + YY_FATAL_ERROR( "yyset_column called with no buffer" ); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void yyset_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int yyget_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void yyset_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +/* User-visible API */ + +/* yylex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int yylex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* yylex_init_extra has the same functionality as yylex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to yyalloc in + * the yyextra field. + */ + +int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + yyset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + yyset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + yyfree(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + yyfree(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + yyfree ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size , yyscan_t yyscanner) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr , yyscan_t yyscanner) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 256 "src/exh.l" + + + From 86dd15ef7ab0dd118790c48d518bfbf557ade6f2 Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 26 Apr 2018 20:02:44 +0200 Subject: [PATCH 29/70] by default, travis will regenerate the lexer too --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 144f1bf9b..8e772cace 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,9 +10,10 @@ addons: before_script: - flex --version script: - - cargo build --verbose --all + - LEX="flex" cargo build --features "lex" --verbose --all - cargo test --verbose --all - cargo doc --verbose --all + deploy: - provider: pages local-dir: target/doc From d806c24aaabebe20a9f1608a0b4ca033a60da40e Mon Sep 17 00:00:00 2001 From: Ulysse Beaugnon Date: Fri, 27 Apr 2018 08:58:12 +0200 Subject: [PATCH 30/70] Update comment liking to lex doc. --- telamon-gen/src/exh.l | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index 1055da29a..cd24618cc 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -174,9 +174,7 @@ set_ident [A-Z][A-Za-z_0-9]* var \${alpha_num}+ code \"[^\n\"]*\" -/* https://github.com/a-haas/Compilation/blob/6fe46a65d64decdb648feba790bb7b1d2980ca0a/yacc/setparser.l */ - -/* 6 Patterns § http://westes.github.io/flex/manual/Patterns.html#Patterns */ +/* Patterns documentation: http://westes.github.io/flex/manual/Patterns.html#Patterns */ %% {c_comment_beg} { BEGIN(C_COMMENT); } From 0fe13017664e067be5f4a9a3fcca17df0fc1ca01 Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 2 May 2018 10:36:47 +0200 Subject: [PATCH 31/70] sync --- .gitignore | 3 +- .travis.yml | 23 +- Cargo.lock | 1832 ------------------------------- Cargo.toml | 22 +- kernels/Cargo.toml | 2 +- kernels/benches/cuda_bound.rs | 8 +- kernels/src/lib.rs | 2 +- kernels/src/linalg.rs | 2 +- kernels/tests/cuda.rs | 93 -- src/device/cuda/mem_model.rs | 6 +- src/explorer/candidate.rs | 9 +- src/lib.rs | 3 +- src/model/hw_pressure.rs | 4 + src/model/local_info.rs | 32 +- src/model/mod.rs | 68 ++ telamon-gen/Cargo.toml | 22 +- telamon-gen/cc_tests/Cargo.toml | 6 +- 17 files changed, 149 insertions(+), 1988 deletions(-) delete mode 100644 Cargo.lock diff --git a/.gitignore b/.gitignore index 8e64e12be..2daa9a2e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,7 @@ *.swp *.log +Cargo.lock examples/out/ -perf.data -perf.data.old target/ log/ settings/* diff --git a/.travis.yml b/.travis.yml index 8e772cace..5fae0f687 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: rust cache: cargo sudo: false rust: - - nightly + - nightly addons: apt: packages: @@ -10,23 +10,24 @@ addons: before_script: - flex --version script: - - LEX="flex" cargo build --features "lex" --verbose --all + - cd telamon-gen && LEX="flex" cargo build --features "lex" --verbose - cargo test --verbose --all - cargo doc --verbose --all - deploy: - - provider: pages - local-dir: target/doc - target-branch: gh-pages - skip-cleanup: true - keep-history: true - github-token: "$GITHUB_TOKEN" + provider: pages + local-dir: target/doc + target-branch: gh-pages + skip-cleanup: true + keep-history: true + github-token: "$GITHUB_TOKEN" + on: + branch: master notifications: slack: rooms: secure: bhOU59RYPbvA8GXYtL4JTGjKRbrOFyni2wjAV0gWQqwP9lkzYWlYDlsoHOFIR+DLhwN0Or2d5Sw47Ic3NLGrzhPOFcXNBhoRUy4QBUPWaKETEJbqjG/UvYRbfGr7ajosQdL1pDMuem8NFXdNcSCgnHu9Wgtim1EjO82rdc4YGPSCcHkfHpCncM435vXcDhtdz/ks9pF4igmJH0frhXTAkngckggaR2xx1cUAlrc4ztc03goe+uFC3Iti1QAp2DGMFx9hLvV1CjATeqSA4/65idUS0aEWccK2tNwLjp3nL3LAwwymCr4OWS8wCD0p1lk3Fvcc3FTX2fw6TfGciaFNCwAO+0FD5tJD+Uez+QllN4cufKrbwQo9ZlRP0fFsx38QJ1FeK8k/uk0hR7MzqypzkCNwG6NBI98L71P2sFvA15gELuI9sWhx655PwFzmjNwYw/zCeimp9pi+bNbYoWjckkwbN7ArwJjPt47vv/bIJbo/NrmNxFghZm4RTQW45prolMUqGO9AeIMf7oP24pPdEv3v9oH7lF/97tCBLt9Nd7LhwizK6nG/VFFCofwdIfBqlGDwJufN3UoMqVezkHqRuZa+tDgU9SuUrfAe1XnAc1+HbDzza55LM+3tzHn4sPr1jmlLIEHww2Yub4GpxBJYl+8MhusRbGhedqtpqeLk3LE= - on_success: change - on_failure: change + on_success: change + on_failure: change env: global: secure: ZLjUSECDu2ewLa2eJ8DepE7b3tuQxR81tbUxFtSBKKj6IVZPppzS7CUcVZxE46Xp+pug9KKApACOfqfqil5hRaSHKtqoVoOf/sYPJs+xA3JdmVBmqVYj0YViCA5WCxVU1J5BIEDVLTqJy7y3zBy8OYP2fNquNLEBUL7r0jn/+tjbuZfrwzN2PUqL/l7YyQVT/UgdpaXzVkvAcjGEL4nXpcSLb+a0g49PSQNcJhoLiYoZziUZH6buKllBzyBszBk4f/yO+wrvs334FaVw0DBbngIyUcQyzJT56eck22AJXlTl88DpJOUPakFTTJ1oa7UG6MTD46QMp2F/LK+ASNXwT5Q1OIsk67/CltZiWLXGBmdaAX2CJXor5vClNX3kEs0jCVCxMAOwfCmbTAz9cklb0rsoHXWYO3E39L3JhcVeZjwIvfI31d1cFrTjEwIVnUBQLmPYJyp9ndjc4kj7X/NUwD9SqrquIoEDW6mtCHlGmIDnkMJYQXNEwnoenFsSA+nbq9f/zoZVYUxmPYmRyHTCSNHVABUKYp3sK7HsRREwYwLm5slADH+K5loNYcxPgVJuH+mP7SAnJ6A8BTe4qxZK/bxjGr3ltSumWN2Ao9eC+PiAxG2QXGXHNeBtnrX0QxGkYZ5hjZndfAovjxjSsQ1kObnOOdwCSw4V93zFNzHthOQ= diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index cf9fdc46c..000000000 --- a/Cargo.lock +++ /dev/null @@ -1,1832 +0,0 @@ -[[package]] -name = "aho-corasick" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "aho-corasick" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "arrayvec" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ascii-canvas" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "atty" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "atty" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bincode" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bit-set" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bit-vec" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bitflags" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bitflags" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "boxfnonce" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "byteorder" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bytes" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cfg-if" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "compare" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "config" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde-hjson 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "crossbeam-deque" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-epoch 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-deque" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-epoch 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-utils" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-utils" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "csv" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cuda-sys" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "data_structure_traits" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "hashmap_core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "diff" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "docopt" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "dtoa" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "either" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "ena" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "encode_unicode" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "env_logger" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "env_logger" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "errno" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "extprim" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fixedbitset" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "fnv" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "futures" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "futures" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-stable 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-channel" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-core" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-executor" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-io" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-sink" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-stable" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "pin-api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-util" -version = "0.2.0-beta" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "gcc" -version = "0.3.54" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "getopts" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "handlebars" -version = "0.28.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "hashmap_core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "humantime" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "immut_list" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "data_structure_traits 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "interval-heap" -version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "compare 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "iovec" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ipc-channel" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "uuid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itertools" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itertools" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itertools" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itoa" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lalrpop" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-intern 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-snap 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-util 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "petgraph 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lalrpop-intern" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "lalrpop-snap" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-intern 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-util 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "petgraph 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lalrpop-util" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "lazy_static" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "lazy_static" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "lazycell" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.2.40" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "linked-hash-map" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "linked-hash-map" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "linked-list" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "log" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "matches" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "matrixmultiply" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rawpointer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memchr" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memchr" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memchr" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memoffset" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "mio" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "miow" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ndarray" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "matrixmultiply 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "net2" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "nix" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "nodrop" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "nom" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-bigint" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-complex" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-integer" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-iter" -version = "0.1.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-rational" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-traits" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-traits" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "num_cpus" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ordermap" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "owning_ref" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "parking_lot" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "parking_lot_core" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pbr" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pest" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "petgraph" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fixedbitset 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pin-api" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "prctl" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "prettytable-rs" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "encode_unicode 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quick-error" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "quote" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.3.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rawpointer" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rayon" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rayon-core" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "redox_syscall" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "redox_termios" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex" -version = "0.1.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex-syntax" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "regex-syntax" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "regex-syntax" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "remove_dir_all" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc_version" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustfmt" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", - "strings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustlex" -version = "0.3.3" -source = "git+https://github.com/ulysseB/rustlex.git#86116c3c8e95b064bd53bf2ce00b7456f0f83dec" -dependencies = [ - "rustlex_codegen 0.3.3 (git+https://github.com/ulysseB/rustlex.git)", -] - -[[package]] -name = "rustlex_codegen" -version = "0.3.3" -source = "git+https://github.com/ulysseB/rustlex.git#86116c3c8e95b064bd53bf2ce00b7456f0f83dec" -dependencies = [ - "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rustlex_fsa 0.3.3 (git+https://github.com/ulysseB/rustlex.git)", -] - -[[package]] -name = "rustlex_fsa" -version = "0.3.3" -source = "git+https://github.com/ulysseB/rustlex.git#86116c3c8e95b064bd53bf2ce00b7456f0f83dec" -dependencies = [ - "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "scopeguard" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde-hjson" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_derive" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive_internals 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_derive_internals" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_json" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_test" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "slab" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "slab" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "smallvec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "stable_deref_trait" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "std-semaphore" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "strings" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "strsim" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "syn" -version = "0.12.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syntex_errors" -version = "0.59.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syntex_pos" -version = "0.59.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syntex_syntax" -version = "0.59.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "extprim 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "telamon" -version = "0.2.0" -dependencies = [ - "boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "config 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "data_structure_traits 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", - "errno 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "immut_list 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "interval-heap 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ipc-channel 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "linked-list 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "ndarray 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "pbr 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "prctl 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "prettytable-rs 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "std-semaphore 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "telamon-gen 1.0.0", - "telamon-utils 1.0.0", - "tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.0 (git+https://github.com/ulysseB/tokio-timer.git)", -] - -[[package]] -name = "telamon-gen" -version = "1.0.0" -dependencies = [ - "env_logger 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", - "handlebars 0.28.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-util 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rustfmt 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustlex 0.3.3 (git+https://github.com/ulysseB/rustlex.git)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)", - "telamon-utils 1.0.0", - "topological-sort 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "telamon-gen-test" -version = "0.1.0" -dependencies = [ - "env_logger 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "telamon-gen 1.0.0", - "telamon-utils 1.0.0", -] - -[[package]] -name = "telamon-kernels" -version = "0.1.0" -dependencies = [ - "cuda-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "ndarray 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "telamon 0.2.0", - "telamon-utils 1.0.0", -] - -[[package]] -name = "telamon-utils" -version = "1.0.0" -dependencies = [ - "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "linked-list 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tempdir" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "term" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "termcolor" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "termion" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread-id" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread_local" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread_local" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "time" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-executor" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-io" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-reactor" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-threadpool" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-timer" -version = "0.2.0" -source = "git+https://github.com/ulysseB/tokio-timer.git#0dfa8c024eeb34bd8cfa84b4ecbd5baf9c108fab" -dependencies = [ - "futures 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "toml" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "topological-sort" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "ucd-util" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-segmentation" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-width" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "utf8-ranges" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "utf8-ranges" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "uuid" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wincolor" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "yaml-rust" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" -"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4" -"checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" -"checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2" -"checksum atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d0fd4c0631f06448cc45a6bbb3b710ebb7ff8ccb96a0800c994afe23a70d5df2" -"checksum atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "af80143d6f7608d746df1520709e5d141c96f240b0e62b0aa41bdfb53374d9d4" -"checksum bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bda13183df33055cbb84b847becce220d392df502ebe7a4a78d7021771ed94d0" -"checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c" -"checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f" -"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" -"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" -"checksum boxfnonce 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cbec60c560f322d8e3cd403f91d8908cfd965fff53ba97154bd1b9d90149d98e" -"checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23" -"checksum bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1b7db437d718977f6dc9b2e3fd6fc343c02ac6b899b73fdd2179163447bd9ce9" -"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" -"checksum compare 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ea0095f6103c2a8b44acd6fd15960c801dafebf02e21940360833e0673f48ba7" -"checksum config 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e595d1735d8ab6b04906bbdcfc671cce2a5e609b6f8e92865e67331cc2f41ba4" -"checksum crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24ce9782d4d5c53674646a6a4c1863a21a8fc0cb649b3c94dfc16e45071dea19" -"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" -"checksum crossbeam-deque 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c1bdc73742c36f7f35ebcda81dbb33a7e0d33757d03a06d9ddca762712ec5ea2" -"checksum crossbeam-epoch 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "59796cc6cbbdc6bb319161349db0c3250ec73ec7fcb763a51065ec4e2e158552" -"checksum crossbeam-epoch 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9b4e2817eb773f770dcb294127c011e22771899c21d18fce7dd739c0b9832e81" -"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" -"checksum crossbeam-utils 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d636a8b3bcc1b409d7ffd3facef8f21dcb4009626adbd0c5e6c4305c07253c7b" -"checksum csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7ef22b37c7a51c564a365892c012dc0271221fdcc64c69b19ba4d6fa8bd96d9c" -"checksum cuda-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b970b43ef51e0cee651d2e994cf8d3792bb49e03868d12dcb48194cb48017fc5" -"checksum data_structure_traits 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "98292bd3b24a11b38d7572cfaa03dc8ee8b7f8e800545edeb2a855d779224f1c" -"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" -"checksum docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab32ea6e284d87987066f21a9e809a73c14720571ef34516f0890b3d355ccfd8" -"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" -"checksum either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "740178ddf48b1a9e878e6d6509a1442a2d42fd2928aae8e7a6f8a36fb01981b3" -"checksum ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe5a5078ac8c506d3e4430763b1ba9b609b1286913e7d08e581d1c2de9b7e5" -"checksum encode_unicode 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c088ec0ed2282dcd054f2c124c0327f953563e6c75fdc6ff5141779596289830" -"checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" -"checksum env_logger 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "be27f8ea102a7182093a80d98f0b78623b580eda8791cbe8e2345fe6e57567a6" -"checksum errno 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b2c858c42ac0b88532f48fca88b0ed947cad4f1f64d904bcd6c9f138f7b95d70" -"checksum extprim 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb09b6eb24a48a5c57729e4a60980bf538b3662c3bcec04b6c7908d7a0f3d9b9" -"checksum fixedbitset 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "85cb8fec437468d86dc7c83ca7cfc933341d561873275f22dd5eedefa63a6478" -"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" -"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0bab5b5e94f5c31fc764ba5dd9ad16568aae5d4825538c01d6bca680c9bf94a7" -"checksum futures 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "45af3b9fb6f97c12f7a3af62e4c31df558931ae781834ead417abe04dcb9ec9f" -"checksum futures-channel 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "e3feaa3c573e6998c2d41dfb940482b76c1ef9b9150f6446cf5f12060b9a2ab8" -"checksum futures-core 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "90a83c1b1c895acbb7165f0057f6772523ca6df210730f74955c27449b5411cc" -"checksum futures-executor 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "936d1c79555e1cbd2dbc4b139420adb3a1ed64764779d8131d84045db26ddb92" -"checksum futures-io 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "05423a90af7b3fa6ca88034f0806553a59235b1a1098e32c4ffcbecf83f33045" -"checksum futures-sink 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "c99954270203f2c4c38cb8c0819648e8600eb5dbebd03f6ec35268f16bd98018" -"checksum futures-stable 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "d736f069fc69cb99ce13daebfa0bde4ade0a3b9703cd8b7c8ec38a8577bb45f0" -"checksum futures-util 0.2.0-beta (registry+https://github.com/rust-lang/crates.io-index)" = "674f3ba0fbc1e544de9776fb9d1c5c1cd72c5e17f1523e409a1c5642b57a734e" -"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb" -"checksum getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05" -"checksum handlebars 0.28.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1bed53dfb11098ec893ed54aa8b9828ffb98d28acbe56a49419935e5a8688ca9" -"checksum hashmap_core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "75919d1685421dc9ea9491c285bc0c0cf5525d166eec8a0f6d5462486d82ca89" -"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" -"checksum immut_list 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3629c418e9452f58ac93153b0409cba3f4f37594948db50e46b35f447ffaf035" -"checksum interval-heap 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "11274e5e8e89b8607cfedc2910b6626e998779b48a019151c7604d0adcb86ac6" -"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" -"checksum ipc-channel 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db9daf099728ac5390c73f54e6e3708f0c514d2b51f24373830f568702eadfca" -"checksum itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4833d6978da405305126af4ac88569b5d71ff758581ce5a987dbfa3755f694fc" -"checksum itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d3f2be4da1690a039e9ae5fd575f706a63ad5a2120f161b1d653c9da3930dd21" -"checksum itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450" -"checksum itoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92a9df60778f789c37f76778ae8d0a2471c41baa8b059d98a5873c978f549587" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lalrpop 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fe7e84d1b798674f26dd7f2e7c0c92b5736f77866dadcf59c64b949ff40d00" -"checksum lalrpop-intern 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8af84a2fa97bb57e285c56b8303645cefa17c92ad115c4d711b3b4ba5bc5c197" -"checksum lalrpop-snap 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "395696fe1022abe294978648249b5edd854395a199b0e9e5579c7fab47b807d0" -"checksum lalrpop-util 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9d51721b6a49a70a02c02862e27c57069878fa6bf6689c20b755a45efc8c67" -"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" -"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d" -"checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef" -"checksum libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)" = "6fd41f331ac7c5b8ac259b8bf82c75c0fb2e469bbf37d2becbba9a6a2221965b" -"checksum linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd" -"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e" -"checksum linked-list 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a4dacf969043dc69f1f731b5042eb05e030d264bcf34f2242889fcbdc7a65f06" -"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2" -"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" -"checksum matrixmultiply 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cac1a66eab356036af85ea093101a14223dc6e3f4c02a59b7d572e5b93270bf7" -"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" -"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d" -"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" -"checksum mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "6d771e3ef92d58a8da8df7d6976bfca9371ed1de6619d9d5a5ce5b1f29b85bfe" -"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -"checksum ndarray 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0e3d24c5ba54015d7d5203ca6f00d4cc16c71042bf7f7be26f091236f390a16a" -"checksum net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "9044faf1413a1057267be51b5afba8eb1090bd2231c693664aa1db716fe1eae0" -"checksum nix 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b7fd5681d13fda646462cfbd4e5f2051279a89a544d50eb98c365b507246839f" -"checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" -"checksum nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b" -"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" -"checksum num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "81b483ea42927c463e191802e7334556b48e7875297564c0e9951bd3a0ae53e3" -"checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" -"checksum num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f8d26da319fb45674985c78f1d1caf99aa4941f785d384a2ae36d0740bc3e2fe" -"checksum num-iter 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "4b226df12c5a59b63569dd57fafb926d91b385dfce33d8074a412411b689d593" -"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" -"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" -"checksum num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dee092fcdf725aee04dd7da1d21debff559237d49ef1cb3e69bcb8ece44c7364" -"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" -"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" -"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" -"checksum parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd9d732f2de194336fb02fe11f9eed13d9e76f13f4315b4d88a14ca411750cd" -"checksum parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "538ef00b7317875071d5e00f603f24d16f0b474c1a5fc0ccb8b454ca72eafa79" -"checksum pbr 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e048e3afebb6c454bb1c5d0fe73fda54698b4715d78ed8e7302447c37736d23a" -"checksum pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0a6dda33d67c26f0aac90d324ab2eb7239c819fc7b2552fe9faa4fe88441edc8" -"checksum petgraph 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "7a7e5234c228fbfa874c86a77f685886127f82e0aef602ad1d48333fcac6ad61" -"checksum pin-api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4806efe6dbda279bde1fe6e07de93e0a022487f290b5dee3e465793e1c34f7ad" -"checksum prctl 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "059a34f111a9dee2ce1ac2826a68b24601c4298cfeb1a587c3cb493d5ab46f52" -"checksum prettytable-rs 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "34dc1f4f6dddab3bf008ecfd4fd2a631b585fbf0af123f34c1324f51a034ff5f" -"checksum proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0" -"checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4" -"checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408" -"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" -"checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" -"checksum rawpointer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebac11a9d2e11f2af219b8b8d833b76b1ea0e054aa0e8d8e9e4cbde353bdf019" -"checksum rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80e811e76f1dbf68abf87a759083d34600017fc4e10b6bd5ad84a700f9dba4b1" -"checksum rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d24ad214285a7729b174ed6d3bcfcb80177807f959d95fafd5bfc5c4f201ac8" -"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" -"checksum regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "aec3f58d903a7d2a9dc2bf0e41a746f4530e0cab6b615494e058f67a3ef947fb" -"checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" -"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e" -"checksum regex-syntax 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b2550876c31dc914696a6c2e01cbce8afba79a93c8ae979d2fe051c0230b3756" -"checksum remove_dir_all 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5d2f806b0fcdabd98acd380dc8daef485e22bcb7cddc811d1337967f2528cf5" -"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -"checksum rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a54aa04a10c68c1c4eacb4337fd883b435997ede17a9385784b990777686b09a" -"checksum rustfmt 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec940eed814db0fb7ab928c5f5025f97dc55d1c0e345e39dda2ce9f945557500" -"checksum rustlex 0.3.3 (git+https://github.com/ulysseB/rustlex.git)" = "" -"checksum rustlex_codegen 0.3.3 (git+https://github.com/ulysseB/rustlex.git)" = "" -"checksum rustlex_fsa 0.3.3 (git+https://github.com/ulysseB/rustlex.git)" = "" -"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" -"checksum serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe95aa0d46f04ce5c3a88bdcd4114ecd6144ed0b2725ebca2f1127744357807" -"checksum serde-hjson 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a2376ebb8976138927f48b49588ef73cde2f6591b8b3df22f4063e0f27b9bec" -"checksum serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "23b163a6ce7e1aa897919f9d8e40bd1f8a6f95342ed57727ae31387a01a7a356" -"checksum serde_derive_internals 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "370aa477297975243dc914d0b0e1234927520ec311de507a560fbd1c80f7ab8c" -"checksum serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "28556329a1d04efa036376c9588a0ed8655e202676d918733ca8a14740ee31be" -"checksum serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5" -"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23" -"checksum slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdeff4cd9ecff59ec7e3744cbca73dfe5ac35c2aedb2cfba8a1c715a18912e9d" -"checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9" -"checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b" -"checksum std-semaphore 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "33ae9eec00137a8eed469fb4148acd9fc6ac8c3f9b110f52cd34698c8b5bfa0e" -"checksum strings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa481ee1bc42fc3df8195f91f7cb43cf8f2b71b48bac40bf5381cfaf7e481f3c" -"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" -"checksum syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)" = "8c5bc2d6ff27891209efa5f63e9de78648d7801f085e4653701a692ce938d6fd" -"checksum syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3133289179676c9f5c5b2845bf5a2e127769f4889fcbada43035ef6bd662605e" -"checksum syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "30ab669fa003d208c681f874bbc76d91cc3d32550d16b5d9d2087cf477316470" -"checksum syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03815b9f04d95828770d9c974aa39c6e1f6ef3114eb77a3ce09008a0d15dd142" -"checksum tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f73eebdb68c14bcb24aef74ea96079830e7fa7b31a6106e42ea7ee887c1e134e" -"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" -"checksum termcolor 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "56c456352e44f9f91f774ddeeed27c1ec60a2455ed66d692059acfb1d731bda1" -"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" -"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" -"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" -"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963" -"checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098" -"checksum tokio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "490c5ff233997a62649c0a7b523b25a1cc6fab1389b3faed0d72e8bdcef7b0ad" -"checksum tokio-executor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46108c2aca0eb4b9a883bf37a28d122ca70f5318446f59f729cd1ff78a0bb5fb" -"checksum tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6af9eb326f64b2d6b68438e1953341e00ab3cf54de7e35d92bfc73af8555313a" -"checksum tokio-reactor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f21d00eb356854d502b81776cec931d12771e4ed6d198478d23ffd38c19279af" -"checksum tokio-threadpool 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "19a8656c45ae7893c9090ac5c98749e7ff904932973fabd541463f82628efacb" -"checksum tokio-timer 0.2.0 (git+https://github.com/ulysseB/tokio-timer.git)" = "" -"checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e" -"checksum topological-sort 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa7c7f42dea4b1b99439786f5633aeb9c14c1b53f75e282803c2ec2ad545873c" -"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" -"checksum unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8083c594e02b8ae1654ae26f0ade5158b119bd88ad0e8227a5d8fcd72407946" -"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" -"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" -"checksum uuid 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "990fb49481275abe3c8e2a91339c009cd6146d9f38fc3413e4163d892cbaffbb" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767" -"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -"checksum yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57ab38ee1a4a266ed033496cf9af1828d8d6e6c1cfa5f643a2809effcae4d628" diff --git a/Cargo.toml b/Cargo.toml index ade59794e..cc8c9cf51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ path = "examples/sgemm_low.rs" required-features = ["cuda"] [build-dependencies] -cc = "1.0" +cc = "1.0.12" [build-dependencies.telamon-gen] path = "telamon-gen" @@ -35,33 +35,31 @@ path = "telamon-gen" boxfnonce = "0.1.0" config = "0.8.0" crossbeam = "0.3.2" -data_structure_traits = "0.1.8" -env_logger = "0.5.5" +env_logger = "0.5.9" errno = "0.2.3" -futures = "0.2.0-beta" +futures = "0.2.1" getopts = "0.2.17" -immut_list = "0.1.0" interval-heap = "0.0.5" ipc-channel = "0.10.0" -itertools = "0.7.7" +itertools = "0.7.8" lazy_static = "1.0.0" -libc = "0.2.39" +libc = "0.2.40" linked-list = "0.0.3" log = "0.4.1" matches = "0.1.6" ndarray = "0.11.2" num = "0.1.42" num_cpus = "1.8.0" -parking_lot = "0.5.4" +parking_lot = "0.5.5" pbr = "1.0.0" prctl = "1.0.0" prettytable-rs = "0.6.7" rand = "0.4.2" -rayon = "1.0.0" -regex = "0.2.9" +rayon = "1.0.1" +regex = "0.2.10" rustc-serialize = "0.3.24" std-semaphore = "0.1.0" -tokio = "0.1" +rpds = "0.5.0" [dependencies.telamon-utils] path = "telamon-utils" @@ -71,7 +69,7 @@ git = "https://github.com/ulysseB/tokio-timer.git" [dev-dependencies] gcc = "0.3.54" -tempdir = "0.3.6" +tempdir = "0.3.7" [features] cuda = [] diff --git a/kernels/Cargo.toml b/kernels/Cargo.toml index 6b9e83eb9..f3cbea71f 100644 --- a/kernels/Cargo.toml +++ b/kernels/Cargo.toml @@ -4,7 +4,7 @@ name = "telamon-kernels" version = "0.1.0" [dependencies] -env_logger = "0.5.7" +env_logger = "0.5.9" itertools = "0.7.8" libc = "0.2.40" ndarray = "0.11.2" diff --git a/kernels/benches/cuda_bound.rs b/kernels/benches/cuda_bound.rs index 74b522c06..01e546c76 100644 --- a/kernels/benches/cuda_bound.rs +++ b/kernels/benches/cuda_bound.rs @@ -9,11 +9,11 @@ use telamon_kernels::{Kernel, analyze_bounds, linalg}; fn main() { env_logger::init(); let executor = &cuda::Executor::init(); - //benchmark::>(1<<25, 500, executor); - //benchmark::>((1<<13, 1<<13), 500, executor); - //benchmark::>((1<<13, 1<<13), 500, executor); + benchmark::>(1<<25, 500, executor); + benchmark::>((1<<13, 1<<13), 500, executor); + benchmark::>((1<<13, 1<<13), 500, executor); benchmark::>((1<<10, 1<<10, 1<<10), 500, executor); - //benchmark::>((1<<7, 1<<7, 1<<7), 500, executor); + benchmark::>((1<<7, 1<<7, 1<<7), 500, executor); } fn benchmark<'a, K>(params: K::Parameters, diff --git a/kernels/src/lib.rs b/kernels/src/lib.rs index ac37dd2ea..b0e35ee33 100644 --- a/kernels/src/lib.rs +++ b/kernels/src/lib.rs @@ -26,7 +26,7 @@ use telamon::helper::tensor::DimSize; /// Creates a `DimSize`. If the instantiate flag is true, it uses a constant size, /// otherwise it creates a parameter with the given name. -pub fn create_size<'a, AM>(value: i32, name: &'a str, +fn create_size<'a, AM>(value: i32, name: &'a str, is_generic: bool, builder: &mut SignatureBuilder) -> DimSize<'a> where AM: ArgMap + Context diff --git a/kernels/src/linalg.rs b/kernels/src/linalg.rs index 9afc10b13..beeaec438 100644 --- a/kernels/src/linalg.rs +++ b/kernels/src/linalg.rs @@ -304,7 +304,7 @@ impl<'a, S: Scalar> Kernel<'a> for MatMul<'a, S> { (0..std::cmp::min(mn_log2-t1, t2_max)).into_par_iter() .map(move |t2| (1u32 << t1, 1u32 << t2)) }); - //let tilings = std::iter::once((32, 4)); + //let tilings = std::iter::once((4, 2)); tilings.map(|(tile_1, tile_2)| { let full_tiling = cleanup_tiling(&[tile_1, tile_2]); let small_tiling = cleanup_tiling(&[tile_1]); diff --git a/kernels/tests/cuda.rs b/kernels/tests/cuda.rs index 528684eda..0e263f472 100644 --- a/kernels/tests/cuda.rs +++ b/kernels/tests/cuda.rs @@ -23,96 +23,3 @@ test_output!(mv, linalg::MatVec, 100, (1<<4, 1<<2)); test_output!(gesummv, linalg::Gesummv, 100, (1<<4, 1<<4)); test_output!(matmul, linalg::MatMul, 100, (1<<4, 1<<4, 1<<4)); test_output!(doitgen, linalg::Doitgen, 100, (1<<4, 1<<4, 1<<4)); - -#[test] -fn inner_bound_0() { - use telamon::device::Context; - use telamon::ir::{self, dim, InstId, mem}; - use telamon::ir::DimMapScope::Global as GlobalScope; - use telamon::{helper, model}; - use telamon::search_space::{Action, DimKind, InstFlag, Order}; - use telamon_kernels::create_size; - - let _ = env_logger::try_init(); - let executor = cuda::Executor::init(); - let mut context = cuda::Context::new(&executor); - let (a, b, c); - let signature = { - let mut builder = helper::SignatureBuilder::new("bound_error", &mut context); - let m_size = create_size(1024, "m", true, &mut builder); - let n_size = create_size(1024, "n", true, &mut builder); - let k_size = create_size(1024, "k", true, &mut builder); - a = builder.tensor::("a", vec![m_size, k_size], true); - b = builder.tensor::("b", vec![k_size, n_size], true); - c = builder.tensor::("c", vec![m_size, n_size], false); - builder.get() - }; - - let full_tiling = vec![4, 2]; - let small_tiling = vec![4]; - let mut builder = helper::Builder::new(&signature, context.device()); - - let ld_a = a.load(&[&full_tiling, &small_tiling], &mut builder); - let ld_b = b.load(&[&small_tiling, &full_tiling], &mut builder); - - let init_dim_m = builder.open_mapped_dim(&ld_a[0]); - let init_dim_n = builder.open_mapped_dim(&ld_b[1]); - let acc_init = builder.mov(&0f32); - let acc_dim_m = builder.open_mapped_dim(&init_dim_m); - let acc_dim_n = builder.open_mapped_dim(&init_dim_n); - let acc_dim_k = builder.open_mapped_dim(&ld_a[1]); - let a_op = ld_a.dim_map(&[&acc_dim_m, &acc_dim_k], GlobalScope, &mut builder); - let b_op = ld_b.dim_map(&[&acc_dim_k, &acc_dim_n], GlobalScope, &mut builder); - let acc = builder.mad(&a_op, &b_op, &helper::Reduce(acc_init)); - builder.close_dim(&acc_dim_k); - - let acc = helper::tensor::VirtualTensor::new(acc, vec![acc_dim_m, acc_dim_n]); - let st_c = acc.store(&c, &mut builder); - - builder.order(&st_c.inst(), &acc_dim_k, Order::AFTER); - builder.action(Action::InstFlag(ld_a.inst(), InstFlag::MEM_CG | InstFlag::MEM_NC)); - builder.action(Action::InstFlag(ld_b.inst(), InstFlag::MEM_CG | InstFlag::MEM_NC)); - builder.action(Action::InstFlag(st_c.inst(), InstFlag::MEM_CS)); - - builder.action(Action::DimKind(init_dim_n[0], DimKind::BLOCK)); - builder.action(Action::DimKind(init_dim_m[0], DimKind::BLOCK)); - builder.action(Action::DimKind(ld_a[0][2], DimKind::UNROLL)); - builder.action(Action::DimKind(ld_a[0][1], DimKind::THREAD_Z)); - builder.action(Action::DimKind(ld_a[1][1], DimKind::THREAD_Y)); - builder.action(Action::DimKind(ld_b[0][1], DimKind::UNROLL)); - builder.action(Action::DimKind(ld_b[1][2], DimKind::THREAD_X)); - - let mut space = builder.get(); - let partial_bound = model::bound(&space, &context); - let actions = vec![ - Action::DimKind(dim::Id(8), DimKind::THREAD_Z), - Action::DimKind(dim::Id(11), DimKind::THREAD_Z)]; - assert!(space.apply_decisions(actions).is_ok()); - assert!(space.lower_layout(mem::InternalId(0), - vec![dim::Id(30), dim::Id(32), dim::Id(31)], - vec![dim::Id(33), dim::Id(35), dim::Id(34)]).is_ok()); - assert!(space.lower_layout(mem::InternalId(1), - vec![dim::Id(37), dim::Id(38), dim::Id(36)], - vec![dim::Id(40), dim::Id(41), dim::Id(39)]).is_ok()); - let actions = vec![ - Action::DimKind(dim::Id(12), DimKind::THREAD_X), - Action::DimKind(dim::Id(23), DimKind::UNROLL), - Action::DimKind(dim::Id(29), DimKind::VECTOR), - Action::DimKind(dim::Id(31), DimKind::VECTOR), - Action::DimKind(dim::Id(35), DimKind::UNROLL), - Action::DimKind(dim::Id(36), DimKind::VECTOR), - Action::DimKind(dim::Id(39), DimKind::UNROLL), - Action::DimKind(dim::Id(41), DimKind::UNROLL), - Action::Order(ir::BBId::Dim(dim::Id(0)), ir::BBId::Inst(InstId(1)), Order::AFTER), - Action::Order(ir::BBId::Dim(dim::Id(0)), ir::BBId::Inst(InstId(7)), Order::AFTER), - Action::Order(ir::BBId::Dim(dim::Id(9)), ir::BBId::Dim(dim::Id(2)), Order::OUTER), - Action::Order(ir::BBId::Dim(dim::Id(21)), ir::BBId::Inst(InstId(6)), Order::OUTER), - Action::Order(ir::BBId::Dim(dim::Id(21)), ir::BBId::Inst(InstId(8)), Order::AFTER), - Action::Order(ir::BBId::Dim(dim::Id(23)), ir::BBId::Dim(dim::Id(21)), Order::INNER), - Action::Order(ir::BBId::Dim(dim::Id(23)), ir::BBId::Inst(InstId(6)), Order::OUTER), - Action::Order(ir::BBId::Dim(dim::Id(41)), ir::BBId::Dim(dim::Id(39)), Order::OUTER)]; - assert!(space.apply_decisions(actions).is_ok()); - let final_bound = model::bound(&space, &context); - assert!(partial_bound.value() <= final_bound.value() * 1.001, - "{} > {}", partial_bound, final_bound); -} diff --git a/src/device/cuda/mem_model.rs b/src/device/cuda/mem_model.rs index 33fa3fa20..ba95dddf7 100644 --- a/src/device/cuda/mem_model.rs +++ b/src/device/cuda/mem_model.rs @@ -7,6 +7,9 @@ use std; use num::integer; use utils::*; +// TODO(model): the pressure changes depending on the list of outer dimensions. Try to +// take this into account be computing the pressure incrementatly when applying levels. + /// Result of the memory analysis for one instruction. Vector instructions are considered /// as one instruction. #[derive(Debug)] @@ -58,7 +61,7 @@ fn info(space: &SearchSpace, gpu: &cuda::Gpu, sizes: &HashMap) -> MemInfo { // TODO(model): The model can decrease if the maximal number decreases: the replay - // assume a full wrap if possible. This is correct as if the wrap is not full, the + // assume a full wrap if possible. This is correct as if the wrap is not full the // waste ratio will repeat the replay factor to achieve the same number. However, // it makes debugging the performance model harder. let info = match *pattern { @@ -71,6 +74,7 @@ fn info(space: &SearchSpace, let mut info = NO_ACCESS_INFO; let thread_dims = tensor_thread_dims( space, inst, stride, dims, sizes, gpu); + trace!("thread dims: {:?}", thread_dims); if is_shared_access.maybe_true() { info.replay_factor = shared_replay_factor( stride, &thread_dims, dims, sizes, space, gpu); diff --git a/src/explorer/candidate.rs b/src/explorer/candidate.rs index 4ee30ee5c..65726cc43 100644 --- a/src/explorer/candidate.rs +++ b/src/explorer/candidate.rs @@ -1,8 +1,7 @@ //! Exploration of the search space. use device::Context; use explorer::choice::ActionEx; -use immut_list::ImmutList; -use data_structure_traits::Create; +use rpds::List; use model::{bound, Bound}; use search_space::SearchSpace; use std::cmp::{Ordering, PartialOrd}; @@ -20,13 +19,13 @@ pub struct Candidate<'a> { /// The depth of the candidate in the search tree. pub depth: usize, /// The list of actions already taken. - pub actions: ImmutList, + pub actions: List, } impl<'a> Candidate<'a> { /// Creates a new candidate, with depth 0. pub fn new(space: SearchSpace<'a>, bound: Bound) -> Self { - Candidate { space, bound, depth: 0, actions: ImmutList::new() } + Candidate { space, bound, depth: 0, actions: List::new() } } @@ -55,7 +54,7 @@ impl<'a> Candidate<'a> { debug!("decreasing bound: {} > {}, with actions {:?} when applying {:?}", self.bound, bound, self.actions, action); } - let actions = self.actions.clone().add_element(action); + let actions = self.actions.push_front(action); Ok(Candidate { space, bound, depth: self.depth+1, actions }) } } diff --git a/src/lib.rs b/src/lib.rs index e834defc5..b6a7f2e7c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,13 +1,11 @@ extern crate boxfnonce; extern crate config; extern crate crossbeam; -extern crate data_structure_traits; #[cfg(test)] extern crate env_logger; extern crate getopts; extern crate errno; extern crate interval_heap; -extern crate immut_list; extern crate itertools; #[cfg(feature="cuda")] extern crate ipc_channel; @@ -28,6 +26,7 @@ extern crate parking_lot; #[cfg(feature="cuda")] extern crate prctl; extern crate rand; +extern crate rpds; extern crate futures; extern crate tokio_timer; #[cfg(feature="cuda")] diff --git a/src/model/hw_pressure.rs b/src/model/hw_pressure.rs index ae874c6b6..6dbd91a93 100644 --- a/src/model/hw_pressure.rs +++ b/src/model/hw_pressure.rs @@ -393,4 +393,8 @@ impl HwPressure { pressure }) } + + /// Returns the pressure on a bottleneck. + #[cfg(test)] + pub fn get_bottleneck(&self, index: usize) -> f64 { self.bottlenecks[index] } } diff --git a/src/model/local_info.rs b/src/model/local_info.rs index 7cc092194..e20b461b9 100644 --- a/src/model/local_info.rs +++ b/src/model/local_info.rs @@ -67,7 +67,7 @@ fn add_indvar_pressure(device: &Device, } else { device.multiplicative_indvar_pressure(&t) }; - // FIXME: do not add the latency if the if it is an additive unrolled dimension that can be + // FIXME: do not add the latency for additive unrolled dimension that can be // precomputed let size = dim_sizes[&dim]; if dim_kind.intersects(DimKind::THREAD | DimKind::BLOCK) { @@ -103,7 +103,6 @@ impl Nesting { fn compute(space: &SearchSpace, bb: ir::BBId) -> Self { let mut inner_dims = Vec::new(); let mut inner_bbs = Vec::new(); - let mut outer_dims = Vec::new(); let mut before_self = Vec::new(); let mut after_self = Vec::new(); let mut bigger_merged_dims = Vec::new(); @@ -118,23 +117,38 @@ impl Nesting { if order.intersects(Order::MERGED) && other_bb > bb { bigger_merged_dims.push(id); } - if Order::OUTER.contains(order) { - if outer_dims.iter().cloned().all(|outer: ir::dim::Id| { - let ord = space.domain().get_order(id.into(), outer.into()); - !ord.contains(Order::MERGED) - }) { outer_dims.push(id); } - } } } Nesting { inner_dims: VecSet::new(inner_dims), inner_bbs: VecSet::new(inner_bbs), - outer_dims: VecSet::new(outer_dims), + outer_dims: Self::get_iteration_dims(space, bb), before_self: VecSet::new(before_self), after_self: VecSet::new(after_self), bigger_merged_dims: VecSet::new(bigger_merged_dims), } } + + /// Computess the list of iteration dimensions of a `BasicBlock`. + fn get_iteration_dims(space: &SearchSpace, bb: ir::BBId) -> VecSet { + let dims = if let ir::BBId::Inst(inst) = bb { + space.ir_instance().inst(inst).iteration_dims().iter().cloned().collect() + } else { + let mut outer = Vec::new(); + for dim in space.ir_instance().dims().map(|d| d.id()) { + if bb == dim.into() { continue; } + let order = space.domain().get_order(dim.into(), bb); + if Order::OUTER.contains(order) { + if outer.iter().cloned().all(|outer: ir::dim::Id| { + let ord = space.domain().get_order(dim.into(), outer.into()); + !ord.contains(Order::MERGED) + }) { outer.push(dim); } + } + } + outer + }; + VecSet::new(dims) + } } /// Minimum and maximum parallelism in the whole GPU. diff --git a/src/model/mod.rs b/src/model/mod.rs index fcad6ba36..b4817aabb 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -282,3 +282,71 @@ fn apply_dim_map(device: &Device, level_dag.add_dependency(to_map, pred, dst_point, &latency); } } + +#[test] +#[cfg(feature="cuda")] +fn inner_bound_0() { + use device::{Context, cuda}; + use helper; + use search_space::{Action, DimKind, Order}; + + let _ = ::env_logger::try_init(); + let executor = cuda::Executor::init(); + let mut context = cuda::Context::new(&executor); + let b; + let signature = { + let mut builder = helper::SignatureBuilder::new("bound_error", &mut context); + builder.scalar("k", 1024); + b = builder.array::("b", 1024*8).0; + builder.get() + }; + + let mut builder = helper::Builder::new(&signature, context.device()); + + let size_4 = builder.cst_size(4); + let size_2 = builder.cst_size(2); + + let a_dim_0 = builder.open_dim(size_4.clone()); + let a_dim_1 = builder.open_dim(size_4.clone()); + builder.mov(&0f32); + builder.close_dim(&a_dim_1); + builder.close_dim(&a_dim_0); + + let b_dim_0 = builder.open_dim(size_4); + let b_dim_1 = builder.open_dim(size_2); + let t = ir::Type::F(32); + let (addr, pattern) = builder.tensor_access(&"b", b, &t, &[&b_dim_0, &b_dim_1]); + let ld_b = builder.ld(t, &addr, pattern); + builder.close_dim(&b_dim_0); + + builder.action(Action::DimKind(a_dim_1, DimKind::THREAD_Z)); + builder.action(Action::DimKind(a_dim_0, DimKind::THREAD_Y)); + builder.action(Action::DimKind(b_dim_1, DimKind::THREAD_X)); + + builder.order(&a_dim_1, &ld_b, Order::OUTER); + builder.order(&a_dim_0, &ld_b, Order::OUTER); + + let mut space = builder.get(); + let partial_pressure = { + let local_info = LocalInfo::compute(&space, &context); + let min_num_threads = local_info.parallelism.min_num_threads; + println!("partial nesting {:?}", local_info.nesting[&ld_b.into()].outer_dims); + println!("partial pressure {}", local_info.hw_pressure[&ld_b.into()].get_bottleneck(4)); + sum_pressure(context.device(), &space, &local_info, + BottleneckLevel::Global, min_num_threads, &[]) + }.get_bottleneck(4); + + let actions = vec![Action::DimKind(b_dim_0, DimKind::THREAD_Z)]; + assert!(space.apply_decisions(actions).is_ok()); + let final_pressure = { + let local_info = LocalInfo::compute(&space, &context); + let min_num_threads = local_info.parallelism.min_num_threads; + println!("final nesting {:?}", local_info.nesting[&ld_b.into()].outer_dims); + println!("final pressure {}", local_info.hw_pressure[&ld_b.into()].get_bottleneck(4)); + sum_pressure(context.device(), &space, &local_info, + BottleneckLevel::Global, min_num_threads, &[]) + }.get_bottleneck(4); + + assert!(partial_pressure <= final_pressure * 1.001, + "{} > {}", partial_pressure, final_pressure); +} diff --git a/telamon-gen/Cargo.toml b/telamon-gen/Cargo.toml index ed1314de0..5642ce826 100644 --- a/telamon-gen/Cargo.toml +++ b/telamon-gen/Cargo.toml @@ -12,24 +12,24 @@ doc = false name = "cli_gen" [build-dependencies] -lalrpop = "0.14.0" -cc = "1.0" -libc = "0.2" +lalrpop = "0.14" +cc = "1.0.12" +libc = "0.2.40" [dependencies] -env_logger = "0.5.5" +env_logger = "0.5.9" handlebars = "0.28.0" -itertools = "0.7.7" -lalrpop-util = "0.14.0" +itertools = "0.7.8" +lalrpop-util = "0.14" lazy_static = "1.0.0" log = "0.4.1" -regex = "0.2.9" +regex = "0.2.10" rustfmt = "0.10.0" -serde = "1.0.32" -serde_derive = "1.0.32" -serde_json = "1.0.11" +serde = "1.0.43" +serde_derive = "1.0.43" +serde_json = "1.0.16" topological-sort = "0.1.0" -libc = "0.2" +libc = "0.2.40" [dependencies.telamon-utils] path = "../telamon-utils" diff --git a/telamon-gen/cc_tests/Cargo.toml b/telamon-gen/cc_tests/Cargo.toml index bc8577d78..87285b9e7 100644 --- a/telamon-gen/cc_tests/Cargo.toml +++ b/telamon-gen/cc_tests/Cargo.toml @@ -5,14 +5,14 @@ name = "telamon-gen-test" version = "0.1.0" [build-dependencies] -env_logger = "0.5.5" +env_logger = "0.5.9" [build-dependencies.telamon-gen] path = "../" [dependencies] -env_logger = "0.5.5" -itertools = "0.7.7" +env_logger = "0.5.9" +itertools = "0.7.8" log = "0.4.1" [dependencies.telamon-utils] From 4e7a84ce235c41d2e7c66c6e106edbd5a3ce84e5 Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 2 May 2018 16:18:01 +0200 Subject: [PATCH 32/70] replace drain_filter by all,filter for stabilize rust as stable channel --- telamon-gen/src/ir/mod.rs | 15 ++++++++++++--- telamon-gen/src/lib.rs | 2 -- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/telamon-gen/src/ir/mod.rs b/telamon-gen/src/ir/mod.rs index dba471f93..0b5c2abe3 100644 --- a/telamon-gen/src/ir/mod.rs +++ b/telamon-gen/src/ir/mod.rs @@ -207,7 +207,8 @@ impl IrDesc { } // Reverse the set constraints when the set parameter is defined in the foralls. // TODO(cleanup): make the reversing code readable - for _ in set_constraints.drain_filter(|&mut (var, ref mut set)| { + // TODO(cleanup): reimplemente `drain_filter` when stable rust will be ready. + set_constraints.iter_mut().all(|&mut (var, ref mut set)| { // Reverse the set if its parameter if defined after the constraints. if let Some(Variable::Forall(forall_id)) = (&*set).arg() { // Assign the reverse set to foralls. @@ -219,12 +220,20 @@ impl IrDesc { // Use the superset as the constraint is enforced by the forall. assert!((&superset).arg().is_none()); *set = superset; + } + true + }); + set_constraints.retain(|&(var, ref set)| { + if let Some(Variable::Forall(_)) = (&*set).arg() { if let Variable::Arg(arg_id) = var { let given_set = target.arguments().get(arg_id).1; given_set.is_subset_of_def(set) } else { panic!() } - } else { false } - }) {}; + } else { + true + } + }); + (arg_foralls, other_foralls, SetConstraints::new(set_constraints), adaptator) } } diff --git a/telamon-gen/src/lib.rs b/telamon-gen/src/lib.rs index a299d16f6..145e101ab 100644 --- a/telamon-gen/src/lib.rs +++ b/telamon-gen/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(drain_filter)] - #[cfg(test)] extern crate env_logger; extern crate handlebars; #[macro_use] extern crate lazy_static; From 478505af28d03f0752fa1d21dda17db85bb75fa1 Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 2 May 2018 16:34:34 +0200 Subject: [PATCH 33/70] retain fixe is_subset_of_def as reverse, remark, this line is uncovered by any test --- telamon-gen/src/ir/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/telamon-gen/src/ir/mod.rs b/telamon-gen/src/ir/mod.rs index 0b5c2abe3..4f5f72ae2 100644 --- a/telamon-gen/src/ir/mod.rs +++ b/telamon-gen/src/ir/mod.rs @@ -1,5 +1,7 @@ //! The constraint description for the ir. use std; +use std::ops::Not; + use itertools::Itertools; use utils::*; @@ -227,7 +229,7 @@ impl IrDesc { if let Some(Variable::Forall(_)) = (&*set).arg() { if let Variable::Arg(arg_id) = var { let given_set = target.arguments().get(arg_id).1; - given_set.is_subset_of_def(set) + given_set.is_subset_of_def(set).not() } else { panic!() } } else { true From bad658dace9d30d1c9ad1a2fe724618f62795897 Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 3 May 2018 11:41:58 +0000 Subject: [PATCH 34/70] fixe coding style, closure as for, not as ! --- telamon-gen/src/ir/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/telamon-gen/src/ir/mod.rs b/telamon-gen/src/ir/mod.rs index 4f5f72ae2..1d31c20a1 100644 --- a/telamon-gen/src/ir/mod.rs +++ b/telamon-gen/src/ir/mod.rs @@ -1,6 +1,5 @@ //! The constraint description for the ir. use std; -use std::ops::Not; use itertools::Itertools; use utils::*; @@ -210,7 +209,7 @@ impl IrDesc { // Reverse the set constraints when the set parameter is defined in the foralls. // TODO(cleanup): make the reversing code readable // TODO(cleanup): reimplemente `drain_filter` when stable rust will be ready. - set_constraints.iter_mut().all(|&mut (var, ref mut set)| { + for (var, ref mut set) in set_constraints.iter_mut() { // Reverse the set if its parameter if defined after the constraints. if let Some(Variable::Forall(forall_id)) = (&*set).arg() { // Assign the reverse set to foralls. @@ -223,13 +222,12 @@ impl IrDesc { assert!((&superset).arg().is_none()); *set = superset; } - true - }); + } set_constraints.retain(|&(var, ref set)| { if let Some(Variable::Forall(_)) = (&*set).arg() { if let Variable::Arg(arg_id) = var { let given_set = target.arguments().get(arg_id).1; - given_set.is_subset_of_def(set).not() + !given_set.is_subset_of_def(set) } else { panic!() } } else { true From a3c578413513708e8075dd21569848b89f3d32f0 Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 3 May 2018 15:12:08 +0200 Subject: [PATCH 35/70] dereferencing var --- telamon-gen/src/ir/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telamon-gen/src/ir/mod.rs b/telamon-gen/src/ir/mod.rs index 1d31c20a1..49e5dbfb4 100644 --- a/telamon-gen/src/ir/mod.rs +++ b/telamon-gen/src/ir/mod.rs @@ -216,7 +216,7 @@ impl IrDesc { let forall = if forall_id < arg_foralls.len() { &mut arg_foralls[forall_id] } else { &mut other_foralls[forall_id-arg_foralls.len()] }; - let (superset, reverse_set) = set.reverse(var, &forall).unwrap(); + let (superset, reverse_set) = set.reverse(*var, &forall).unwrap(); *forall = reverse_set; // Use the superset as the constraint is enforced by the forall. assert!((&superset).arg().is_none()); From 1e72a13375354f4e16675b6264391c6a256700f4 Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 9 May 2018 22:44:41 +0200 Subject: [PATCH 36/70] add benchmark for lexer --- .travis.yml | 75 +++++++++++++++++++++++++++--------- telamon-gen/benches/lexer.rs | 29 ++++++++++++++ 2 files changed, 85 insertions(+), 19 deletions(-) create mode 100644 telamon-gen/benches/lexer.rs diff --git a/.travis.yml b/.travis.yml index 5fae0f687..af515291a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,33 +1,70 @@ +--- language: rust cache: cargo -sudo: false +# kcov currently broken on travis for non-sudo builds § https://github.com/roblabla/cargo-travis/issues/32 +sudo: required rust: - nightly addons: apt: packages: + # F/lex depedencies (needed by telamon-gen) § https://github.com/ulysseB/telamon/blob/989621f5cf1099fda6ba14b4eda18b1cd9d4660a/telamon-gen/build.rs#L14 - flex + + # Criterion's dependency Quickstart § https://github.com/japaric/criterion.rs#quickstart + - gnuplot + + # Kcov's Installing dependencies § https://github.com/SimonKagstrom/kcov/blob/master/INSTALL.md#ubuntu + - binutils-dev + - libcurl4-openssl-dev + - zlib1g-dev + - libdw-dev + - libiberty-dev + before_script: - flex --version + script: - - cd telamon-gen && LEX="flex" cargo build --features "lex" --verbose - - cargo test --verbose --all - - cargo doc --verbose --all + - cargo test --no-run --all + - cargo doc --no-deps --all + +after_success: + # Kcov's Building § https://github.com/SimonKagstrom/kcov/blob/master/INSTALL.md#building + - git clone https://github.com/SimonKagstrom/kcov.git + - mkdir kcov/build + - cd kcov/build + - cmake .. + - make + - make install DESTDIR=../.. + - cd - + + + - | + for file in target/debug/telamon*[^\.d]; + do + mkdir -p "target/cov/$(basename $file)"; + + # Kcov's Travis-ci / coveralls integration § https://github.com/SimonKagstrom/kcov/blob/master/doc/coveralls.md#travis-ci--coveralls-integration + ./usr/local/bin/kcov --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; + done + + - mv target/cov target/doc + + # Criterion's run Quickstart § https://github.com/japaric/criterion.rs#quickstart + - cd telamon-gen + - cargo bench + - cd - + - mv telamon-gen/target/criterion target/doc + deploy: - provider: pages - local-dir: target/doc - target-branch: gh-pages - skip-cleanup: true - keep-history: true - github-token: "$GITHUB_TOKEN" - on: - branch: master -notifications: - slack: - rooms: - secure: bhOU59RYPbvA8GXYtL4JTGjKRbrOFyni2wjAV0gWQqwP9lkzYWlYDlsoHOFIR+DLhwN0Or2d5Sw47Ic3NLGrzhPOFcXNBhoRUy4QBUPWaKETEJbqjG/UvYRbfGr7ajosQdL1pDMuem8NFXdNcSCgnHu9Wgtim1EjO82rdc4YGPSCcHkfHpCncM435vXcDhtdz/ks9pF4igmJH0frhXTAkngckggaR2xx1cUAlrc4ztc03goe+uFC3Iti1QAp2DGMFx9hLvV1CjATeqSA4/65idUS0aEWccK2tNwLjp3nL3LAwwymCr4OWS8wCD0p1lk3Fvcc3FTX2fw6TfGciaFNCwAO+0FD5tJD+Uez+QllN4cufKrbwQo9ZlRP0fFsx38QJ1FeK8k/uk0hR7MzqypzkCNwG6NBI98L71P2sFvA15gELuI9sWhx655PwFzmjNwYw/zCeimp9pi+bNbYoWjckkwbN7ArwJjPt47vv/bIJbo/NrmNxFghZm4RTQW45prolMUqGO9AeIMf7oP24pPdEv3v9oH7lF/97tCBLt9Nd7LhwizK6nG/VFFCofwdIfBqlGDwJufN3UoMqVezkHqRuZa+tDgU9SuUrfAe1XnAc1+HbDzza55LM+3tzHn4sPr1jmlLIEHww2Yub4GpxBJYl+8MhusRbGhedqtpqeLk3LE= - on_success: change - on_failure: change + - provider: pages + local-dir: target/doc + target-branch: gh-pages + skip-cleanup: true + keep-history: false + github-token: "$GITHUB_TOKEN" + env: global: - secure: ZLjUSECDu2ewLa2eJ8DepE7b3tuQxR81tbUxFtSBKKj6IVZPppzS7CUcVZxE46Xp+pug9KKApACOfqfqil5hRaSHKtqoVoOf/sYPJs+xA3JdmVBmqVYj0YViCA5WCxVU1J5BIEDVLTqJy7y3zBy8OYP2fNquNLEBUL7r0jn/+tjbuZfrwzN2PUqL/l7YyQVT/UgdpaXzVkvAcjGEL4nXpcSLb+a0g49PSQNcJhoLiYoZziUZH6buKllBzyBszBk4f/yO+wrvs334FaVw0DBbngIyUcQyzJT56eck22AJXlTl88DpJOUPakFTTJ1oa7UG6MTD46QMp2F/LK+ASNXwT5Q1OIsk67/CltZiWLXGBmdaAX2CJXor5vClNX3kEs0jCVCxMAOwfCmbTAz9cklb0rsoHXWYO3E39L3JhcVeZjwIvfI31d1cFrTjEwIVnUBQLmPYJyp9ndjc4kj7X/NUwD9SqrquIoEDW6mtCHlGmIDnkMJYQXNEwnoenFsSA+nbq9f/zoZVYUxmPYmRyHTCSNHVABUKYp3sK7HsRREwYwLm5slADH+K5loNYcxPgVJuH+mP7SAnJ6A8BTe4qxZK/bxjGr3ltSumWN2Ao9eC+PiAxG2QXGXHNeBtnrX0QxGkYZ5hjZndfAovjxjSsQ1kObnOOdwCSw4V93zFNzHthOQ= + - TRAVIS_CARGO_NIGHTLY_FEATURE="nightly" + - secure: T7ao3Xly60lrporBe0RChgoqLAQ8OGegUHYmQ6ZQJJqRwKansrJkd0S4w6ZtLYMqzwX03ycI+B9euPY0km3uSxysssBNJamqLyw2my9+zIOR31+6rP/+MeH1/GPcvJF5foGZAoLwxxIp+wF/5FvsqhgpfoIT1GHDylMKFGuq9lleWc1i03xAV341avjRMi9O23fEpAHEixlXl0rIGl1k6PeUy0nP0bktxk+0Z1pFdi89w3EfCSE5GESWQhylB+vI2CHFDj7rTAMRO1J5KYEcXjpKGPpdYdmJz7Egp3qimIzdNUiIJxEJOdXUtys2thuf/R8r/neGiP757OX/MDJ0DT7sxqmKeF85BTc8X2KjPgRcjOsSXL5xEmkgRm9UaR2qiBrvpCxCM0EIoIUADMwDbMUCpNzWrPGFCL6SxR8zDc9/aSUWr2Mt41MX7oNWxViQLQACIuh5xnved8c01gsseBCUkyMXybisiZtNts/AolBS5Ayu/qAp0ocZn9xKy7pCxSmLNfl7EVozEjDI8qegv23apqdseGNv2QtR5vM7t4SYsNnBsQosoC5DIICy7BiX0fboKP1qKHFMhJGekka3ky9/wCHbaZb205PLZ9GxEkHVfuOxsFOdszglGZtknvKqdwnxt04gqs33iL6o/1GGOcRiEdvOqhWWrbz+nMUQqV8= diff --git a/telamon-gen/benches/lexer.rs b/telamon-gen/benches/lexer.rs new file mode 100644 index 000000000..91c9ad4ce --- /dev/null +++ b/telamon-gen/benches/lexer.rs @@ -0,0 +1,29 @@ +#[macro_use] +extern crate criterion; +extern crate telamon_gen; + +use criterion::Criterion; + +use telamon_gen::lexer; + +use std::fs; +use std::ffi::OsStr; + +fn criterion_benchmark(c: &mut Criterion) { + let entries = fs::read_dir("cc_tests/src/").unwrap(); + for entry in entries { + if let Ok(entry) = entry { + if entry.path().extension().eq(&Some(OsStr::new("exh"))) { + let path = entry.path(); + let mut input = fs::File::open(&path).unwrap(); + let mut name = String::from("lexer "); + name.push_str(path.file_stem().unwrap().to_str().unwrap()); + + c.bench_function(&name, move |b| b.iter(|| lexer::Lexer::new(&mut input))); + } + } + } +} + +criterion_group!(benches, criterion_benchmark); +criterion_main!(benches); From 827c65fcc93ed67a0761e1f4f02670b955bb267b Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 11 May 2018 05:32:46 +0000 Subject: [PATCH 37/70] criterion manifest --- telamon-gen/Cargo.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/telamon-gen/Cargo.toml b/telamon-gen/Cargo.toml index 5642ce826..3ab05cf2b 100644 --- a/telamon-gen/Cargo.toml +++ b/telamon-gen/Cargo.toml @@ -11,6 +11,13 @@ lex = [] doc = false name = "cli_gen" +[[bench]] +name = "lexer" +harness = false + +[dev-dependencies] +criterion = "0.2" + [build-dependencies] lalrpop = "0.14" cc = "1.0.12" From aa340e9ff7dfd26dbb7eb4f8d2c5301dcebb1727 Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 11 May 2018 05:34:02 +0000 Subject: [PATCH 38/70] manifest travis now checks rust as stable --- .travis.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index af515291a..7be60c5f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ cache: cargo sudo: required rust: - nightly + - stable addons: apt: packages: @@ -25,8 +26,16 @@ before_script: - flex --version script: - - cargo test --no-run --all - - cargo doc --no-deps --all + - | + if [ $TRAVIS_RUST_VERSION == "nightly" ]; + then + cargo test --no-run --all + cargo doc --no-deps --all + else + cargo test --all + cargo doc --all + fi + after_success: # Kcov's Building § https://github.com/SimonKagstrom/kcov/blob/master/INSTALL.md#building @@ -38,7 +47,6 @@ after_success: - make install DESTDIR=../.. - cd - - - | for file in target/debug/telamon*[^\.d]; do @@ -51,10 +59,14 @@ after_success: - mv target/cov target/doc # Criterion's run Quickstart § https://github.com/japaric/criterion.rs#quickstart - - cd telamon-gen - - cargo bench - - cd - - - mv telamon-gen/target/criterion target/doc + - | + if [ $TRAVIS_RUST_VERSION == "nightly" ]; + then + cd telamon-gen + cargo bench + cd - + mv telamon-gen/target/criterion target/doc + fi deploy: - provider: pages @@ -63,6 +75,8 @@ deploy: skip-cleanup: true keep-history: false github-token: "$GITHUB_TOKEN" + on: + condition: $TRAVIS_RUST_VERSION = nightly env: global: From 672aad3610749c902fe69c75d108a2db29c805c4 Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 16 May 2018 17:10:07 +0200 Subject: [PATCH 39/70] fixe auto example according to issue #5330 --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index cc8c9cf51..01e6f689b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ build = "build.rs" name = "telamon" readme = "README.md" version = "0.2.0" +autoexamples = true [[bin]] name = "cuda-characterize" From 2bb33372770f78f9d7679096c412d5cbcd24b0de Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 16 May 2018 18:21:30 +0200 Subject: [PATCH 40/70] add poc.l to dependency condition of Cargo rebuilt --- telamon-gen/build.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/telamon-gen/build.rs b/telamon-gen/build.rs index 3c0d29088..699157aa8 100644 --- a/telamon-gen/build.rs +++ b/telamon-gen/build.rs @@ -6,11 +6,13 @@ extern crate lalrpop; fn add_dependency(dep: &str) { println!("cargo:rerun-if-changed={}", dep); } fn main() { - // Compile the lexer.(`LEX="flex" cargo build --features "lex"`) + // Regenerate the lexer.(`LEX="flex" cargo build --features "lex"`) #[cfg(feature = "lex")] { use std::{env,process::Command}; + // Generate the lexer . + add_dependency("src/poc.l"); let bin = env::var("LEX").unwrap_or(String::from("flex")); Command::new(bin) @@ -20,6 +22,7 @@ fn main() { .expect("failed to execute Flex's process"); } + // Compile the lexer . cc::Build::new() .file("exh.c") .flag("-Wno-unused-parameter") From 24d5c7405c256268303034997540357ce35cb767 Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 16 May 2018 18:23:30 +0200 Subject: [PATCH 41/70] enable f/lex feature yylineno, implemente YY_EXTRA and YY_USER, lalrpop now have a leg/end's Position --- telamon-gen/src/exh.l | 76 +++++++++++++++-------- telamon-gen/src/lexer/ffi.rs | 20 +++++- telamon-gen/src/lexer/mod.rs | 109 ++++++++++++++++++--------------- telamon-gen/src/lib.rs | 2 +- telamon-gen/src/parser.lalrpop | 7 ++- 5 files changed, 135 insertions(+), 79 deletions(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index cd24618cc..c6797564f 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -1,5 +1,9 @@ +/* 19 Reentrant C Scanners § https://westes.github.io/flex/manual/Reentrant.html#Reentrant */ %option reentrant +/* https://westes.github.io/flex/manual/I-get-an-error-about-undefined-yywrap_0028_0029_002e.html#I-get-an-error-about-undefined-yywrap_0028_0029_002e */ %option noyywrap +/* number of the current line § https://westes.github.io/flex/manual/Options-Affecting-Scanner-Behavior.html#index-yylineno */ +%option yylineno %x C_COMMENT %x LINE_DOC @@ -7,9 +11,25 @@ %{ #include - union yylval { - int val; - } yylval; + typedef struct Pos { + unsigned int line; + unsigned int column; + } Pos; + + typedef int Data; + + typedef struct Span { + Pos leg; + Pos end; + Data data; + } Span; + + #define YY_EXTRA_TYPE Span + #define YY_USER_ACTION { \ + yyextra.leg = yyextra.end; \ + yyextra.end.line = yylineno; \ + yyextra.end.column += yyleng; \ + } enum token { VALUEIDENT, @@ -102,7 +122,7 @@ num [0-9] alpha [a-zA-Z_] alpha_num {alpha}|{num} -whitespace [ \t\r\n]+ +whitespace [ \t\r]+ comment "//"[^/\n][^\n]*|"//" blank {comment}|{whitespace} @@ -183,7 +203,9 @@ code \"[^\n\"]*\" {doc} { BEGIN(LINE_DOC); } \n { BEGIN(INITIAL); } -[^\n]* { return DOC; } +[^\n]* { yyextra.end.column = 0; return DOC; } + +[\n] { yyextra.end.column = 0; } {blank} {} @@ -195,34 +217,34 @@ code \"[^\n\"]*\" {in} { return IN; } {is} { return IS; } {not} { return NOT; } -{product} {yylval.val = MUL; return COUNTERKIND; } +{product} { yyextra.data = MUL; return COUNTERKIND; } {require} { return REQUIRE; } {requires} { return REQUIRES; } -{sum} {yylval.val = ADD; return COUNTERKIND; } +{sum} { yyextra.data = ADD; return COUNTERKIND; } {value} { return VALUE; } {when} { return WHEN; } {trigger} { return TRIGGER; } -{half} {yylval.val = NOMAX; return COUNTERVISIBILITY; } -{hidden} {yylval.val = HIDDENMAX; return COUNTERVISIBILITY; } +{half} { yyextra.data = NOMAX; return COUNTERVISIBILITY; } +{hidden} { yyextra.data = HIDDENMAX; return COUNTERVISIBILITY; } {base} { return BASE; } -{item_type} {yylval.val = ITEMTYPE; return SETDEFKEY; } -{new_objs} {yylval.val = NEWOBJS; return SETDEFKEY; } -{id_type} {yylval.val = IDTYPE; return SETDEFKEY; } -{item_getter} {yylval.val = ITEMGETTER; return SETDEFKEY; } -{id_getter} {yylval.val = IDGETTER; return SETDEFKEY; } -{iter} {yylval.val = ITER; return SETDEFKEY; } -{prefix} {yylval.val = PREFIX; return SETDEFKEY; } -{reverse} {yylval.val = REVERSE; return SETDEFKEY; } -{add_to_set} {yylval.val = ADDTOSET; return SETDEFKEY; } -{from_superset} {yylval.val = FROMSUPERSET; return SETDEFKEY; } +{item_type} { yyextra.data = ITEMTYPE; return SETDEFKEY; } +{new_objs} { yyextra.data = NEWOBJS; return SETDEFKEY; } +{id_type} { yyextra.data = IDTYPE; return SETDEFKEY; } +{item_getter} { yyextra.data = ITEMGETTER; return SETDEFKEY; } +{id_getter} { yyextra.data = IDGETTER; return SETDEFKEY; } +{iter} { yyextra.data = ITER; return SETDEFKEY; } +{prefix} { yyextra.data = PREFIX; return SETDEFKEY; } +{reverse} { yyextra.data = REVERSE; return SETDEFKEY; } +{add_to_set} { yyextra.data = ADDTOSET; return SETDEFKEY; } +{from_superset} { yyextra.data = FROMSUPERSET; return SETDEFKEY; } {set} { return SET; } {of} { return OF; } {subsetof} { return SUBSETOF; } {disjoint} { return DISJOINT; } {quotient} { return QUOTIENT; } -{true} {yylval.val = 1; return BOOL; } -{false} {yylval.val = 0; return BOOL; } +{true} { yyextra.data = 1; return BOOL; } +{false} { yyextra.data = 0; return BOOL; } {colon} { return COLON; } {comma} { return COMMA; } @@ -231,12 +253,12 @@ code \"[^\n\"]*\" {bit_or} { return BITOR; } {or} { return OR; } {and} { return AND; } -{gt} {yylval.val = GT; return CMPOP; } -{lt} {yylval.val = LT; return CMPOP; } -{ge} {yylval.val = GEQ; return CMPOP; } -{le} {yylval.val = LEQ; return CMPOP; } -{equals} {yylval.val = EQ; return CMPOP; } -{not_equals} {yylval.val = NEQ; return CMPOP; } +{gt} { yyextra.data = GT; return CMPOP; } +{lt} { yyextra.data = LT; return CMPOP; } +{ge} { yyextra.data = GEQ; return CMPOP; } +{le} { yyextra.data = LEQ; return CMPOP; } +{equals} { yyextra.data = EQ; return CMPOP; } +{not_equals} { yyextra.data = NEQ; return CMPOP; } {equal} { return EQUAL; } {end} { return END; } {symmetric} { return SYMMETRIC; } diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index f4b652220..d18beff17 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -18,6 +18,23 @@ pub union YyLval { pub set_def_key: ir::SetDefKey, } +#[derive(Default, Copy, Clone, Debug, PartialEq)] +#[repr(C)] +pub struct Position { + pub line: libc::c_uint, + pub column: libc::c_uint, +} + +#[derive(Copy, Clone, Debug)] +#[repr(C)] +pub struct Span { + pub leg: Position, + pub end: Position, + pub data: Y, +} + +pub type YyExtraType = Span; + #[derive(Copy, Clone, Debug)] #[repr(C)] pub enum YyToken { @@ -69,12 +86,11 @@ pub enum YyToken { } extern { - pub static yylval: YyLval; - pub fn yylex_init(scanner: *const YyScan) -> libc::c_int; pub fn yy_scan_string(yy_str: *const libc::c_char, yyscanner: YyScan) -> YyBufferState; pub fn yy_scan_buffer(base: *const libc::c_char, size: YySize, yyscanner: YyScan) -> YyBufferState; pub fn yy_scan_bytes(base: *const libc::c_char, len: libc::c_int, yyscanner: YyScan) -> YyBufferState; + pub fn yyget_extra(yyscanner: YyScan) -> YyExtraType; pub fn yylex(yyscanner: YyScan) -> YyToken; pub fn yyget_text(yyscanner: YyScan) -> *mut libc::c_char; pub fn yy_delete_buffer(b: YyBufferState, yyscanner: YyScan); diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index 767316a06..7f9c292bf 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -14,16 +14,26 @@ use std::ffi::CStr; use self::ffi::{ YyScan, YyBufferState, + YyExtraType, yylex_init, yy_scan_bytes, yy_delete_buffer, yylex_destroy, yylex, YyToken, - yylval, yyget_text, + yyget_extra, + }; +pub use self::ffi::Position; + +#[derive(Copy, Clone, Debug, PartialEq)] +pub enum LexicalError { +} + +pub type Spanned = Result<(P, T, P), E>; + pub struct Lexer { scanner: YyScan, buffer: YyBufferState, @@ -39,7 +49,7 @@ impl Lexer { } impl From> for Lexer { - fn from(buffer:Vec) -> Self { + fn from(buffer: Vec) -> Self { unsafe { let scanner: YyScan = ptr::null(); @@ -62,45 +72,48 @@ impl Drop for Lexer { } impl Iterator for Lexer { - type Item = Token; + type Item = Spanned; fn next(&mut self) -> Option { unsafe { - match yylex(self.scanner) { + let code: YyToken = yylex(self.scanner); + let extra: YyExtraType = yyget_extra(self.scanner); + + match code { YyToken::InvalidToken => { let out = yyget_text(self.scanner); CStr::from_ptr(out) .to_str().ok() - .and_then(|s: &str| Some(Token::InvalidToken(s.to_owned()))) + .and_then(|s: &str| Some(Ok((extra.leg, Token::InvalidToken(s.to_owned()), extra.end)))) }, YyToken::ChoiceIdent => { let out = yyget_text(self.scanner); CStr::from_ptr(out) .to_str().ok() - .and_then(|s: &str| Some(Token::ChoiceIdent(s.to_owned()))) + .and_then(|s: &str| Some(Ok((extra.leg, Token::ChoiceIdent(s.to_owned()), extra.end)))) }, YyToken::SetIdent => { let out = yyget_text(self.scanner); CStr::from_ptr(out) .to_str().ok() - .and_then(|s: &str| Some(Token::SetIdent(s.to_owned()))) + .and_then(|s: &str| Some(Ok((extra.leg, Token::SetIdent(s.to_owned()), extra.end)))) }, YyToken::ValueIdent => { let out = yyget_text(self.scanner); CStr::from_ptr(out) .to_str().ok() - .and_then(|s: &str| Some(Token::ValueIdent(s.to_owned()))) + .and_then(|s: &str| Some(Ok((extra.leg, Token::ValueIdent(s.to_owned()), extra.end)))) }, YyToken::Var => { let out = yyget_text(self.scanner); CStr::from_ptr(out) .to_str().ok() - .and_then(|s: &str| Some(Token::Var(s.to_owned()))) + .and_then(|s: &str| Some(Ok((extra.leg, Token::Var(s.to_owned()), extra.end)))) }, YyToken::Code => { let out = yyget_text(self.scanner); @@ -109,52 +122,52 @@ impl Iterator for Lexer { *out.offset(len as _) = b'\0' as _; CStr::from_ptr(out) .to_str().ok() - .and_then(|s: &str| Some(Token::Code(s.to_owned()))) + .and_then(|s: &str| Some(Ok((extra.leg, Token::Code(s.to_owned()), extra.end)))) }, YyToken::Doc => { let out = yyget_text(self.scanner); CStr::from_ptr(out) .to_str().ok() - .and_then(|s: &str| Some(Token::Doc(s.to_owned()))) + .and_then(|s: &str| Some(Ok((extra.leg, Token::Doc(s.to_owned()), extra.end)))) }, - YyToken::Alias => Some(Token::Alias), - YyToken::Counter => Some(Token::Counter), - YyToken::Define => Some(Token::Define), - YyToken::Enum => Some(Token::Enum), - YyToken::Forall => Some(Token::Forall), - YyToken::In => Some(Token::In), - YyToken::Is => Some(Token::Is), - YyToken::Not => Some(Token::Not), - YyToken::Require => Some(Token::Require), - YyToken::Requires => Some(Token::Requires), - YyToken::CounterKind => Some(Token::CounterKind(yylval.counter_kind)), - YyToken::Value => Some(Token::Value), - YyToken::When => Some(Token::When), - YyToken::Trigger => Some(Token::Trigger), - YyToken::CounterVisibility => Some(Token::CounterVisibility(yylval.counter_visibility)), - YyToken::Base => Some(Token::Base), - YyToken::SetDefkey => Some(Token::SetDefKey(yylval.set_def_key)), - YyToken::Set => Some(Token::Set), - YyToken::SubsetOf => Some(Token::SubsetOf), - YyToken::Disjoint => Some(Token::Disjoint), - YyToken::Quotient => Some(Token::Quotient), - YyToken::Of => Some(Token::Of), - YyToken::Bool => Some(Token::Bool(yylval.boolean)), - YyToken::Colon => Some(Token::Colon), - YyToken::Comma => Some(Token::Comma), - YyToken::LParen => Some(Token::LParen), - YyToken::RParen => Some(Token::RParen), - YyToken::BitOr => Some(Token::BitOr), - YyToken::Or => Some(Token::Or), - YyToken::And => Some(Token::And), - YyToken::CmpOp => Some(Token::CmpOp(yylval.cmp_op)), - YyToken::Equal => Some(Token::Equal), - YyToken::End => Some(Token::End), - YyToken::Symmetric => Some(Token::Symmetric), - YyToken::AntiSymmetric => Some(Token::AntiSymmetric), - YyToken::Arrow => Some(Token::Arrow), - YyToken::Divide => Some(Token::Divide), + YyToken::Alias => Some(Ok((extra.leg, Token::Alias, extra.end))), + YyToken::Counter => Some(Ok((extra.leg, Token::Counter, extra.end))), + YyToken::Define => Some(Ok((extra.leg, Token::Define, extra.end))), + YyToken::Enum => Some(Ok((extra.leg, Token::Enum, extra.end))), + YyToken::Forall => Some(Ok((extra.leg, Token::Forall, extra.end))), + YyToken::In => Some(Ok((extra.leg, Token::In, extra.end))), + YyToken::Is => Some(Ok((extra.leg, Token::Is, extra.end))), + YyToken::Not => Some(Ok((extra.leg, Token::Not, extra.end))), + YyToken::Require => Some(Ok((extra.leg, Token::Require, extra.end))), + YyToken::Requires => Some(Ok((extra.leg, Token::Requires, extra.end))), + YyToken::CounterKind => Some(Ok((extra.leg, Token::CounterKind(extra.data.counter_kind), extra.end))), + YyToken::Value => Some(Ok((extra.leg, Token::Value, extra.end))), + YyToken::When => Some(Ok((extra.leg, Token::When, extra.end))), + YyToken::Trigger => Some(Ok((extra.leg, Token::Trigger, extra.end))), + YyToken::CounterVisibility => Some(Ok((extra.leg, Token::CounterVisibility(extra.data.counter_visibility), extra.end))), + YyToken::Base => Some(Ok((extra.leg, Token::Base, extra.end))), + YyToken::SetDefkey => Some(Ok((extra.leg, Token::SetDefKey(extra.data.set_def_key), extra.end))), + YyToken::Set => Some(Ok((extra.leg, Token::Set, extra.end))), + YyToken::SubsetOf => Some(Ok((extra.leg, Token::SubsetOf, extra.end))), + YyToken::Disjoint => Some(Ok((extra.leg, Token::Disjoint, extra.end))), + YyToken::Quotient => Some(Ok((extra.leg, Token::Quotient, extra.end))), + YyToken::Of => Some(Ok((extra.leg, Token::Of, extra.end))), + YyToken::Bool => Some(Ok((extra.leg, Token::Bool(extra.data.boolean), extra.end))), + YyToken::Colon => Some(Ok((extra.leg, Token::Colon, extra.end))), + YyToken::Comma => Some(Ok((extra.leg, Token::Comma, extra.end))), + YyToken::LParen => Some(Ok((extra.leg, Token::LParen, extra.end))), + YyToken::RParen => Some(Ok((extra.leg, Token::RParen, extra.end))), + YyToken::BitOr => Some(Ok((extra.leg, Token::BitOr, extra.end))), + YyToken::Or => Some(Ok((extra.leg, Token::Or, extra.end))), + YyToken::And => Some(Ok((extra.leg, Token::And, extra.end))), + YyToken::CmpOp => Some(Ok((extra.leg, Token::CmpOp(extra.data.cmp_op), extra.end))), + YyToken::Equal => Some(Ok((extra.leg, Token::Equal, extra.end))), + YyToken::End => Some(Ok((extra.leg, Token::End, extra.end))), + YyToken::Symmetric => Some(Ok((extra.leg, Token::Symmetric, extra.end))), + YyToken::AntiSymmetric => Some(Ok((extra.leg, Token::AntiSymmetric, extra.end))), + YyToken::Arrow => Some(Ok((extra.leg, Token::Arrow, extra.end))), + YyToken::Divide => Some(Ok((extra.leg, Token::Divide, extra.end))), YyToken::EOF => None, } } diff --git a/telamon-gen/src/lib.rs b/telamon-gen/src/lib.rs index 145e101ab..ad180045e 100644 --- a/telamon-gen/src/lib.rs +++ b/telamon-gen/src/lib.rs @@ -57,7 +57,7 @@ pub fn process_file(input_path: &path::Path, output_path: &path::Path, format: b pub fn process(input: &mut io::Read, output: &mut T, format: bool) { // Parse and check the input. let tokens = lexer::Lexer::new(input); - let ast = parser::parse_ast(tokens).unwrap(); + let ast = parser::parse_ast(tokens).ok().unwrap(); let (mut ir_desc, constraints) = ast.type_check(); debug!("constraints: {:?}", constraints); // Generate flat filters. diff --git a/telamon-gen/src/parser.lalrpop b/telamon-gen/src/parser.lalrpop index 81b6961aa..9cfc9f0c8 100644 --- a/telamon-gen/src/parser.lalrpop +++ b/telamon-gen/src/parser.lalrpop @@ -1,7 +1,9 @@ //! Lalrpop parser for constraints description. use ast; use ir; -use lexer::Token; + +use lexer::*; + use utils::*; grammar; @@ -158,6 +160,9 @@ list: Vec = { }; extern { + type Location = Position; + type Error = LexicalError; + enum Token { choice_ident => Token::ChoiceIdent(), val_ident => Token::ValueIdent(), From ab75b8e7867a57fd87f111978b90c54f46e620d7 Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 16 May 2018 18:24:50 +0200 Subject: [PATCH 42/70] naive reforcement lexer test with Position check, next check will add verification for multiline and comment --- telamon-gen/tests/lexer.rs | 446 ++++++++++++++++++++++++++----------- 1 file changed, 316 insertions(+), 130 deletions(-) diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index 66d1b8f84..a83958eee 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -1,270 +1,456 @@ extern crate telamon_gen; -use telamon_gen::lexer::{Lexer,Token}; +use telamon_gen::lexer::*; use telamon_gen::ir::{CounterKind, CounterVisibility, SetDefKey, CmpOp}; #[test] fn initial() { // Invalid's Token - assert_eq!(Lexer::from(b"!".to_vec()).collect::>(), vec![ - Token::InvalidToken(String::from("!")), + assert_eq!(Lexer::from(b"!".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::InvalidToken(String::from("!")), + Position { column: 1, ..Default::default() } + )), ]); + // ChoiceIdent's Token - assert_eq!(Lexer::from(b"az_09".to_vec()).collect::>(), vec![ - Token::ChoiceIdent(String::from("az_09")) + assert_eq!(Lexer::from(b"az_09".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::ChoiceIdent(String::from("az_09")), + Position { column: 5, ..Default::default() } + )), ]); // SetIdent's Token - assert_eq!(Lexer::from(b"Az_09".to_vec()).collect::>(), vec![ - Token::SetIdent(String::from("Az_09")) + assert_eq!(Lexer::from(b"Az_09".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::SetIdent(String::from("Az_09")), + Position { column: 5, ..Default::default() } + )), ]); // ValueIdent's Token - assert_eq!(Lexer::from(b"AZ_09".to_vec()).collect::>(), vec![ - Token::ValueIdent(String::from("AZ_09")) + assert_eq!(Lexer::from(b"AZ_09".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::ValueIdent(String::from("AZ_09")), + Position { column: 5, ..Default::default() } + )), ]); // Var's Token - assert_eq!(Lexer::from(b"$vV".to_vec()).collect::>(), vec![ - Token::Var(String::from("vV")), + assert_eq!(Lexer::from(b"$vV".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Var(String::from("vV")), + Position { column: 3, ..Default::default() } + )), ]); // Code's Token - assert_eq!(Lexer::from(b"\"ir::...\"".to_vec()).collect::>(), vec![ - Token::Code(String::from("ir::...")), + assert_eq!(Lexer::from(b"\"ir::...\"".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Code(String::from("ir::...")), + Position { column: 9, ..Default::default() } + )), ]); // Alias's Token - assert_eq!(Lexer::from(b"alias".to_vec()).collect::>(), vec![ - Token::Alias + assert_eq!(Lexer::from(b"alias".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Alias, + Position { column: 5, ..Default::default() } + )), ]); // Counter's Token - assert_eq!(Lexer::from(b"counter".to_vec()).collect::>(), vec![ - Token::Counter + assert_eq!(Lexer::from(b"counter".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Counter, + Position { column: 7, ..Default::default() } + )), ]); // Define's Token - assert_eq!(Lexer::from(b"define".to_vec()).collect::>(), vec![ - Token::Define + assert_eq!(Lexer::from(b"define".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Define, + Position { column: 6, ..Default::default() } + )), ]); // Enum's Token - assert_eq!(Lexer::from(b"enum".to_vec()).collect::>(), vec![ - Token::Enum + assert_eq!(Lexer::from(b"enum".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Enum, + Position { column: 4, ..Default::default() } + )), ]); // Forall's Token - assert_eq!(Lexer::from(b"forall".to_vec()).collect::>(), vec![ - Token::Forall + assert_eq!(Lexer::from(b"forall".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Forall, + Position { column: 6, ..Default::default() } + )), ]); // In's Token - assert_eq!(Lexer::from(b"in".to_vec()).collect::>(), vec![ - Token::In + assert_eq!(Lexer::from(b"in".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::In, + Position { column: 2, ..Default::default() } + )), ]); // Is's Token - assert_eq!(Lexer::from(b"is".to_vec()).collect::>(), vec![ - Token::Is + assert_eq!(Lexer::from(b"is".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Is, + Position { column: 2, ..Default::default() } + )), ]); // Not's Token - assert_eq!(Lexer::from(b"not".to_vec()).collect::>(), vec![ - Token::Not + assert_eq!(Lexer::from(b"not".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Not, + Position { column: 3, ..Default::default() } + )), ]); // Require's Token - assert_eq!(Lexer::from(b"require".to_vec()).collect::>(), vec![ - Token::Require + assert_eq!(Lexer::from(b"require".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Require, + Position { column: 7, ..Default::default() } + )), ]); // Mul's CounterKind Token - assert_eq!(Lexer::from(b"mul".to_vec()).collect::>(), vec![ - Token::CounterKind(CounterKind::Mul) + assert_eq!(Lexer::from(b"mul".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::CounterKind(CounterKind::Mul), + Position { column: 3, ..Default::default() } + )), ]); // Sum's CounterKind Token - assert_eq!(Lexer::from(b"sum".to_vec()).collect::>(), vec![ - Token::CounterKind(CounterKind::Add) + assert_eq!(Lexer::from(b"sum".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::CounterKind(CounterKind::Add), + Position { column: 3, ..Default::default() } + )), ]); // Value's Token - assert_eq!(Lexer::from(b"value".to_vec()).collect::>(), vec![ - Token::Value + assert_eq!(Lexer::from(b"value".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Value, + Position { column: 5, ..Default::default() } + )), ]); // When's Token - assert_eq!(Lexer::from(b"when".to_vec()).collect::>(), vec![ - Token::When + assert_eq!(Lexer::from(b"when".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::When, + Position { column: 4, ..Default::default() } + )), ]); // Trigger's Token - assert_eq!(Lexer::from(b"trigger".to_vec()).collect::>(), vec![ - Token::Trigger + assert_eq!(Lexer::from(b"trigger".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Trigger, + Position { column: 7, ..Default::default() } + )), ]); // NoMax's CounterVisibility Token - assert_eq!(Lexer::from(b"half".to_vec()).collect::>(), vec![ - Token::CounterVisibility(CounterVisibility::NoMax) + assert_eq!(Lexer::from(b"half".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::CounterVisibility(CounterVisibility::NoMax), + Position { column: 4, ..Default::default() } + )), ]); // HiddenMax's CounterVisibility Token - assert_eq!(Lexer::from(b"internal".to_vec()).collect::>(), vec![ - Token::CounterVisibility(CounterVisibility::HiddenMax) + assert_eq!(Lexer::from(b"internal".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::CounterVisibility(CounterVisibility::HiddenMax), + Position { column: 8, ..Default::default() } + )), ]); // Base's Token - assert_eq!(Lexer::from(b"base".to_vec()).collect::>(), vec![ - Token::Base + assert_eq!(Lexer::from(b"base".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Base, + Position { column: 4, ..Default::default() } + )), ]); // item_type's SetDefKey Token - assert_eq!(Lexer::from(b"item_type".to_vec()).collect::>(), vec![ - Token::SetDefKey(SetDefKey::ItemType) + assert_eq!(Lexer::from(b"item_type".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::SetDefKey(SetDefKey::ItemType), + Position { column: 9, ..Default::default() } + )), ]); // NewObjs's SetDefKey Token - assert_eq!(Lexer::from(b"new_objs".to_vec()).collect::>(), vec![ - Token::SetDefKey(SetDefKey::NewObjs) + assert_eq!(Lexer::from(b"new_objs".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::SetDefKey(SetDefKey::NewObjs), + Position { column: 8, ..Default::default() } + )), ]); // IdType's SetDefKey Token - assert_eq!(Lexer::from(b"id_type".to_vec()).collect::>(), vec![ - Token::SetDefKey(SetDefKey::IdType) + assert_eq!(Lexer::from(b"id_type".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::SetDefKey(SetDefKey::IdType), + Position { column: 7, ..Default::default() } + )), ]); // ItemGetter's SetDefKey Token - assert_eq!(Lexer::from(b"item_getter".to_vec()).collect::>(), vec![ - Token::SetDefKey(SetDefKey::ItemGetter) + assert_eq!(Lexer::from(b"item_getter".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::SetDefKey(SetDefKey::ItemGetter), + Position { column: 11, ..Default::default() } + )), ]); // IdGetter's SetDefKey Token - assert_eq!(Lexer::from(b"id_getter".to_vec()).collect::>(), vec![ - Token::SetDefKey(SetDefKey::IdGetter) + assert_eq!(Lexer::from(b"id_getter".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::SetDefKey(SetDefKey::IdGetter), + Position { column: 9, ..Default::default() } + )), ]); // Iter's SetDefKey Token - assert_eq!(Lexer::from(b"iterator".to_vec()).collect::>(), vec![ - Token::SetDefKey(SetDefKey::Iter) + assert_eq!(Lexer::from(b"iterator".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::SetDefKey(SetDefKey::Iter), + Position { column: 8, ..Default::default() } + )), ]); // Prefix's SetDefKey Token - assert_eq!(Lexer::from(b"var_prefix".to_vec()).collect::>(), vec![ - Token::SetDefKey(SetDefKey::Prefix) + assert_eq!(Lexer::from(b"var_prefix".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::SetDefKey(SetDefKey::Prefix), + Position { column: 10, ..Default::default() } + )), ]); // Reverse's SetDefKey Token - assert_eq!(Lexer::from(b"reverse".to_vec()).collect::>(), vec![ - Token::SetDefKey(SetDefKey::Reverse) + assert_eq!(Lexer::from(b"reverse".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::SetDefKey(SetDefKey::Reverse), + Position { column: 7, ..Default::default() } + )), ]); // AddToSet's SetDefKey Token - assert_eq!(Lexer::from(b"add_to_set".to_vec()).collect::>(), vec![ - Token::SetDefKey(SetDefKey::AddToSet) + assert_eq!(Lexer::from(b"add_to_set".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::SetDefKey(SetDefKey::AddToSet), + Position { column: 10, ..Default::default() } + )), ]); // FromSuperset's SetDefKey Token - assert_eq!(Lexer::from(b"from_superset".to_vec()).collect::>(), vec![ - Token::SetDefKey(SetDefKey::FromSuperset) + assert_eq!(Lexer::from(b"from_superset".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::SetDefKey(SetDefKey::FromSuperset), + Position { column: 13, ..Default::default() } + )), ]); // Set's Token - assert_eq!(Lexer::from(b"set".to_vec()).collect::>(), vec![ - Token::Set + assert_eq!(Lexer::from(b"set".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Set, + Position { column: 3, ..Default::default() } + )), ]); // SubsetOf's Token - assert_eq!(Lexer::from(b"subsetof".to_vec()).collect::>(), vec![ - Token::SubsetOf + assert_eq!(Lexer::from(b"subsetof".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::SubsetOf, + Position { column: 8, ..Default::default() } + )), ]); // Disjoint's Token - assert_eq!(Lexer::from(b"disjoint".to_vec()).collect::>(), vec![ - Token::Disjoint + assert_eq!(Lexer::from(b"disjoint".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Disjoint, + Position { column: 8, ..Default::default() } + )), ]); // Quotient's Token - assert_eq!(Lexer::from(b"quotient".to_vec()).collect::>(), vec![ - Token::Quotient + assert_eq!(Lexer::from(b"quotient".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Quotient, + Position { column: 8, ..Default::default() } + )), ]); // Of's Token - assert_eq!(Lexer::from(b"of".to_vec()).collect::>(), vec![ - Token::Of + assert_eq!(Lexer::from(b"of".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Of, + Position { column: 2, ..Default::default() } + )), ]); // False's Bool Token - assert_eq!(Lexer::from(b"false".to_vec()).collect::>(), vec![ - Token::Bool(false) + assert_eq!(Lexer::from(b"false".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Bool(false), + Position { column: 5, ..Default::default() } + )), ]); // True's Bool Token - assert_eq!(Lexer::from(b"true".to_vec()).collect::>(), vec![ - Token::Bool(true) + assert_eq!(Lexer::from(b"true".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Bool(true), + Position { column: 4, ..Default::default() } + )), ]); // Colon's Token - assert_eq!(Lexer::from(b":".to_vec()).collect::>(), vec![ - Token::Colon + assert_eq!(Lexer::from(b":".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Colon, + Position { column: 1, ..Default::default() } + )), ]); // Comma's Token - assert_eq!(Lexer::from(b",".to_vec()).collect::>(), vec![ - Token::Comma + assert_eq!(Lexer::from(b",".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Comma, + Position { column: 1, ..Default::default() } + )), ]); // LParen's Token - assert_eq!(Lexer::from(b"(".to_vec()).collect::>(), vec![ - Token::LParen + assert_eq!(Lexer::from(b"(".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::LParen, + Position { column: 1, ..Default::default() } + )), ]); // RParen's Token - assert_eq!(Lexer::from(b")".to_vec()).collect::>(), vec![ - Token::RParen + assert_eq!(Lexer::from(b")".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::RParen, + Position { column: 1, ..Default::default() } + )), ]); // Bitor's Token - assert_eq!(Lexer::from(b"|".to_vec()).collect::>(), vec![ - Token::BitOr + assert_eq!(Lexer::from(b"|".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::BitOr, + Position { column: 1, ..Default::default() } + )), ]); // Or's Token - assert_eq!(Lexer::from(b"||".to_vec()).collect::>(), vec![ - Token::Or + assert_eq!(Lexer::from(b"||".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Or, + Position { column: 2, ..Default::default() } + )), ]); // And's Token - assert_eq!(Lexer::from(b"&&".to_vec()).collect::>(), vec![ - Token::And + assert_eq!(Lexer::from(b"&&".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::And, + Position { column: 2, ..Default::default() } + )), ]); // Gt's CmpOp Token - assert_eq!(Lexer::from(b">".to_vec()).collect::>(), vec![ - Token::CmpOp(CmpOp::Gt) + assert_eq!(Lexer::from(b">".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::CmpOp(CmpOp::Gt), + Position { column: 1, ..Default::default() } + )), ]); // Lt's CmpOp Token - assert_eq!(Lexer::from(b"<".to_vec()).collect::>(), vec![ - Token::CmpOp(CmpOp::Lt) + assert_eq!(Lexer::from(b"<".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::CmpOp(CmpOp::Lt), + Position { column: 1, ..Default::default() } + )), ]); // Ge's CmpOp Token - assert_eq!(Lexer::from(b">=".to_vec()).collect::>(), vec![ - Token::CmpOp(CmpOp::Geq) + assert_eq!(Lexer::from(b">=".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::CmpOp(CmpOp::Geq), + Position { column: 2, ..Default::default() } + )), ]); // Le's CmpOp Token - assert_eq!(Lexer::from(b"<=".to_vec()).collect::>(), vec![ - Token::CmpOp(CmpOp::Leq) + assert_eq!(Lexer::from(b"<=".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::CmpOp(CmpOp::Leq), + Position { column: 2, ..Default::default() } + )), ]); // Eq's CmpOp Token - assert_eq!(Lexer::from(b"==".to_vec()).collect::>(), vec![ - Token::CmpOp(CmpOp::Eq) + assert_eq!(Lexer::from(b"==".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::CmpOp(CmpOp::Eq), + Position { column: 2, ..Default::default() } + )), ]); // Neq's CmpOp Token - assert_eq!(Lexer::from(b"!=".to_vec()).collect::>(), vec![ - Token::CmpOp(CmpOp::Neq) + assert_eq!(Lexer::from(b"!=".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::CmpOp(CmpOp::Neq), + Position { column: 2, ..Default::default() } + )), ]); // Equal's Token - assert_eq!(Lexer::from(b"=".to_vec()).collect::>(), vec![ - Token::Equal + assert_eq!(Lexer::from(b"=".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Equal, + Position { column: 1, ..Default::default() } + )), ]); // End's Token - assert_eq!(Lexer::from(b"end".to_vec()).collect::>(), vec![ - Token::End + assert_eq!(Lexer::from(b"end".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::End, + Position { column: 3, ..Default::default() } + )), ]); // Symmetric's Token - assert_eq!(Lexer::from(b"symmetric".to_vec()).collect::>(), vec![ - Token::Symmetric + assert_eq!(Lexer::from(b"symmetric".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Symmetric, + Position { column: 9, ..Default::default() } + )), ]); // AntiSymmetric's Token - assert_eq!(Lexer::from(b"antisymmetric".to_vec()).collect::>(), vec![ - Token::AntiSymmetric + assert_eq!(Lexer::from(b"antisymmetric".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::AntiSymmetric, + Position { column: 13, ..Default::default() } + )), ]); // Arrow's Token - assert_eq!(Lexer::from(b"->".to_vec()).collect::>(), vec![ - Token::Arrow + assert_eq!(Lexer::from(b"->".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Arrow, + Position { column: 2, ..Default::default() } + )), ]); // Divide's Token - assert_eq!(Lexer::from(b"/".to_vec()).collect::>(), vec![ - Token::Divide + assert_eq!(Lexer::from(b"/".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::Divide, + Position { column: 1, ..Default::default() } + )), ]); } #[test] fn comment_mode() { // C_COMMENT's Token - assert_eq!(Lexer::from(b"/* comment */ ".to_vec()).collect::>(), vec![]); - assert_eq!(Lexer::from(b"/* comment \n comment */ ".to_vec()).collect::>(), vec![]); + assert_eq!(Lexer::from(b"/* comment */ ".to_vec()).collect::>(), vec![]); + assert_eq!(Lexer::from(b"/* comment \n comment */ ".to_vec()).collect::>(), vec![]); } + #[test] fn doc_mode() { // Outer Line Doc's Token - assert_eq!(Lexer::from(b"/// comment".to_vec()).collect::>(), vec![ - Token::Doc(String::from(" comment")) + assert_eq!(Lexer::from(b"/// comment".to_vec()).collect::>(), vec![ + Ok((Position { column: 3, ..Default::default() }, + Token::Doc(String::from(" comment")), + Position { column: 0, ..Default::default() } + )), ]); // Outer Line MultiDoc's Token - assert_eq!(Lexer::from(b"/// comment \n /// comment".to_vec()).collect::>(), vec![ - Token::Doc(String::from(" comment ")), - Token::Doc(String::from(" comment")) + assert_eq!(Lexer::from(b"/// comment \n /// comment".to_vec()).collect::>(), vec![ + Ok((Position { column: 3, ..Default::default() }, + Token::Doc(String::from(" comment ")), + Position::default() + )), + Ok((Position { column: 5, line: 1 }, + Token::Doc(String::from(" comment")), + Position { line: 1, ..Default::default() } + )), ]); // Line Comment Doc's Token - assert_eq!(Lexer::from(b"// comment".to_vec()).collect::>(), vec![ - ]); + assert_eq!(Lexer::from(b"// comment".to_vec()).collect::>(), vec![]); // Line Comment MultiDoc's Token - assert_eq!(Lexer::from(b"// comment \n // comment".to_vec()).collect::>(), vec![ - ]); + assert_eq!(Lexer::from(b"// comment \n // comment".to_vec()).collect::>(), vec![]); } From 21e02d6f4df26e6aec88192c14c0562b82e7c790 Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 17 May 2018 08:31:40 +0000 Subject: [PATCH 43/70] move enumerations from l to include/h --- telamon-gen/src/exh.l | 88 +---------------------------------- telamon-gen/src/expression.h | 90 ++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 86 deletions(-) create mode 100644 telamon-gen/src/expression.h diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index c6797564f..1969555e8 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -9,7 +9,7 @@ %x LINE_DOC %{ - #include + #include "expression.h" typedef struct Pos { unsigned int line; @@ -18,6 +18,7 @@ typedef int Data; + // typedef struct Span { Pos leg; Pos end; @@ -31,91 +32,6 @@ yyextra.end.column += yyleng; \ } - enum token { - VALUEIDENT, - CHOICEIDENT, - VAR, - DOC, - CMPOP, - INVALIDTOKEN, - CODE, - COUNTERKIND, - BOOL, - COUNTERVISIBILITY, - AND, - TRIGGER, - WHEN, - ALIAS, - COUNTER, - DEFINE, - ENUM, - EQUAL, - FORALL, - IN, - IS, - NOT, - REQUIRE, - REQUIRES, - VALUE, - END, - SYMMETRIC, - ANTISYMMETRIC, - ARROW, - COLON, - COMMA, - LPAREN, - RPAREN, - BITOR, - OR, - SETDEFKEY, - SET, - SUBSETOF, - SETIDENT, - BASE, - DISJOINT, - QUOTIENT, - OF, - DIVIDE, - }; - - // Indicates whether a counter sums or adds. - enum counter_kind { - ADD, - MUL, - }; - - // Indicates how a counter exposes how its maximum value. - // The variants are ordered by increasing amount of information available. - enum counter_visibility { - // Only the minimal value is computed and stored. - NOMAX, - // Both the min and max are stored, but only the min is exposed. - HIDDENMAX, - // Both the min and the max value are exposed. - FULL, - }; - - enum cmp_op { - LT, - GT, - LEQ, - GEQ, - EQ, - NEQ, - }; - - enum set_def_key { - ITEMTYPE, - IDTYPE, - ITEMGETTER, - IDGETTER, - ITER, - FROMSUPERSET, - PREFIX, - NEWOBJS, - REVERSE, - ADDTOSET, - }; %} num [0-9] diff --git a/telamon-gen/src/expression.h b/telamon-gen/src/expression.h new file mode 100644 index 000000000..a2cb68bf6 --- /dev/null +++ b/telamon-gen/src/expression.h @@ -0,0 +1,90 @@ +#ifndef __EXPRESSION_H__ +#define __EXPRESSION_H__ + +enum token { + VALUEIDENT, + CHOICEIDENT, + VAR, + DOC, + CMPOP, + INVALIDTOKEN, + CODE, + COUNTERKIND, + BOOL, + COUNTERVISIBILITY, + AND, + TRIGGER, + WHEN, + ALIAS, + COUNTER, + DEFINE, + ENUM, + EQUAL, + FORALL, + IN, + IS, + NOT, + REQUIRE, + REQUIRES, + VALUE, + END, + SYMMETRIC, + ANTISYMMETRIC, + ARROW, + COLON, + COMMA, + LPAREN, + RPAREN, + BITOR, + OR, + SETDEFKEY, + SET, + SUBSETOF, + SETIDENT, + BASE, + DISJOINT, + QUOTIENT, + OF, + DIVIDE, +}; + +// Indicates whether a counter sums or adds. +enum counter_kind { + ADD, + MUL, +}; + +// Indicates how a counter exposes how its maximum value. +// The variants are ordered by increasing amount of information available. +enum counter_visibility { + // Only the minimal value is computed and stored. + NOMAX, + // Both the min and max are stored, but only the min is exposed. + HIDDENMAX, + // Both the min and the max value are exposed. + FULL, +}; + +enum cmp_op { + LT, + GT, + LEQ, + GEQ, + EQ, + NEQ, +}; + +enum set_def_key { + ITEMTYPE, + IDTYPE, + ITEMGETTER, + IDGETTER, + ITER, + FROMSUPERSET, + PREFIX, + NEWOBJS, + REVERSE, + ADDTOSET, +}; + +#endif // __EXPRESSION_H__ From 8d06681345a7499319a96076b5edd8867bbccdc3 Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 17 May 2018 08:32:02 +0000 Subject: [PATCH 44/70] documentation renforcement --- telamon-gen/src/lexer/ffi.rs | 14 ++++++++++++-- telamon-gen/src/lexer/mod.rs | 21 +++++++++++++++++---- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index d18beff17..ef1d0a95f 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -2,22 +2,29 @@ use ::libc; use ::ir; -/// https://westes.github.io/flex/manual/About-yyscan_005ft.html +/// A [yyscan](https://westes.github.io/flex/manual/About-yyscan_005ft.html) type is the internal +/// representation of a [yylex_init](https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html) structure. pub type YyScan = *const libc::c_void; +/// State per character. pub type YyBufferState = *const libc::c_void; +/// Unsigned integer type used to represent the sizes f/lex. pub type YySize = libc::size_t; +/// A sequence's row/column position #[derive(Copy, Clone)] #[repr(C)] pub union YyLval { - pub val: libc::c_int, + /// Indicate a comparison operators. pub cmp_op: ir::CmpOp, pub boolean: bool, + /// Indicates whether a counter sums or adds. pub counter_kind: ir::CounterKind, + /// Indicates how a counter exposes how its maximum value. pub counter_visibility: ir::CounterVisibility, pub set_def_key: ir::SetDefKey, } +/// A sequence's row/column position #[derive(Default, Copy, Clone, Debug, PartialEq)] #[repr(C)] pub struct Position { @@ -25,11 +32,13 @@ pub struct Position { pub column: libc::c_uint, } +/// A F/lex's token with a span. #[derive(Copy, Clone, Debug)] #[repr(C)] pub struct Span { pub leg: Position, pub end: Position, + /// Spanned data pub data: Y, } @@ -82,6 +91,7 @@ pub enum YyToken { Quotient, Of, Divide, + /// End-of-File EOF = libc::EOF as _, } diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index 7f9c292bf..0fc789225 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -53,10 +53,14 @@ impl From> for Lexer { unsafe { let scanner: YyScan = ptr::null(); - yylex_init(&scanner); // https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html#index-yylex_005finit + // The function [yylex_init](https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html#index-yylex_005finit) + // innitializes the scanner. + yylex_init(&scanner); Lexer { scanner: scanner, - buffer: yy_scan_bytes(buffer.as_ptr() as *const _, buffer.len() as _, scanner), // https://westes.github.io/flex/manual/Multiple-Input-Buffers.html + // The function [yy_scan_bytes](https://westes.github.io/flex/manual/Multiple-Input-Buffers.html) + // scans len bytes starting at location bytes. + buffer: yy_scan_bytes(buffer.as_ptr() as *const _, buffer.len() as _, scanner), } } } @@ -65,8 +69,12 @@ impl From> for Lexer { impl Drop for Lexer { fn drop(&mut self) { unsafe { - yy_delete_buffer(self.buffer, self.scanner); // https://westes.github.io/flex/manual/Multiple-Input-Buffers.html - yylex_destroy(self.scanner); // https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html#index-yylex_005finit + // The function [yy_delete_buffer](https://westes.github.io/flex/manual/Multiple-Input-Buffers.html) + // clears the current contents of a buffer using. + yy_delete_buffer(self.buffer, self.scanner); + // The function [yylex_destroy](https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html#index-yylex_005finit) + // frees the resources used by the scanner. + yylex_destroy(self.scanner); } } } @@ -76,7 +84,12 @@ impl Iterator for Lexer { fn next(&mut self) -> Option { unsafe { + // The function [yylex](https://westes.github.io/flex/manual/Generated-Scanner.html) + // returns statement in one of the actions, the scanner may then + // be called again and it will resume scanning where it left off. let code: YyToken = yylex(self.scanner); + // The accessor function [yyget_extra](https://westes.github.io/flex/manual/Extra-Data.html) + // returns a extra copy. let extra: YyExtraType = yyget_extra(self.scanner); match code { From 3fe2051744afb343c8843e38e9f87d6284c1c697 Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 17 May 2018 16:44:21 +0200 Subject: [PATCH 45/70] compile lexer with source include for C header --- telamon-gen/build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/telamon-gen/build.rs b/telamon-gen/build.rs index 699157aa8..0e6ffc5a5 100644 --- a/telamon-gen/build.rs +++ b/telamon-gen/build.rs @@ -25,6 +25,7 @@ fn main() { // Compile the lexer . cc::Build::new() .file("exh.c") + .include("src") .flag("-Wno-unused-parameter") .flag("-Wno-unused-variable") .flag_if_supported("-Wno-unused-function") From 50ce1cca2c34b38c416f216b1c600c85ed5253ed Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 17 May 2018 16:47:05 +0200 Subject: [PATCH 46/70] rewrite define extra-type by option extra-type and implemente line/column position for line_doc and c_comment --- telamon-gen/src/exh.l | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/telamon-gen/src/exh.l b/telamon-gen/src/exh.l index 1969555e8..7658017b1 100644 --- a/telamon-gen/src/exh.l +++ b/telamon-gen/src/exh.l @@ -4,6 +4,8 @@ %option noyywrap /* number of the current line § https://westes.github.io/flex/manual/Options-Affecting-Scanner-Behavior.html#index-yylineno */ %option yylineno +/* 19.4.6 Extra Data § https://westes.github.io/flex/manual/Extra-Data.html */ +%option extra-type="Span" %x C_COMMENT %x LINE_DOC @@ -25,7 +27,6 @@ Data data; } Span; - #define YY_EXTRA_TYPE Span #define YY_USER_ACTION { \ yyextra.leg = yyextra.end; \ yyextra.end.line = yylineno; \ @@ -114,12 +115,13 @@ code \"[^\n\"]*\" %% {c_comment_beg} { BEGIN(C_COMMENT); } +[\n] { yyextra.end.line += 1; } {c_comment_end} { BEGIN(INITIAL); } -. {} +. { } -{doc} { BEGIN(LINE_DOC); } -\n { BEGIN(INITIAL); } -[^\n]* { yyextra.end.column = 0; return DOC; } +{doc} { yyextra.end.column -= 3; BEGIN(LINE_DOC); } +\n { yyextra.end.column = 0; BEGIN(INITIAL); } +[^\n]* { yyextra.end.column += 3; return DOC; } [\n] { yyextra.end.column = 0; } From 38555b363105cea0affd655549711d9cdf71a7d1 Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 17 May 2018 16:47:25 +0200 Subject: [PATCH 47/70] recompile lexer --- telamon-gen/exh.c | 711 +++++++++++++++++++++++----------------------- 1 file changed, 352 insertions(+), 359 deletions(-) diff --git a/telamon-gen/exh.c b/telamon-gen/exh.c index 530b75460..9ed32b880 100644 --- a/telamon-gen/exh.c +++ b/telamon-gen/exh.c @@ -180,8 +180,27 @@ typedef size_t yy_size_t; #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - #define YY_LESS_LINENO(n) - #define YY_LINENO_REWIND_TO(ptr) + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE yylex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-yylineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + int yyl;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ + }while(0) + #define YY_LINENO_REWIND_TO(dst) \ + do {\ + const char *p;\ + for ( p = yy_cp-1; p >= (dst); --p)\ + if ( *p == '\n' )\ + --yylineno;\ + }while(0) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -351,8 +370,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 68 -#define YY_END_OF_BUFFER 69 +#define YY_NUM_RULES 70 +#define YY_END_OF_BUFFER 71 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -362,34 +381,34 @@ struct yy_trans_info }; static yyconst flex_int16_t yy_accept[256] = { 0, - 0, 0, 0, 0, 6, 6, 69, 67, 7, 7, - 67, 67, 67, 67, 45, 46, 44, 67, 61, 43, - 51, 56, 50, 65, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 47, 3, 68, 3, 6, 5, 7, 55, - 0, 63, 62, 49, 60, 1, 7, 53, 54, 52, - 65, 66, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 13, 14, 64, 64, - 64, 64, 37, 64, 64, 64, 64, 64, 64, 64, - 64, 48, 2, 6, 7, 4, 64, 64, 64, 64, - - 64, 64, 64, 57, 64, 64, 64, 64, 64, 64, - 64, 64, 16, 64, 15, 64, 64, 64, 36, 64, - 19, 64, 64, 64, 64, 64, 64, 7, 64, 64, - 64, 25, 64, 64, 64, 11, 64, 64, 64, 23, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 41, 64, 64, 21, 64, 8, 64, 64, - 64, 64, 42, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 20, 64, 64, - 64, 64, 10, 64, 12, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - - 64, 64, 9, 64, 64, 64, 28, 64, 64, 64, - 64, 64, 64, 17, 33, 64, 64, 22, 64, 64, - 64, 39, 64, 64, 24, 64, 64, 31, 27, 40, - 18, 38, 64, 64, 64, 64, 64, 30, 64, 26, - 58, 64, 34, 64, 64, 64, 32, 64, 64, 29, - 64, 64, 59, 35, 0 + 0, 0, 0, 0, 7, 7, 71, 69, 9, 8, + 69, 69, 69, 69, 47, 48, 46, 69, 63, 45, + 53, 58, 52, 67, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 49, 4, 2, 4, 7, 6, 9, 57, + 0, 65, 64, 51, 62, 1, 9, 55, 56, 54, + 67, 68, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 15, 16, 66, 66, + 66, 66, 39, 66, 66, 66, 66, 66, 66, 66, + 66, 50, 3, 7, 9, 5, 66, 66, 66, 66, + + 66, 66, 66, 59, 66, 66, 66, 66, 66, 66, + 66, 66, 18, 66, 17, 66, 66, 66, 38, 66, + 21, 66, 66, 66, 66, 66, 66, 9, 66, 66, + 66, 27, 66, 66, 66, 13, 66, 66, 66, 25, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 43, 66, 66, 23, 66, 10, 66, 66, + 66, 66, 44, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 22, 66, 66, + 66, 66, 12, 66, 14, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + + 66, 66, 11, 66, 66, 66, 30, 66, 66, 66, + 66, 66, 66, 19, 35, 66, 66, 24, 66, 66, + 66, 41, 66, 66, 26, 66, 66, 33, 29, 42, + 20, 40, 66, 66, 66, 66, 66, 32, 66, 28, + 60, 66, 36, 66, 66, 66, 34, 66, 66, 31, + 66, 66, 61, 37, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -435,35 +454,35 @@ static yyconst flex_int32_t yy_meta[47] = static yyconst flex_int16_t yy_base[265] = { 0, - 0, 0, 44, 45, 285, 284, 286, 289, 47, 49, - 268, 279, 0, 276, 289, 289, 289, 264, 43, 289, - 264, 263, 262, 43, 34, 257, 242, 35, 242, 38, - 0, 254, 41, 233, 36, 247, 231, 246, 42, 232, - 248, 240, 221, 289, 289, 253, 0, 289, 67, 289, - 260, 289, 0, 289, 289, 289, 251, 289, 289, 289, - 58, 0, 0, 239, 233, 221, 221, 218, 232, 218, - 50, 224, 217, 219, 221, 232, 211, 0, 225, 217, - 205, 207, 0, 211, 42, 205, 60, 211, 56, 54, - 218, 289, 289, 0, 0, 289, 222, 220, 211, 214, - - 204, 208, 206, 0, 202, 195, 212, 199, 205, 61, - 205, 56, 0, 209, 0, 188, 186, 201, 0, 186, - 0, 191, 196, 197, 180, 200, 185, 0, 178, 178, - 177, 0, 175, 180, 178, 0, 187, 179, 190, 0, - 184, 163, 169, 186, 184, 169, 174, 173, 163, 175, - 174, 171, 0, 172, 160, 0, 160, 0, 149, 168, - 167, 162, 0, 158, 150, 148, 151, 152, 63, 145, - 162, 158, 144, 142, 140, 139, 153, 0, 139, 156, - 142, 136, 0, 139, 0, 131, 131, 145, 148, 143, - 122, 131, 135, 130, 138, 137, 126, 122, 121, 133, - - 118, 123, 0, 115, 118, 128, 0, 120, 111, 114, - 111, 109, 107, 107, 0, 119, 115, 0, 117, 117, - 116, 0, 115, 101, 0, 98, 112, 0, 0, 0, - 0, 0, 113, 106, 94, 93, 94, 0, 104, 0, - 0, 81, 0, 83, 74, 64, 0, 71, 74, 0, - 75, 56, 0, 0, 289, 103, 107, 111, 113, 115, - 92, 119, 123, 127 + 0, 0, 44, 45, 281, 280, 282, 285, 279, 285, + 263, 274, 0, 271, 285, 285, 285, 259, 39, 285, + 259, 258, 257, 37, 26, 252, 237, 34, 237, 32, + 0, 249, 37, 228, 37, 242, 226, 241, 39, 227, + 243, 235, 216, 285, 285, 248, 0, 285, 258, 285, + 254, 285, 0, 285, 285, 285, 245, 285, 285, 285, + 54, 0, 0, 233, 227, 215, 215, 212, 226, 212, + 41, 218, 211, 213, 215, 226, 205, 0, 219, 211, + 199, 201, 0, 205, 41, 199, 53, 205, 40, 47, + 212, 285, 285, 0, 0, 285, 216, 214, 205, 208, + + 198, 202, 200, 0, 196, 189, 206, 193, 199, 60, + 199, 55, 0, 203, 0, 182, 180, 195, 0, 180, + 0, 185, 190, 191, 174, 194, 179, 0, 172, 172, + 171, 0, 169, 174, 172, 0, 181, 173, 184, 0, + 178, 157, 163, 180, 178, 163, 168, 167, 157, 169, + 168, 165, 0, 166, 154, 0, 154, 0, 143, 162, + 161, 156, 0, 152, 144, 142, 145, 146, 62, 139, + 156, 152, 138, 136, 134, 133, 147, 0, 133, 150, + 136, 130, 0, 133, 0, 125, 125, 139, 142, 137, + 116, 125, 129, 124, 132, 131, 120, 116, 115, 127, + + 112, 117, 0, 109, 112, 122, 0, 114, 105, 108, + 105, 103, 101, 101, 0, 113, 109, 0, 111, 111, + 110, 0, 109, 95, 0, 92, 106, 0, 0, 0, + 0, 0, 105, 95, 80, 72, 63, 0, 74, 0, + 0, 54, 0, 59, 57, 57, 0, 65, 67, 0, + 68, 50, 0, 0, 285, 102, 106, 110, 112, 114, + 63, 118, 122, 126 } ; static yyconst flex_int16_t yy_def[265] = @@ -499,88 +518,96 @@ static yyconst flex_int16_t yy_def[265] = 255, 255, 255, 255 } ; -static yyconst flex_int16_t yy_nxt[336] = +static yyconst flex_int16_t yy_nxt[332] = { 0, 8, 9, 10, 11, 12, 13, 14, 15, 16, 8, 17, 18, 19, 8, 20, 21, 22, 23, 24, 8, 25, 26, 27, 28, 29, 30, 31, 32, 33, 31, 31, 31, 34, 35, 36, 31, 37, 38, 39, 40, - 31, 41, 42, 31, 31, 43, 45, 45, 49, 49, - 49, 49, 56, 46, 46, 57, 61, 64, 72, 69, - 81, 61, 61, 70, 76, 65, 86, 66, 49, 49, - 82, 61, 73, 104, 77, 74, 61, 61, 117, 78, - 79, 120, 87, 118, 123, 125, 88, 141, 144, 190, - 105, 126, 121, 145, 63, 254, 124, 253, 252, 251, - - 142, 250, 191, 44, 44, 44, 44, 47, 47, 47, - 47, 51, 249, 51, 51, 53, 53, 62, 62, 94, - 248, 94, 94, 95, 247, 95, 95, 128, 246, 128, - 128, 245, 244, 243, 242, 241, 240, 239, 238, 237, - 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, - 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, - 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, - 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, - 196, 195, 194, 193, 192, 189, 188, 187, 186, 185, - 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, - - 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, - 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, - 154, 153, 152, 151, 150, 149, 148, 147, 146, 143, - 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, - 130, 129, 127, 122, 119, 116, 115, 114, 113, 112, - 111, 110, 109, 108, 107, 106, 103, 102, 101, 100, - 99, 98, 97, 96, 52, 93, 92, 91, 90, 89, - 85, 84, 83, 80, 75, 71, 68, 67, 60, 59, - 58, 55, 54, 52, 50, 255, 48, 48, 7, 255, + 31, 41, 42, 31, 31, 43, 45, 45, 56, 64, + 61, 57, 72, 46, 46, 61, 61, 65, 69, 66, + 76, 81, 70, 86, 104, 63, 73, 61, 123, 74, + 77, 82, 61, 61, 120, 78, 79, 117, 125, 87, + 124, 105, 118, 88, 126, 121, 141, 144, 190, 254, + 253, 252, 145, 251, 250, 249, 248, 247, 246, 142, + + 245, 191, 44, 44, 44, 44, 47, 47, 47, 47, + 51, 244, 51, 51, 53, 53, 62, 62, 94, 243, + 94, 94, 95, 242, 95, 95, 128, 241, 128, 128, + 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, + 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, + 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, + 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, + 200, 199, 198, 197, 196, 195, 194, 193, 192, 189, + 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, + 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, + + 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, + 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, + 148, 147, 146, 143, 140, 139, 138, 137, 136, 135, + 134, 133, 132, 131, 130, 129, 127, 122, 119, 116, + 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, + 103, 102, 101, 100, 99, 98, 97, 96, 52, 49, + 93, 92, 91, 90, 89, 85, 84, 83, 80, 75, + 71, 68, 67, 60, 59, 58, 55, 54, 52, 50, + 49, 255, 48, 48, 7, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255 + 255 } ; -static yyconst flex_int16_t yy_chk[336] = +static yyconst flex_int16_t yy_chk[332] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 4, 9, 9, - 10, 10, 19, 3, 4, 19, 24, 25, 30, 28, - 35, 24, 24, 28, 33, 25, 39, 25, 49, 49, - 35, 61, 30, 71, 33, 30, 61, 61, 85, 33, - 33, 87, 39, 85, 89, 90, 39, 110, 112, 169, - 71, 90, 87, 112, 261, 252, 89, 251, 249, 248, - - 110, 246, 169, 256, 256, 256, 256, 257, 257, 257, - 257, 258, 245, 258, 258, 259, 259, 260, 260, 262, - 244, 262, 262, 263, 242, 263, 263, 264, 239, 264, - 264, 237, 236, 235, 234, 233, 227, 226, 224, 223, - 221, 220, 219, 217, 216, 214, 213, 212, 211, 210, - 209, 208, 206, 205, 204, 202, 201, 200, 199, 198, - 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, - 187, 186, 184, 182, 181, 180, 179, 177, 176, 175, - 174, 173, 172, 171, 170, 168, 167, 166, 165, 164, - 162, 161, 160, 159, 157, 155, 154, 152, 151, 150, - - 149, 148, 147, 146, 145, 144, 143, 142, 141, 139, - 138, 137, 135, 134, 133, 131, 130, 129, 127, 126, - 125, 124, 123, 122, 120, 118, 117, 116, 114, 111, - 109, 108, 107, 106, 105, 103, 102, 101, 100, 99, - 98, 97, 91, 88, 86, 84, 82, 81, 80, 79, - 77, 76, 75, 74, 73, 72, 70, 69, 68, 67, - 66, 65, 64, 57, 51, 46, 43, 42, 41, 40, - 38, 37, 36, 34, 32, 29, 27, 26, 23, 22, - 21, 18, 14, 12, 11, 7, 6, 5, 255, 255, + 1, 1, 1, 1, 1, 1, 3, 4, 19, 25, + 24, 19, 30, 3, 4, 24, 24, 25, 28, 25, + 33, 35, 28, 39, 71, 261, 30, 61, 89, 30, + 33, 35, 61, 61, 87, 33, 33, 85, 90, 39, + 89, 71, 85, 39, 90, 87, 110, 112, 169, 252, + 251, 249, 112, 248, 246, 245, 244, 242, 239, 110, + + 237, 169, 256, 256, 256, 256, 257, 257, 257, 257, + 258, 236, 258, 258, 259, 259, 260, 260, 262, 235, + 262, 262, 263, 234, 263, 263, 264, 233, 264, 264, + 227, 226, 224, 223, 221, 220, 219, 217, 216, 214, + 213, 212, 211, 210, 209, 208, 206, 205, 204, 202, + 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, + 191, 190, 189, 188, 187, 186, 184, 182, 181, 180, + 179, 177, 176, 175, 174, 173, 172, 171, 170, 168, + 167, 166, 165, 164, 162, 161, 160, 159, 157, 155, + 154, 152, 151, 150, 149, 148, 147, 146, 145, 144, + + 143, 142, 141, 139, 138, 137, 135, 134, 133, 131, + 130, 129, 127, 126, 125, 124, 123, 122, 120, 118, + 117, 116, 114, 111, 109, 108, 107, 106, 105, 103, + 102, 101, 100, 99, 98, 97, 91, 88, 86, 84, + 82, 81, 80, 79, 77, 76, 75, 74, 73, 72, + 70, 69, 68, 67, 66, 65, 64, 57, 51, 49, + 46, 43, 42, 41, 40, 38, 37, 36, 34, 32, + 29, 27, 26, 23, 22, 21, 18, 14, 12, 11, + 9, 7, 6, 5, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255 + 255 } ; +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[71] = + { 0, +0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -589,103 +616,37 @@ static yyconst flex_int16_t yy_chk[336] = #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET #line 1 "src/exh.l" +/* 19 Reentrant C Scanners § https://westes.github.io/flex/manual/Reentrant.html#Reentrant */ +/* https://westes.github.io/flex/manual/I-get-an-error-about-undefined-yywrap_0028_0029_002e.html#I-get-an-error-about-undefined-yywrap_0028_0029_002e */ +/* number of the current line § https://westes.github.io/flex/manual/Options-Affecting-Scanner-Behavior.html#index-yylineno */ +/* 19.4.6 Extra Data § https://westes.github.io/flex/manual/Extra-Data.html */ + + +#line 14 "src/exh.l" + #include "expression.h" + + typedef struct Pos { + unsigned int line; + unsigned int column; + } Pos; + + typedef int Data; + + // + typedef struct Span { + Pos leg; + Pos end; + Data data; + } Span; + #define YY_USER_ACTION { \ + yyextra.leg = yyextra.end; \ + yyextra.end.line = yylineno; \ + yyextra.end.column += yyleng; \ + } -#line 8 "src/exh.l" - #include - - union yylval { - int val; - } yylval; - - enum token { - VALUEIDENT, - CHOICEIDENT, - VAR, - DOC, - CMPOP, - INVALIDTOKEN, - CODE, - COUNTERKIND, - BOOL, - COUNTERVISIBILITY, - AND, - TRIGGER, - WHEN, - ALIAS, - COUNTER, - DEFINE, - ENUM, - EQUAL, - FORALL, - IN, - IS, - NOT, - REQUIRE, - REQUIRES, - VALUE, - END, - SYMMETRIC, - ANTISYMMETRIC, - ARROW, - COLON, - COMMA, - LPAREN, - RPAREN, - BITOR, - OR, - SETDEFKEY, - SET, - SUBSETOF, - SETIDENT, - BASE, - DISJOINT, - QUOTIENT, - OF, - DIVIDE, - }; - - // Indicates whether a counter sums or adds. - enum counter_kind { - ADD, - MUL, - }; - - // Indicates how a counter exposes how its maximum value. - // The variants are ordered by increasing amount of information available. - enum counter_visibility { - // Only the minimal value is computed and stored. - NOMAX, - // Both the min and max are stored, but only the min is exposed. - HIDDENMAX, - // Both the min and the max value are exposed. - FULL, - }; - - enum cmp_op { - LT, - GT, - LEQ, - GEQ, - EQ, - NEQ, - }; - - enum set_def_key { - ITEMTYPE, - IDTYPE, - ITEMGETTER, - IDGETTER, - ITER, - FROMSUPERSET, - PREFIX, - NEWOBJS, - REVERSE, - ADDTOSET, - }; -/* https://github.com/a-haas/Compilation/blob/6fe46a65d64decdb648feba790bb7b1d2980ca0a/yacc/setparser.l */ -/* 6 Patterns § http://westes.github.io/flex/manual/Patterns.html#Patterns */ -#line 689 "exh.c" +/* Patterns documentation: http://westes.github.io/flex/manual/Patterns.html#Patterns */ +#line 650 "exh.c" #define INITIAL 0 #define C_COMMENT 1 @@ -699,9 +660,7 @@ static yyconst flex_int16_t yy_chk[336] = #include #endif -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif +#define YY_EXTRA_TYPE Span /* Holds the entire state of the reentrant scanner. */ struct yyguts_t @@ -939,10 +898,10 @@ YY_DECL } { -#line 180 "src/exh.l" +#line 115 "src/exh.l" -#line 946 "exh.c" +#line 905 "exh.c" while ( 1 ) /* loops until end-of-file is reached */ { @@ -975,7 +934,7 @@ YY_DECL yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 289 ); + while ( yy_base[yy_current_state] != 285 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -988,6 +947,18 @@ YY_DECL YY_DO_BEFORE_ACTION; + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + yy_size_t yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + do{ yylineno++; + yycolumn=0; + }while(0) +; + } + do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) @@ -1001,353 +972,364 @@ YY_DECL case 1: YY_RULE_SETUP -#line 182 "src/exh.l" +#line 117 "src/exh.l" { BEGIN(C_COMMENT); } YY_BREAK case 2: +/* rule 2 can match eol */ YY_RULE_SETUP -#line 183 "src/exh.l" -{ BEGIN(INITIAL); } +#line 118 "src/exh.l" +{ yyextra.end.line += 1; } YY_BREAK case 3: YY_RULE_SETUP -#line 184 "src/exh.l" -{} +#line 119 "src/exh.l" +{ BEGIN(INITIAL); } YY_BREAK case 4: YY_RULE_SETUP -#line 186 "src/exh.l" -{ BEGIN(LINE_DOC); } +#line 120 "src/exh.l" +{ } YY_BREAK case 5: -/* rule 5 can match eol */ YY_RULE_SETUP -#line 187 "src/exh.l" -{ BEGIN(INITIAL); } +#line 122 "src/exh.l" +{ yyextra.end.column -= 3; BEGIN(LINE_DOC); } YY_BREAK case 6: +/* rule 6 can match eol */ YY_RULE_SETUP -#line 188 "src/exh.l" -{ return DOC; } +#line 123 "src/exh.l" +{ yyextra.end.column = 0; BEGIN(INITIAL); } YY_BREAK case 7: -/* rule 7 can match eol */ YY_RULE_SETUP -#line 190 "src/exh.l" -{} +#line 124 "src/exh.l" +{ yyextra.end.column += 3; return DOC; } YY_BREAK case 8: +/* rule 8 can match eol */ YY_RULE_SETUP -#line 192 "src/exh.l" -{ return ALIAS; } +#line 126 "src/exh.l" +{ yyextra.end.column = 0; } YY_BREAK case 9: YY_RULE_SETUP -#line 193 "src/exh.l" -{ return COUNTER; } +#line 128 "src/exh.l" +{} YY_BREAK case 10: YY_RULE_SETUP -#line 194 "src/exh.l" -{ return DEFINE; } +#line 130 "src/exh.l" +{ return ALIAS; } YY_BREAK case 11: YY_RULE_SETUP -#line 195 "src/exh.l" -{ return ENUM; } +#line 131 "src/exh.l" +{ return COUNTER; } YY_BREAK case 12: YY_RULE_SETUP -#line 196 "src/exh.l" -{ return FORALL; } +#line 132 "src/exh.l" +{ return DEFINE; } YY_BREAK case 13: YY_RULE_SETUP -#line 197 "src/exh.l" -{ return IN; } +#line 133 "src/exh.l" +{ return ENUM; } YY_BREAK case 14: YY_RULE_SETUP -#line 198 "src/exh.l" -{ return IS; } +#line 134 "src/exh.l" +{ return FORALL; } YY_BREAK case 15: YY_RULE_SETUP -#line 199 "src/exh.l" -{ return NOT; } +#line 135 "src/exh.l" +{ return IN; } YY_BREAK case 16: YY_RULE_SETUP -#line 200 "src/exh.l" -{yylval.val = MUL; return COUNTERKIND; } +#line 136 "src/exh.l" +{ return IS; } YY_BREAK case 17: YY_RULE_SETUP -#line 201 "src/exh.l" -{ return REQUIRE; } +#line 137 "src/exh.l" +{ return NOT; } YY_BREAK case 18: YY_RULE_SETUP -#line 202 "src/exh.l" -{ return REQUIRES; } +#line 138 "src/exh.l" +{ yyextra.data = MUL; return COUNTERKIND; } YY_BREAK case 19: YY_RULE_SETUP -#line 203 "src/exh.l" -{yylval.val = ADD; return COUNTERKIND; } +#line 139 "src/exh.l" +{ return REQUIRE; } YY_BREAK case 20: YY_RULE_SETUP -#line 204 "src/exh.l" -{ return VALUE; } +#line 140 "src/exh.l" +{ return REQUIRES; } YY_BREAK case 21: YY_RULE_SETUP -#line 205 "src/exh.l" -{ return WHEN; } +#line 141 "src/exh.l" +{ yyextra.data = ADD; return COUNTERKIND; } YY_BREAK case 22: YY_RULE_SETUP -#line 206 "src/exh.l" -{ return TRIGGER; } +#line 142 "src/exh.l" +{ return VALUE; } YY_BREAK case 23: YY_RULE_SETUP -#line 207 "src/exh.l" -{yylval.val = NOMAX; return COUNTERVISIBILITY; } +#line 143 "src/exh.l" +{ return WHEN; } YY_BREAK case 24: YY_RULE_SETUP -#line 208 "src/exh.l" -{yylval.val = HIDDENMAX; return COUNTERVISIBILITY; } +#line 144 "src/exh.l" +{ return TRIGGER; } YY_BREAK case 25: YY_RULE_SETUP -#line 209 "src/exh.l" -{ return BASE; } +#line 145 "src/exh.l" +{ yyextra.data = NOMAX; return COUNTERVISIBILITY; } YY_BREAK case 26: YY_RULE_SETUP -#line 211 "src/exh.l" -{yylval.val = ITEMTYPE; return SETDEFKEY; } +#line 146 "src/exh.l" +{ yyextra.data = HIDDENMAX; return COUNTERVISIBILITY; } YY_BREAK case 27: YY_RULE_SETUP -#line 212 "src/exh.l" -{yylval.val = NEWOBJS; return SETDEFKEY; } +#line 147 "src/exh.l" +{ return BASE; } YY_BREAK case 28: YY_RULE_SETUP -#line 213 "src/exh.l" -{yylval.val = IDTYPE; return SETDEFKEY; } +#line 149 "src/exh.l" +{ yyextra.data = ITEMTYPE; return SETDEFKEY; } YY_BREAK case 29: YY_RULE_SETUP -#line 214 "src/exh.l" -{yylval.val = ITEMGETTER; return SETDEFKEY; } +#line 150 "src/exh.l" +{ yyextra.data = NEWOBJS; return SETDEFKEY; } YY_BREAK case 30: YY_RULE_SETUP -#line 215 "src/exh.l" -{yylval.val = IDGETTER; return SETDEFKEY; } +#line 151 "src/exh.l" +{ yyextra.data = IDTYPE; return SETDEFKEY; } YY_BREAK case 31: YY_RULE_SETUP -#line 216 "src/exh.l" -{yylval.val = ITER; return SETDEFKEY; } +#line 152 "src/exh.l" +{ yyextra.data = ITEMGETTER; return SETDEFKEY; } YY_BREAK case 32: YY_RULE_SETUP -#line 217 "src/exh.l" -{yylval.val = PREFIX; return SETDEFKEY; } +#line 153 "src/exh.l" +{ yyextra.data = IDGETTER; return SETDEFKEY; } YY_BREAK case 33: YY_RULE_SETUP -#line 218 "src/exh.l" -{yylval.val = REVERSE; return SETDEFKEY; } +#line 154 "src/exh.l" +{ yyextra.data = ITER; return SETDEFKEY; } YY_BREAK case 34: YY_RULE_SETUP -#line 219 "src/exh.l" -{yylval.val = ADDTOSET; return SETDEFKEY; } +#line 155 "src/exh.l" +{ yyextra.data = PREFIX; return SETDEFKEY; } YY_BREAK case 35: YY_RULE_SETUP -#line 220 "src/exh.l" -{yylval.val = FROMSUPERSET; return SETDEFKEY; } +#line 156 "src/exh.l" +{ yyextra.data = REVERSE; return SETDEFKEY; } YY_BREAK case 36: YY_RULE_SETUP -#line 221 "src/exh.l" -{ return SET; } +#line 157 "src/exh.l" +{ yyextra.data = ADDTOSET; return SETDEFKEY; } YY_BREAK case 37: YY_RULE_SETUP -#line 222 "src/exh.l" -{ return OF; } +#line 158 "src/exh.l" +{ yyextra.data = FROMSUPERSET; return SETDEFKEY; } YY_BREAK case 38: YY_RULE_SETUP -#line 223 "src/exh.l" -{ return SUBSETOF; } +#line 159 "src/exh.l" +{ return SET; } YY_BREAK case 39: YY_RULE_SETUP -#line 224 "src/exh.l" -{ return DISJOINT; } +#line 160 "src/exh.l" +{ return OF; } YY_BREAK case 40: YY_RULE_SETUP -#line 225 "src/exh.l" -{ return QUOTIENT; } +#line 161 "src/exh.l" +{ return SUBSETOF; } YY_BREAK case 41: YY_RULE_SETUP -#line 226 "src/exh.l" -{yylval.val = 1; return BOOL; } +#line 162 "src/exh.l" +{ return DISJOINT; } YY_BREAK case 42: YY_RULE_SETUP -#line 227 "src/exh.l" -{yylval.val = 0; return BOOL; } +#line 163 "src/exh.l" +{ return QUOTIENT; } YY_BREAK case 43: YY_RULE_SETUP -#line 229 "src/exh.l" -{ return COLON; } +#line 164 "src/exh.l" +{ yyextra.data = 1; return BOOL; } YY_BREAK case 44: YY_RULE_SETUP -#line 230 "src/exh.l" -{ return COMMA; } +#line 165 "src/exh.l" +{ yyextra.data = 0; return BOOL; } YY_BREAK case 45: YY_RULE_SETUP -#line 231 "src/exh.l" -{ return LPAREN; } +#line 167 "src/exh.l" +{ return COLON; } YY_BREAK case 46: YY_RULE_SETUP -#line 232 "src/exh.l" -{ return RPAREN; } +#line 168 "src/exh.l" +{ return COMMA; } YY_BREAK case 47: YY_RULE_SETUP -#line 233 "src/exh.l" -{ return BITOR; } +#line 169 "src/exh.l" +{ return LPAREN; } YY_BREAK case 48: YY_RULE_SETUP -#line 234 "src/exh.l" -{ return OR; } +#line 170 "src/exh.l" +{ return RPAREN; } YY_BREAK case 49: YY_RULE_SETUP -#line 235 "src/exh.l" -{ return AND; } +#line 171 "src/exh.l" +{ return BITOR; } YY_BREAK case 50: YY_RULE_SETUP -#line 236 "src/exh.l" -{yylval.val = GT; return CMPOP; } +#line 172 "src/exh.l" +{ return OR; } YY_BREAK case 51: YY_RULE_SETUP -#line 237 "src/exh.l" -{yylval.val = LT; return CMPOP; } +#line 173 "src/exh.l" +{ return AND; } YY_BREAK case 52: YY_RULE_SETUP -#line 238 "src/exh.l" -{yylval.val = GEQ; return CMPOP; } +#line 174 "src/exh.l" +{ yyextra.data = GT; return CMPOP; } YY_BREAK case 53: YY_RULE_SETUP -#line 239 "src/exh.l" -{yylval.val = LEQ; return CMPOP; } +#line 175 "src/exh.l" +{ yyextra.data = LT; return CMPOP; } YY_BREAK case 54: YY_RULE_SETUP -#line 240 "src/exh.l" -{yylval.val = EQ; return CMPOP; } +#line 176 "src/exh.l" +{ yyextra.data = GEQ; return CMPOP; } YY_BREAK case 55: YY_RULE_SETUP -#line 241 "src/exh.l" -{yylval.val = NEQ; return CMPOP; } +#line 177 "src/exh.l" +{ yyextra.data = LEQ; return CMPOP; } YY_BREAK case 56: YY_RULE_SETUP -#line 242 "src/exh.l" -{ return EQUAL; } +#line 178 "src/exh.l" +{ yyextra.data = EQ; return CMPOP; } YY_BREAK case 57: YY_RULE_SETUP -#line 243 "src/exh.l" -{ return END; } +#line 179 "src/exh.l" +{ yyextra.data = NEQ; return CMPOP; } YY_BREAK case 58: YY_RULE_SETUP -#line 244 "src/exh.l" -{ return SYMMETRIC; } +#line 180 "src/exh.l" +{ return EQUAL; } YY_BREAK case 59: YY_RULE_SETUP -#line 245 "src/exh.l" -{ return ANTISYMMETRIC; } +#line 181 "src/exh.l" +{ return END; } YY_BREAK case 60: YY_RULE_SETUP -#line 246 "src/exh.l" -{ return ARROW; } +#line 182 "src/exh.l" +{ return SYMMETRIC; } YY_BREAK case 61: YY_RULE_SETUP -#line 247 "src/exh.l" -{ return DIVIDE; } +#line 183 "src/exh.l" +{ return ANTISYMMETRIC; } YY_BREAK case 62: YY_RULE_SETUP -#line 249 "src/exh.l" -{ yytext++; return VAR; } +#line 184 "src/exh.l" +{ return ARROW; } YY_BREAK case 63: YY_RULE_SETUP -#line 250 "src/exh.l" -{ yytext++; return CODE; } +#line 185 "src/exh.l" +{ return DIVIDE; } YY_BREAK case 64: YY_RULE_SETUP -#line 251 "src/exh.l" -{ return CHOICEIDENT; } +#line 187 "src/exh.l" +{ yytext++; return VAR; } YY_BREAK case 65: YY_RULE_SETUP -#line 252 "src/exh.l" -{ return VALUEIDENT; } +#line 188 "src/exh.l" +{ yytext++; return CODE; } YY_BREAK case 66: YY_RULE_SETUP -#line 253 "src/exh.l" +#line 189 "src/exh.l" +{ return CHOICEIDENT; } + YY_BREAK +case 67: +YY_RULE_SETUP +#line 190 "src/exh.l" +{ return VALUEIDENT; } + YY_BREAK +case 68: +YY_RULE_SETUP +#line 191 "src/exh.l" { return SETIDENT; } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(C_COMMENT): case YY_STATE_EOF(LINE_DOC): -#line 254 "src/exh.l" +#line 192 "src/exh.l" { return EOF; } YY_BREAK -case 67: +case 69: YY_RULE_SETUP -#line 255 "src/exh.l" +#line 193 "src/exh.l" { return INVALIDTOKEN; } YY_BREAK -case 68: +case 70: YY_RULE_SETUP -#line 256 "src/exh.l" +#line 194 "src/exh.l" ECHO; YY_BREAK -#line 1351 "exh.c" +#line 1333 "exh.c" case YY_END_OF_BUFFER: { @@ -1712,6 +1694,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner) *--yy_cp = (char) c; + if ( c == '\n' ){ + --yylineno; + } + yyg->yytext_ptr = yy_bp; yyg->yy_hold_char = *yy_cp; yyg->yy_c_buf_p = yy_cp; @@ -1788,6 +1774,13 @@ static int yy_get_next_buffer (yyscan_t yyscanner) *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ yyg->yy_hold_char = *++yyg->yy_c_buf_p; + if ( c == '\n' ) + + do{ yylineno++; + yycolumn=0; + }while(0) +; + return c; } #endif /* ifndef YY_NO_INPUT */ @@ -2498,7 +2491,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 256 "src/exh.l" +#line 194 "src/exh.l" From ec6da002c8a1a01562837df1a282e1e774b61d55 Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 17 May 2018 16:48:17 +0200 Subject: [PATCH 48/70] add case for line/colum of line/doc and c_comment --- telamon-gen/tests/lexer.rs | 48 +++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index a83958eee..86acb1cc0 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -426,27 +426,53 @@ fn comment_mode() { // C_COMMENT's Token assert_eq!(Lexer::from(b"/* comment */ ".to_vec()).collect::>(), vec![]); assert_eq!(Lexer::from(b"/* comment \n comment */ ".to_vec()).collect::>(), vec![]); -} + assert_eq!(Lexer::from(b"| /* comment */ |".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::BitOr, + Position { column: 1, ..Default::default() } + )), + Ok((Position { column: 16, ..Default::default() }, + Token::BitOr, + Position { column: 17, ..Default::default() } + )), + ]); + assert_eq!(Lexer::from(b"| /* comment \n comment */ |".to_vec()).collect::>(), vec![ + Ok((Position::default(), + Token::BitOr, + Position { column: 1, ..Default::default() } + )), + Ok((Position { column: 26, line: 1 }, + Token::BitOr, + Position { column: 27, line: 1 } + )), + ]); +} #[test] fn doc_mode() { // Outer Line Doc's Token - assert_eq!(Lexer::from(b"/// comment".to_vec()).collect::>(), vec![ - Ok((Position { column: 3, ..Default::default() }, - Token::Doc(String::from(" comment")), - Position { column: 0, ..Default::default() } + assert_eq!(Lexer::from(b"/// comment ".to_vec()).collect::>(), vec![ + Ok((Position { column: 0, ..Default::default() }, + Token::Doc(String::from(" comment ")), + Position { column: 12, ..Default::default() } + )), + ]); + assert_eq!(Lexer::from(b" /// comment ".to_vec()).collect::>(), vec![ + Ok((Position { column: 1, ..Default::default() }, + Token::Doc(String::from(" comment ")), + Position { column: 13, ..Default::default() } )), ]); // Outer Line MultiDoc's Token - assert_eq!(Lexer::from(b"/// comment \n /// comment".to_vec()).collect::>(), vec![ - Ok((Position { column: 3, ..Default::default() }, + assert_eq!(Lexer::from(b"/// comment \n /// comment ".to_vec()).collect::>(), vec![ + Ok((Position { column: 0, ..Default::default() }, Token::Doc(String::from(" comment ")), - Position::default() + Position { column: 12, ..Default::default() }, )), - Ok((Position { column: 5, line: 1 }, - Token::Doc(String::from(" comment")), - Position { line: 1, ..Default::default() } + Ok((Position { column: 1, line: 1 }, + Token::Doc(String::from(" comment ")), + Position { column: 13, line: 1 } )), ]); // Line Comment Doc's Token From 2aef8fdba0894def19724e32c9cf3171324c667c Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 17 May 2018 16:50:13 +0200 Subject: [PATCH 49/70] the destructor of lexer clears the disingenuous yylineno --- telamon-gen/src/lexer/ffi.rs | 1 + telamon-gen/src/lexer/mod.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index ef1d0a95f..9a6af0aaa 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -103,6 +103,7 @@ extern { pub fn yyget_extra(yyscanner: YyScan) -> YyExtraType; pub fn yylex(yyscanner: YyScan) -> YyToken; pub fn yyget_text(yyscanner: YyScan) -> *mut libc::c_char; + pub fn yyset_lineno(line_number: libc::c_int, yyscanner: YyScan) -> libc::c_int; pub fn yy_delete_buffer(b: YyBufferState, yyscanner: YyScan); pub fn yylex_destroy(yyscanner: YyScan) -> libc::c_int; } diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index 0fc789225..190965ef8 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -17,13 +17,13 @@ use self::ffi::{ YyExtraType, yylex_init, yy_scan_bytes, + yyset_lineno, yy_delete_buffer, yylex_destroy, yylex, YyToken, yyget_text, yyget_extra, - }; pub use self::ffi::Position; @@ -69,6 +69,9 @@ impl From> for Lexer { impl Drop for Lexer { fn drop(&mut self) { unsafe { + // The function [yyset_lineno](https://westes.github.io/flex/manual/Reentrant-Functions.html#index-yyset_005flineno) + // clears the current line number. + yyset_lineno(0, self.scanner); // The function [yy_delete_buffer](https://westes.github.io/flex/manual/Multiple-Input-Buffers.html) // clears the current contents of a buffer using. yy_delete_buffer(self.buffer, self.scanner); From 99989ffe926aa3ba567bf9c684e181cc4a50c39e Mon Sep 17 00:00:00 2001 From: adjivas Date: Thu, 17 May 2018 17:57:09 +0200 Subject: [PATCH 50/70] InvalidToken is now returned as error from the lexer part --- telamon-gen/src/lexer/mod.rs | 5 +++-- telamon-gen/tests/lexer.rs | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index 190965ef8..aebb26ed6 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -28,8 +28,9 @@ use self::ffi::{ pub use self::ffi::Position; -#[derive(Copy, Clone, Debug, PartialEq)] +#[derive(Debug, PartialEq)] pub enum LexicalError { + UnexpectedToken(Position, Token, Position), } pub type Spanned = Result<(P, T, P), E>; @@ -101,7 +102,7 @@ impl Iterator for Lexer { CStr::from_ptr(out) .to_str().ok() - .and_then(|s: &str| Some(Ok((extra.leg, Token::InvalidToken(s.to_owned()), extra.end)))) + .and_then(|s: &str| Some(Err(LexicalError::UnexpectedToken(extra.leg, Token::InvalidToken(s.to_owned()), extra.end)))) }, YyToken::ChoiceIdent => { let out = yyget_text(self.scanner); diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index 86acb1cc0..023bb7e8f 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -7,7 +7,8 @@ use telamon_gen::ir::{CounterKind, CounterVisibility, SetDefKey, CmpOp}; fn initial() { // Invalid's Token assert_eq!(Lexer::from(b"!".to_vec()).collect::>(), vec![ - Ok((Position::default(), + Err(LexicalError::UnexpectedToken( + Position::default(), Token::InvalidToken(String::from("!")), Position { column: 1, ..Default::default() } )), From 69a5d0d4a5d227e5be37fc3f776771f000dfefcd Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 18 May 2018 13:54:08 +0200 Subject: [PATCH 51/70] move Invalid from Token to LexicalError --- telamon-gen/src/lexer/mod.rs | 3 ++- telamon-gen/src/lexer/token.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index aebb26ed6..b0692dc44 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -30,6 +30,7 @@ pub use self::ffi::Position; #[derive(Debug, PartialEq)] pub enum LexicalError { + InvalidToken(Position, String, Position), UnexpectedToken(Position, Token, Position), } @@ -102,7 +103,7 @@ impl Iterator for Lexer { CStr::from_ptr(out) .to_str().ok() - .and_then(|s: &str| Some(Err(LexicalError::UnexpectedToken(extra.leg, Token::InvalidToken(s.to_owned()), extra.end)))) + .and_then(|s: &str| Some(Err(LexicalError::InvalidToken(extra.leg, s.to_owned(), extra.end)))) }, YyToken::ChoiceIdent => { let out = yyget_text(self.scanner); diff --git a/telamon-gen/src/lexer/token.rs b/telamon-gen/src/lexer/token.rs index b2f80d999..7d960c097 100644 --- a/telamon-gen/src/lexer/token.rs +++ b/telamon-gen/src/lexer/token.rs @@ -3,7 +3,7 @@ use ir; #[derive(Debug, PartialEq)] pub enum Token { ValueIdent(String), ChoiceIdent(String), Var(String), Doc(String), CmpOp(ir::CmpOp), - InvalidToken(String), Code(String), CounterKind(ir::CounterKind), Bool(bool), + Code(String), CounterKind(ir::CounterKind), Bool(bool), CounterVisibility(ir::CounterVisibility), And, Trigger, When, Alias, Counter, Define, Enum, Equal, Forall, In, Is, Not, Require, Requires, Value, End, Symmetric, AntiSymmetric, Arrow, Colon, Comma, LParen, RParen, From 95c38a5c9f1093968e055a41c27f257b24184d43 Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 18 May 2018 13:55:42 +0200 Subject: [PATCH 52/70] add macro pub_generated_file to create a public module for extern usages like parser test --- telamon-utils/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/telamon-utils/src/lib.rs b/telamon-utils/src/lib.rs index 709f61d23..12d217cea 100644 --- a/telamon-utils/src/lib.rs +++ b/telamon-utils/src/lib.rs @@ -176,6 +176,17 @@ macro_rules! generated_file { } } +/// Pulbic includes a generates file into the current file. +#[macro_export] +macro_rules! pub_generated_file { + ($name:ident) => { + #[cfg_attr(feature = "cargo-clippy", allow(clippy))] + pub mod $name { + include!(concat!(env!("OUT_DIR"), "/", stringify!($name), ".rs")); + } + } +} + /// Clones a pair of reference. pub fn clone_pair(p: (&T1, &T2)) -> (T1, T2) { (p.0.clone(), p.1.clone()) From c79588bc5325ec4595aaac409fbd4f1ed9f0075f Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 18 May 2018 13:56:49 +0200 Subject: [PATCH 53/70] parse is now a public module, process/file can now returns a parser error --- telamon-gen/src/lib.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/telamon-gen/src/lib.rs b/telamon-gen/src/lib.rs index ad180045e..786322910 100644 --- a/telamon-gen/src/lib.rs +++ b/telamon-gen/src/lib.rs @@ -13,16 +13,22 @@ extern crate telamon_utils as utils; extern crate topological_sort; extern crate libc; +extern crate lalrpop_util; + mod ast; mod constraint; mod flat_filter; pub mod ir; pub mod lexer; -generated_file!(parser); +pub_generated_file!(parser); mod print; mod truth_table; use std::{fs, io, path}; +use std::ffi::OsString; + +use lalrpop_util::ParseError; + use utils::*; /// Converts a choice name to a rust type name. @@ -45,19 +51,24 @@ fn to_type_name(name: &str) -> String { } /// Process a file and stores the result in an other file. -pub fn process_file(input_path: &path::Path, output_path: &path::Path, format: bool) { +pub fn process_file(input_path: &path::Path, output_path: &path::Path, + format: bool) -> Result<(), (ParseError, OsString)> { let mut input = fs::File::open(path::Path::new(input_path)).unwrap(); let mut output = fs::File::create(path::Path::new(output_path)).unwrap(); let input_path_str = input_path.to_string_lossy(); info!("compiling {} to {}", input_path_str, output_path.to_string_lossy()); - process(&mut input, &mut output, format); + process(&mut input, &mut output, format) + .map_err(|e| (e, input_path.file_name().unwrap().to_os_string())) } /// Parses a constraint description file. -pub fn process(input: &mut io::Read, output: &mut T, format: bool) { +pub fn process(input: &mut io::Read, output: &mut T, + format: bool) -> Result<(), ParseError> { // Parse and check the input. let tokens = lexer::Lexer::new(input); - let ast = parser::parse_ast(tokens).ok().unwrap(); + let ast: ast::Ast = parser::parse_ast(tokens)?; let (mut ir_desc, constraints) = ast.type_check(); debug!("constraints: {:?}", constraints); // Generate flat filters. @@ -106,6 +117,7 @@ pub fn process(input: &mut io::Read, output: &mut T, format: bool) } else { write!(output, "{}", code).unwrap(); } + Ok(()) } // TODO(cleanup): avoid name conflicts in the printer From 2889ac06ca9f8cc7495942a488804abaac485e91 Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 18 May 2018 13:58:27 +0200 Subject: [PATCH 54/70] invalidToken checks for lexer\&parser --- telamon-gen/tests/lexer.rs | 4 ++-- telamon-gen/tests/parser.rs | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 telamon-gen/tests/parser.rs diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index 023bb7e8f..341bb88b6 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -7,9 +7,9 @@ use telamon_gen::ir::{CounterKind, CounterVisibility, SetDefKey, CmpOp}; fn initial() { // Invalid's Token assert_eq!(Lexer::from(b"!".to_vec()).collect::>(), vec![ - Err(LexicalError::UnexpectedToken( + Err(LexicalError::InvalidToken( Position::default(), - Token::InvalidToken(String::from("!")), + String::from("!"), Position { column: 1, ..Default::default() } )), ]); diff --git a/telamon-gen/tests/parser.rs b/telamon-gen/tests/parser.rs new file mode 100644 index 000000000..bade8477c --- /dev/null +++ b/telamon-gen/tests/parser.rs @@ -0,0 +1,20 @@ +extern crate telamon_gen; +extern crate lalrpop_util; + +use telamon_gen::lexer::{Lexer, LexicalError, Position}; +use telamon_gen::parser; + +use lalrpop_util::ParseError; + +#[test] +fn invalid_token() { + assert_eq!(parser::parse_ast(Lexer::from(b"!".to_vec())).err(), Some( + ParseError::User { + error: LexicalError::InvalidToken( + Position::default(), + String::from("!"), + Position { column: 1, ..Default::default() } + ), + } + )); +} From 997e3d98bab35214812d770e5ee8db46e8a5754a Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 18 May 2018 13:59:08 +0200 Subject: [PATCH 55/70] unwrap returns of process/file --- telamon-gen/cc_tests/build.rs | 2 +- telamon-gen/src/bin/cli_gen.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/telamon-gen/cc_tests/build.rs b/telamon-gen/cc_tests/build.rs index b15331bb8..69664118d 100644 --- a/telamon-gen/cc_tests/build.rs +++ b/telamon-gen/cc_tests/build.rs @@ -14,6 +14,6 @@ fn main() { let file_name = src_path.file_name().unwrap(); println!("cargo:rerun-if-changed={}", file_name.to_str().unwrap()); let dst_path = Path::new(&out_dir).join(&file_name).with_extension("rs"); - telamon_gen::process_file(&src_path, &dst_path, !cfg!(feature="noformat_exh")); + telamon_gen::process_file(&src_path, &dst_path, !cfg!(feature="noformat_exh")).unwrap(); } } diff --git a/telamon-gen/src/bin/cli_gen.rs b/telamon-gen/src/bin/cli_gen.rs index b79abb9ea..8638f5579 100644 --- a/telamon-gen/src/bin/cli_gen.rs +++ b/telamon-gen/src/bin/cli_gen.rs @@ -4,5 +4,5 @@ extern crate env_logger; fn main() { env_logger::init(); - telamon_gen::process(&mut std::io::stdin(), &mut std::io::stdout(), true); + telamon_gen::process(&mut std::io::stdin(), &mut std::io::stdout(), true).unwrap(); } From 39a59f0913fd1008adc712a4e980af0f17a904c9 Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 18 May 2018 14:06:55 +0200 Subject: [PATCH 56/70] solve merge --- .travis.yml | 89 ++---- README.md | 4 +- data/cuda_gpus.json | 160 +++++++---- examples/common.rs | 34 +-- kernels/src/kernel.rs | 19 +- kernels/src/linalg.rs | 17 +- src/codegen/cfg.rs | 228 +++++++++------ src/codegen/dimension.rs | 3 +- src/codegen/function.rs | 23 +- src/codegen/namer.rs | 13 + src/device/context.rs | 2 +- src/device/cuda/api/jit_daemon.rs | 2 +- src/device/cuda/context.rs | 20 +- src/device/cuda/gpu.rs | 129 +++++---- src/device/cuda/mem_model.rs | 41 ++- src/device/cuda/printer.rs | 100 +++++-- src/device/mod.rs | 10 +- src/explorer/choice.rs | 23 +- src/helper/builder.rs | 27 +- src/helper/mod.rs | 14 +- src/helper/tensor.rs | 7 + src/ir/dimension.rs | 13 +- src/ir/function.rs | 29 +- src/ir/mod.rs | 7 +- src/ir/operator.rs | 60 ++-- src/model/hw_pressure.rs | 17 +- src/model/level.rs | 54 ++-- src/model/local_info.rs | 129 +++++---- src/model/mod.rs | 376 ++++++++++++++++++++----- src/search_space/choices.exh | 131 ++++----- src/search_space/mod.rs | 12 +- telamon-gen/src/print/template/main.rs | 1 + telamon-utils/src/vec_set.rs | 11 +- tests/common/fake.rs | 10 +- tests/common/mod.rs | 4 +- tests/cuda.rs | 14 +- tests/lib.rs | 2 +- tools/bench_perf_model/main.rs | 4 +- tools/cuda_characterize/gen.rs | 98 ++++--- tools/cuda_characterize/gpu.rs | 15 +- tools/cuda_characterize/instruction.rs | 38 ++- tools/cuda_characterize/main.rs | 1 - 42 files changed, 1270 insertions(+), 721 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7be60c5f0..87c59cf32 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,84 +1,33 @@ ---- language: rust cache: cargo -# kcov currently broken on travis for non-sudo builds § https://github.com/roblabla/cargo-travis/issues/32 -sudo: required +sudo: false rust: - - nightly - stable addons: apt: packages: - # F/lex depedencies (needed by telamon-gen) § https://github.com/ulysseB/telamon/blob/989621f5cf1099fda6ba14b4eda18b1cd9d4660a/telamon-gen/build.rs#L14 - flex - - # Criterion's dependency Quickstart § https://github.com/japaric/criterion.rs#quickstart - - gnuplot - - # Kcov's Installing dependencies § https://github.com/SimonKagstrom/kcov/blob/master/INSTALL.md#ubuntu - - binutils-dev - - libcurl4-openssl-dev - - zlib1g-dev - - libdw-dev - - libiberty-dev - before_script: - flex --version - script: - - | - if [ $TRAVIS_RUST_VERSION == "nightly" ]; - then - cargo test --no-run --all - cargo doc --no-deps --all - else - cargo test --all - cargo doc --all - fi - - -after_success: - # Kcov's Building § https://github.com/SimonKagstrom/kcov/blob/master/INSTALL.md#building - - git clone https://github.com/SimonKagstrom/kcov.git - - mkdir kcov/build - - cd kcov/build - - cmake .. - - make - - make install DESTDIR=../.. - - cd - - - - | - for file in target/debug/telamon*[^\.d]; - do - mkdir -p "target/cov/$(basename $file)"; - - # Kcov's Travis-ci / coveralls integration § https://github.com/SimonKagstrom/kcov/blob/master/doc/coveralls.md#travis-ci--coveralls-integration - ./usr/local/bin/kcov --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; - done - - - mv target/cov target/doc - - # Criterion's run Quickstart § https://github.com/japaric/criterion.rs#quickstart - - | - if [ $TRAVIS_RUST_VERSION == "nightly" ]; - then - cd telamon-gen - cargo bench - cd - - mv telamon-gen/target/criterion target/doc - fi - + - cd telamon-gen && LEX="flex" cargo build --features "lex" --verbose + - cargo test --verbose --all + - cargo doc --no-deps --verbose --all deploy: - - provider: pages - local-dir: target/doc - target-branch: gh-pages - skip-cleanup: true - keep-history: false - github-token: "$GITHUB_TOKEN" - on: - condition: $TRAVIS_RUST_VERSION = nightly - + provider: pages + local-dir: target/doc + target-branch: gh-pages + skip-cleanup: true + keep-history: true + github-token: "$GITHUB_TOKEN" + on: + branch: master +notifications: + slack: + rooms: + secure: bhOU59RYPbvA8GXYtL4JTGjKRbrOFyni2wjAV0gWQqwP9lkzYWlYDlsoHOFIR+DLhwN0Or2d5Sw47Ic3NLGrzhPOFcXNBhoRUy4QBUPWaKETEJbqjG/UvYRbfGr7ajosQdL1pDMuem8NFXdNcSCgnHu9Wgtim1EjO82rdc4YGPSCcHkfHpCncM435vXcDhtdz/ks9pF4igmJH0frhXTAkngckggaR2xx1cUAlrc4ztc03goe+uFC3Iti1QAp2DGMFx9hLvV1CjATeqSA4/65idUS0aEWccK2tNwLjp3nL3LAwwymCr4OWS8wCD0p1lk3Fvcc3FTX2fw6TfGciaFNCwAO+0FD5tJD+Uez+QllN4cufKrbwQo9ZlRP0fFsx38QJ1FeK8k/uk0hR7MzqypzkCNwG6NBI98L71P2sFvA15gELuI9sWhx655PwFzmjNwYw/zCeimp9pi+bNbYoWjckkwbN7ArwJjPt47vv/bIJbo/NrmNxFghZm4RTQW45prolMUqGO9AeIMf7oP24pPdEv3v9oH7lF/97tCBLt9Nd7LhwizK6nG/VFFCofwdIfBqlGDwJufN3UoMqVezkHqRuZa+tDgU9SuUrfAe1XnAc1+HbDzza55LM+3tzHn4sPr1jmlLIEHww2Yub4GpxBJYl+8MhusRbGhedqtpqeLk3LE= + on_success: change + on_failure: change env: global: - - TRAVIS_CARGO_NIGHTLY_FEATURE="nightly" - - secure: T7ao3Xly60lrporBe0RChgoqLAQ8OGegUHYmQ6ZQJJqRwKansrJkd0S4w6ZtLYMqzwX03ycI+B9euPY0km3uSxysssBNJamqLyw2my9+zIOR31+6rP/+MeH1/GPcvJF5foGZAoLwxxIp+wF/5FvsqhgpfoIT1GHDylMKFGuq9lleWc1i03xAV341avjRMi9O23fEpAHEixlXl0rIGl1k6PeUy0nP0bktxk+0Z1pFdi89w3EfCSE5GESWQhylB+vI2CHFDj7rTAMRO1J5KYEcXjpKGPpdYdmJz7Egp3qimIzdNUiIJxEJOdXUtys2thuf/R8r/neGiP757OX/MDJ0DT7sxqmKeF85BTc8X2KjPgRcjOsSXL5xEmkgRm9UaR2qiBrvpCxCM0EIoIUADMwDbMUCpNzWrPGFCL6SxR8zDc9/aSUWr2Mt41MX7oNWxViQLQACIuh5xnved8c01gsseBCUkyMXybisiZtNts/AolBS5Ayu/qAp0ocZn9xKy7pCxSmLNfl7EVozEjDI8qegv23apqdseGNv2QtR5vM7t4SYsNnBsQosoC5DIICy7BiX0fboKP1qKHFMhJGekka3ky9/wCHbaZb205PLZ9GxEkHVfuOxsFOdszglGZtknvKqdwnxt04gqs33iL6o/1GGOcRiEdvOqhWWrbz+nMUQqV8= + secure: ZLjUSECDu2ewLa2eJ8DepE7b3tuQxR81tbUxFtSBKKj6IVZPppzS7CUcVZxE46Xp+pug9KKApACOfqfqil5hRaSHKtqoVoOf/sYPJs+xA3JdmVBmqVYj0YViCA5WCxVU1J5BIEDVLTqJy7y3zBy8OYP2fNquNLEBUL7r0jn/+tjbuZfrwzN2PUqL/l7YyQVT/UgdpaXzVkvAcjGEL4nXpcSLb+a0g49PSQNcJhoLiYoZziUZH6buKllBzyBszBk4f/yO+wrvs334FaVw0DBbngIyUcQyzJT56eck22AJXlTl88DpJOUPakFTTJ1oa7UG6MTD46QMp2F/LK+ASNXwT5Q1OIsk67/CltZiWLXGBmdaAX2CJXor5vClNX3kEs0jCVCxMAOwfCmbTAz9cklb0rsoHXWYO3E39L3JhcVeZjwIvfI31d1cFrTjEwIVnUBQLmPYJyp9ndjc4kj7X/NUwD9SqrquIoEDW6mtCHlGmIDnkMJYQXNEwnoenFsSA+nbq9f/zoZVYUxmPYmRyHTCSNHVABUKYp3sK7HsRREwYwLm5slADH+K5loNYcxPgVJuH+mP7SAnJ6A8BTe4qxZK/bxjGr3ltSumWN2Ao9eC+PiAxG2QXGXHNeBtnrX0QxGkYZ5hjZndfAovjxjSsQ1kObnOOdwCSw4V93zFNzHthOQ= diff --git a/README.md b/README.md index 600b2738d..7f4362713 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ performance model is guaranteed to never drop good candidates. ## Building -Telamon requires a nightly version of the rust toolchain. It can be installed with the +Telamon requires vesion 1.26 or higher of the rust toolchain. It can be installed with the following command: ```bash -$ curl -s https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly +$ curl -s https://static.rust-lang.org/rustup.sh | sh -s ``` You can build Telamon using Rust package manager: diff --git a/data/cuda_gpus.json b/data/cuda_gpus.json index 120f443f1..9cc4a4385 100644 --- a/data/cuda_gpus.json +++ b/data/cuda_gpus.json @@ -27,8 +27,9 @@ "alu": 4.8629999999999995, "sync": 3.242, "mem": 0.8105, - "l1_lines_from_l2": 0.3266707434457142, - "l2_lines_from_l2": 0.8120779631268731, + "l1_lines_from_l2": 0.3266707434457143, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 134.784 }, "smx_rates": { @@ -37,8 +38,9 @@ "alu": 155.61599999999999, "sync": 103.744, "mem": 25.936, - "l1_lines_from_l2": 0.3266707434457142, - "l2_lines_from_l2": 0.8120779631268731, + "l1_lines_from_l2": 0.3266707434457143, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 134.784 }, "gpu_rates": { @@ -47,8 +49,9 @@ "alu": 622.4639999999999, "sync": 414.976, "mem": 103.744, - "l1_lines_from_l2": 1.3066829737828567, - "l2_lines_from_l2": 3.2483118525074923, + "l1_lines_from_l2": 1.306682973782857, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 134.784 }, "add_f32_inst": { @@ -58,7 +61,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "add_f64_inst": { @@ -68,7 +72,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "add_i32_inst": { @@ -78,7 +83,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "add_i64_inst": { @@ -88,7 +94,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "mul_f32_inst": { @@ -98,7 +105,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "mul_f64_inst": { @@ -108,7 +116,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "mul_i32_inst": { @@ -118,7 +127,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "mul_i64_inst": { @@ -128,7 +138,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "mul_wide_inst": { @@ -138,7 +149,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "mad_f32_inst": { @@ -148,7 +160,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "mad_f64_inst": { @@ -158,7 +171,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "mad_i32_inst": { @@ -168,7 +182,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "mad_i64_inst": { @@ -178,7 +193,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "mad_wide_inst": { @@ -188,7 +204,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "div_f32_inst": { @@ -198,7 +215,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "div_f64_inst": { @@ -208,7 +226,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "div_i32_inst": { @@ -218,7 +237,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "div_i64_inst": { @@ -228,7 +248,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "syncthread_inst": { @@ -238,7 +259,8 @@ "sync": 1.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "loop_init_overhead": { @@ -248,7 +270,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "loop_iter_overhead": { @@ -258,7 +281,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": null, + "l2_lines_stored": null, "ram_bw": 0.0 }, "loop_end_latency": 22.0 @@ -278,7 +302,7 @@ "l1_cache_line": 128, "l2_cache_size": 393216, "l2_cache_line": 32, - "load_l2_latency": 164.0, + "load_l2_latency": 167.0, "load_ram_latency": 275.0, "shared_bank_stride": 8, "load_shared_latency": 24.0, @@ -291,8 +315,9 @@ "alu": 4.8629999999999995, "sync": 3.242, "mem": 0.8105, - "l1_lines_from_l2": 0.3266707434457142, - "l2_lines_from_l2": 0.8120779631268731, + "l1_lines_from_l2": 0.32718730035484433, + "l2_lines_read": 0.8133942139141441, + "l2_lines_stored": 0.8100633049430036, "ram_bw": 134.784 }, "smx_rates": { @@ -301,8 +326,9 @@ "alu": 155.61599999999999, "sync": 103.744, "mem": 25.936, - "l1_lines_from_l2": 0.3266707434457142, - "l2_lines_from_l2": 0.8120779631268731, + "l1_lines_from_l2": 0.32718730035484433, + "l2_lines_read": 0.8133942139141441, + "l2_lines_stored": 0.8100633049430036, "ram_bw": 134.784 }, "gpu_rates": { @@ -311,8 +337,9 @@ "alu": 622.4639999999999, "sync": 414.976, "mem": 103.744, - "l1_lines_from_l2": 1.3066829737828567, - "l2_lines_from_l2": 3.2483118525074923, + "l1_lines_from_l2": 1.3087492014193773, + "l2_lines_read": 3.2535768556565765, + "l2_lines_stored": 3.2402532197720144, "ram_bw": 134.784 }, "add_f32_inst": { @@ -322,7 +349,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "add_f64_inst": { @@ -332,7 +360,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "add_i32_inst": { @@ -342,7 +371,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "add_i64_inst": { @@ -352,7 +382,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "mul_f32_inst": { @@ -362,7 +393,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "mul_f64_inst": { @@ -372,7 +404,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "mul_i32_inst": { @@ -382,7 +415,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "mul_i64_inst": { @@ -392,7 +426,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "mul_wide_inst": { @@ -402,7 +437,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "mad_f32_inst": { @@ -412,7 +448,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "mad_f64_inst": { @@ -422,7 +459,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "mad_i32_inst": { @@ -432,7 +470,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "mad_i64_inst": { @@ -442,7 +481,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "mad_wide_inst": { @@ -452,7 +492,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "div_f32_inst": { @@ -462,7 +503,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "div_f64_inst": { @@ -472,7 +514,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "div_i32_inst": { @@ -482,7 +525,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "div_i64_inst": { @@ -492,7 +536,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "syncthread_inst": { @@ -502,7 +547,8 @@ "sync": 1.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "loop_init_overhead": { @@ -512,7 +558,8 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "loop_iter_overhead": { @@ -522,9 +569,10 @@ "sync": 0.0, "mem": 0.0, "l1_lines_from_l2": 0.0, - "l2_lines_from_l2": 0.0, + "l2_lines_read": 0.0, + "l2_lines_stored": 0.0, "ram_bw": 0.0 }, "loop_end_latency": 22.0 } -] +] \ No newline at end of file diff --git a/examples/common.rs b/examples/common.rs index 9dd8f6648..1336e1bc3 100644 --- a/examples/common.rs +++ b/examples/common.rs @@ -1,10 +1,7 @@ /// Function shared among examples. -use rayon::prelude::*; use itertools::Itertools; -use telamon::device::{ArgMap, Context}; +use telamon::device::Context; use telamon::{explorer, ir}; -use telamon::helper::SignatureBuilder; -use telamon::helper::tensor::DimSize; use telamon::search_space::SearchSpace; use std; @@ -26,24 +23,6 @@ pub fn gen_best<'a>(search_space: Vec, } } -/// Creates a `DimSize`. If the instantiate flag is true, it uses a constant size, -/// otherwise it creates a parameter with the given name. -pub fn create_size<'a, AM>(value: i32, name: &'a str, - is_generic: bool, - builder: &mut SignatureBuilder) - -> DimSize<'a> where AM: ArgMap + Context -{ - if is_generic { - builder.scalar(name, value); - DimSize::Param(name) - } else { DimSize::Const(value as u32) } -} - -/// Removes tiles of size 1. -pub fn cleanup_tiling(tiling: &[u32]) -> Vec { - tiling.iter().cloned().filter(|&t| t > 1).collect() -} - /// Generate a name for the output file. pub fn file_name(name: &str, _: ir::Type, @@ -54,14 +33,3 @@ pub fn file_name(name: &str, let sizes = sizes.iter().format_with("", |i, f| f(&format_args!("_{}", i))); format!("{}{}_{}{}.c", PATH, name, instantiated, sizes) } - -pub fn par_iter_product(i1: I1, i2: I2) - -> impl ParallelIterator -where - I1: IntoParallelIterator, I1::Item: Clone + Sync, - I2: IntoParallelIterator + Clone + Send + Sync -{ - i1.into_par_iter().flat_map(move |x| { - i2.clone().into_par_iter().map(move |y| (x.clone(), y)) - }) -} diff --git a/kernels/src/kernel.rs b/kernels/src/kernel.rs index 3f55539eb..6897c5291 100644 --- a/kernels/src/kernel.rs +++ b/kernels/src/kernel.rs @@ -74,7 +74,7 @@ pub trait Kernel<'a>: Sized { let leaf = local_selection::descend(order, context, candidate, CUT); if let Some(leaf) = leaf { let device_fn = codegen::Function::build(&leaf.space); - unwrap!(context.evaluate(&device_fn), + unwrap!(context.evaluate(&device_fn, device::EvalMode::FindBest), "evaluation failed for kernel {}, with actions {:?}", Self::name(), leaf.actions); if let Err(err) = kernel.check_result(&expected_output, context) { @@ -112,7 +112,12 @@ pub trait Kernel<'a>: Sized { let leaves = Mutex::new(Vec::new()); let num_tested = atomic::AtomicUsize::new(0); context.async_eval(num_cpus::get(), device::EvalMode::TestBound, &|evaluator| { - while num_tested.fetch_add(1, atomic::Ordering::SeqCst) < num_tests { + loop { + if num_tested.fetch_add(1, atomic::Ordering::SeqCst) >= num_tests { + if num_tested.fetch_sub(1, atomic::Ordering::SeqCst) > num_tests { + break; + } + } if let Some((leaf, bounds)) = descend_check_bounds(&candidates, context) { let leaves = &leaves; evaluator.add_kernel(leaf, (move |leaf: Candidate, runtime: f64, _| { @@ -245,10 +250,12 @@ pub fn analyze_bounds(mut bounds: Vec) { println!("{}% worst error: {}", i*100/num_printed, bounds[index]); } } - if num_errors != bounds.len() { - for i in 0..NUM_QUANTILES { - let index = (i+1)*(bounds.len()-num_errors)/NUM_QUANTILES - 1; - println!("{}% worst: {}", (i+1)*100/NUM_QUANTILES, bounds[num_errors + index]); + if num_errors < bounds.len() { + let num_bounds = bounds.len() - num_errors; + let num_quantiles = std::cmp::min(NUM_QUANTILES, num_bounds); + for i in 0..num_quantiles { + let index = (i+1)*(num_bounds/num_quantiles) - 1; + println!("{}% worst: {}", (i+1)*100/num_quantiles, bounds[num_errors + index]); } } } diff --git a/kernels/src/linalg.rs b/kernels/src/linalg.rs index beeaec438..2849b2075 100644 --- a/kernels/src/linalg.rs +++ b/kernels/src/linalg.rs @@ -53,7 +53,6 @@ impl<'a, S> Kernel<'a> for Axpy<'a, S> where S: Scalar { let y_op = ld_y.dim_map(&[&mad_dim], GlobalScope, &mut builder); let mad = VirtualTensor::new(builder.mad(&x_op, &"alpha", &y_op), vec![mad_dim]); mad.store(&self.z, &mut builder); - vec![builder.get()] } @@ -299,7 +298,7 @@ impl<'a, S: Scalar> Kernel<'a> for MatMul<'a, S> { // TODO(search_space): more tilings let mn_log2 = std::cmp::min(m_log2, n_log2); let t1_max = std::cmp::min(mn_log2, 6); - let t2_max = std::cmp::min(k_log2, 5); + let t2_max = std::cmp::min(k_log2, 4); let tilings = (0..t1_max).into_par_iter().flat_map(|t1| { (0..std::cmp::min(mn_log2-t1, t2_max)).into_par_iter() .map(move |t2| (1u32 << t1, 1u32 << t2)) @@ -331,16 +330,14 @@ impl<'a, S: Scalar> Kernel<'a> for MatMul<'a, S> { builder.order(&st_c.inst(), &acc_dim_k, Order::AFTER); // Arbitrary constrains to reduce the search space // TODO(search_space): remove arbitrary decisions. - builder.action(Action::InstFlag(ld_a.inst(), InstFlag::MEM_CG | InstFlag::MEM_NC)); - builder.action(Action::InstFlag(ld_b.inst(), InstFlag::MEM_CG | InstFlag::MEM_NC)); - builder.action(Action::InstFlag(st_c.inst(), InstFlag::MEM_CS)); + //builder.action(Action::InstFlag(ld_a.inst(), InstFlag::MEM_CG | InstFlag::MEM_NC)); + //builder.action(Action::InstFlag(ld_b.inst(), InstFlag::MEM_CG | InstFlag::MEM_NC)); + //builder.action(Action::InstFlag(st_c.inst(), InstFlag::MEM_CS)); - builder.action(Action::DimKind(init_dim_n[0], DimKind::BLOCK)); - builder.action(Action::DimKind(init_dim_m[0], DimKind::BLOCK)); + //builder.action(Action::DimKind(init_dim_n[0], DimKind::BLOCK)); + //builder.action(Action::DimKind(init_dim_m[0], DimKind::BLOCK)); builder.get() - /*builder.action(Action::DimKind(thread_dim_0_n, DimKind::THREAD_Y)); - builder.action(Action::DimKind(thread_dim_0_m, DimKind::THREAD_X)); - builder.action(Action::DimKind(unroll_dim_0_n, DimKind::UNROLL)); + /*builder.action(Action::DimKind(unroll_dim_0_n, DimKind::UNROLL)); builder.action(Action::DimKind(unroll_dim_0_m, DimKind::UNROLL)); builder.order(unroll_dim_0_n.into(), unroll_dim_0_m.into(), Order::OUTER); builder.order(unroll_dim_1_n.into(), unroll_dim_1_m.into(), Order::INNER); diff --git a/src/codegen/cfg.rs b/src/codegen/cfg.rs index aa2f3c3ef..55c528f6f 100644 --- a/src/codegen/cfg.rs +++ b/src/codegen/cfg.rs @@ -1,6 +1,6 @@ use codegen::{Dimension, InductionLevel, Instruction}; use ir; -use search_space::{DimKind, Order, SearchSpace}; +use search_space::{DimKind, Order, SearchSpace, ThreadMapping}; use itertools::Itertools; use std::{self, fmt}; @@ -12,76 +12,136 @@ pub enum Cfg<'a> { Loop(Dimension<'a>, Vec>), /// Represents an instruction in the CFG. Instruction(Instruction<'a>), - /// Represent a syncthread instruction of the targeted device. - Barrier, - /// Computes an induction variable level, compatible with parallel dimension. - ParallelInductionLevel(InductionLevel<'a>), + /// Defines the set of active thread dimensions. + Threads(Vec, Vec>, Vec>), } impl<'a> Cfg<'a> { /// Iterates over the dimensions of the `Cfg`. pub fn dimensions(&self) -> impl Iterator> { match *self { - Cfg::Root(ref body) => + Cfg::Root(ref body) | Cfg::Threads(_, _, ref body) => Box::new(body.iter().flat_map(|cfg| cfg.dimensions())) as Box>, Cfg::Loop(ref dim, ref body) => { let body_dims = body.iter().flat_map(|cfg| cfg.dimensions()); Box::new(std::iter::once(dim).chain(body_dims)) as _ }, - Cfg::Instruction(_) | Cfg::Barrier | Cfg::ParallelInductionLevel(..) => - Box::new(std::iter::empty()) as _, - + Cfg::Instruction(..) => Box::new(std::iter::empty()) as _, } } /// Iterates over the instructions of the `Cfg`. pub fn instructions(&self) -> impl Iterator> { match *self { - Cfg::Root(ref body) | Cfg::Loop(_, ref body) => { + Cfg::Root(ref body) | + Cfg::Loop(_, ref body) | + Cfg::Threads(_, _, ref body) => { let iter = body.iter().flat_map(|cfg| cfg.instructions()); Box::new(iter) as Box> } Cfg::Instruction(ref inst) => Box::new(std::iter::once(inst)) as _, - _ => Box::new(std::iter::empty()) as _, } } - /// Iterates over the induction levels of the `Cfg`. - pub fn induction_levels(&self) -> impl Iterator { + /// Iterates over the induction levels in the `Cfg`. + pub fn induction_levels(&self) -> impl Iterator> { match *self { - Cfg::Root(ref body) | - Cfg::Loop(_, ref body) => { - let inner = body.iter().flat_map(|cfg| cfg.induction_levels()); - Box::new(inner) as Box> - }, - Cfg::Instruction(_) | Cfg::Barrier => Box::new(std::iter::empty()) as _, - Cfg::ParallelInductionLevel(ref level) => Box::new(std::iter::once(level)) as _, + Cfg::Threads(_, ref ind_levels, ref body) => { + let levels = body.iter().flat_map(|c| c.induction_levels()) + .chain(ind_levels); + Box::new(levels) as Box> + } + Cfg::Root(ref body) => + Box::new(body.iter().flat_map(|c| c.induction_levels())), + Cfg::Loop(ref dim, ref body) => + Box::new(body.iter().flat_map(|c| c.induction_levels()) + .chain(dim.induction_levels())), + Cfg::Instruction(..) => Box::new(std::iter::empty()) } } /// Builds a CFG from a list of `CfgEvent`. - fn from_events(events: &mut IT) -> Cfg<'a> where IT: Iterator> { + fn body_from_events(events: &mut std::iter::Peekable, + num_thread_dims: usize) -> Vec> + where IT: Iterator> + { use self::CfgEvent::*; let mut body = vec![]; - loop { - match events.next() { - Some(Exec(inst)) => body.push(Cfg::Instruction(inst)), - Some(Enter(_, EntryEvent::SeqDim)) => body.push(Cfg::from_events(events)), - Some(Enter(_, EntryEvent::ParallelInductionLevel(ind_level))) => - body.push(Cfg::ParallelInductionLevel(ind_level)), - Some(Exit(_, ExitEvent::Threads)) => body.push(Cfg::Barrier), - Some(Exit(_, ExitEvent::SeqDim(dim))) => - return Cfg::Loop(dim, body), - None => { - if let Some(&Cfg::Barrier) = body.last() { body.pop(); } - return Cfg::Root(body) - }, + while let Some(event) = events.next() { + match event { + Exec(inst) => body.push(Cfg::Instruction(inst)), + Enter(_, EntryEvent::SeqDim(dim)) => { + let cfg = Cfg::body_from_events(events, num_thread_dims); + body.push(Cfg::Loop(dim, cfg)) + } + Exit(_, ExitEvent::SeqDim) => break, + Enter(_, EntryEvent::ThreadDim(pos, mut ind_levels)) => { + let mut dim_poses = vec![false; num_thread_dims]; + dim_poses[pos] = true; + while let Some(Enter(_, EntryEvent::ThreadDim(..))) = events.peek() { + let next = unwrap!(events.next()); + if let Enter(_, EntryEvent::ThreadDim(pos, levels)) = next { + dim_poses[pos] = true; + ind_levels.extend(levels); + } else { unreachable!() }; + } + let inner = Cfg::body_from_events(events, 0); + body.push(Cfg::Threads(dim_poses, ind_levels, inner)); + } + Exit(_, ExitEvent::ThreadDim) => { + while let Some(Exit(_, ExitEvent::ThreadDim)) = events.peek() { + events.next(); + } + break; + } + } + } + return body; + } + + /// Builds a CFG from a list of `CfgEvent`. + fn from_events(events: Vec>, num_thread_dims: usize) -> Cfg<'a> { + let mut events = events.into_iter().peekable(); + let body = Cfg::body_from_events(&mut events, num_thread_dims); + assert!(events.next().is_none()); + let body = Self::add_empty_threads(body, num_thread_dims); + Cfg::Root(body) + } + + /// Ensure every instruction is nested in a thread dimension. + fn add_empty_threads(body: Vec, num_thread_dims: usize) -> Vec { + let groups = body.into_iter().group_by(|cfg| cfg.handle_threads()); + let mut new_body = Vec::new(); + for (handle_threads, cfgs) in &groups { + if handle_threads { + new_body.extend(cfgs.map(|cfg| match cfg { + Cfg::Root(inner) => + Cfg::Root(Self::add_empty_threads(inner, num_thread_dims)), + Cfg::Loop(dim, inner) => + Cfg::Loop(dim, Self::add_empty_threads(inner, num_thread_dims)), + cfg => cfg, + })) + } else { + let thread_dims = vec![false; num_thread_dims]; + new_body.push(Cfg::Threads(thread_dims, vec![], cfgs.collect())); } } + new_body + } + + /// Indicates if the `Cfg` handles thread parallelism. + fn handle_threads(&self) -> bool { + match *self { + Cfg::Root(ref inners) | + Cfg::Loop(_, ref inners) => inners.iter().any(|c| c.handle_threads()), + Cfg::Threads(..) => true, + Cfg::Instruction(..) => false, + } } } + impl<'a> fmt::Debug for Cfg<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { @@ -89,12 +149,8 @@ impl<'a> fmt::Debug for Cfg<'a> { Cfg::Loop(ref dim, ref inners) => write!(f, "Loop([{:?}], {:?})", dim.dim_ids().format(","), inners), Cfg::Instruction(ref inst) => write!(f, "inst {:?}", inst.id()), - Cfg::Barrier => write!(f, "Barrier"), - Cfg::ParallelInductionLevel(InductionLevel { - ind_var, increment: Some((dim, _)), .. - }) => write!(f, "induction lvl (dim {:?}, {:?}) ", dim, ind_var), - Cfg::ParallelInductionLevel(ref level) => - write!(f, "induction var {:?}", level.ind_var), + Cfg::Threads(ref dims, _, ref inners) => + write!(f, "threads({:?}, {:?})", dims, inners), } } } @@ -103,19 +159,12 @@ impl<'a> fmt::Debug for Cfg<'a> { /// thread and block dimensions. pub fn build<'a>(space: &'a SearchSpace<'a>, insts: Vec>, - dims: Vec>, - precomputed_ind_levels: Vec>) + dims: Vec>) -> (Vec>, Vec>, Cfg<'a>) { - let precomputed_ind_levels = precomputed_ind_levels.into_iter().map(|level| { - let dim = unwrap!(level.increment).0; - CfgEvent::Enter(dim, EntryEvent::ParallelInductionLevel(level)) - }); let (block_dims, thread_dims, mut events) = gen_events(space, insts, dims); events.sort_by(|lhs, rhs| lhs.cmp(rhs, space)); - let mut events = precomputed_ind_levels.chain(events); - let cfg = Cfg::from_events(&mut events); - assert!(events.next().is_none()); + let cfg = Cfg::from_events(events, thread_dims.len()); (block_dims, thread_dims, cfg) } @@ -123,12 +172,19 @@ pub fn build<'a>(space: &'a SearchSpace<'a>, enum CfgEvent<'a> { Exec(Instruction<'a>), Enter(ir::dim::Id, EntryEvent<'a>), - Exit(ir::dim::Id, ExitEvent<'a>), + Exit(ir::dim::Id, ExitEvent), } -enum EntryEvent<'a> { SeqDim, ParallelInductionLevel(InductionLevel<'a>) } +/// An event to process when entering a dimension. +enum EntryEvent<'a> { + /// Enter a sequential dimension. + SeqDim(Dimension<'a>), + /// Enter a thread dimension. + ThreadDim(usize, Vec>), +} -enum ExitEvent<'a> { SeqDim(Dimension<'a>), Threads } +/// An event to process when exiting a dimension. +enum ExitEvent { SeqDim, ThreadDim } impl<'a> CfgEvent<'a> { /// Indiciates the order of `self` with regards to `other`. @@ -191,42 +247,24 @@ fn gen_events<'a>(space: &'a SearchSpace<'a>, -> (Vec>, Vec>, Vec>) { let mut block_dims = Vec::new(); - let mut thread_dims: Vec>> = (0..3).map(|_| None).collect_vec(); + let mut thread_dims = Vec::new(); let mut events = insts.into_iter().map(CfgEvent::Exec).collect_vec(); + // Create dimension events and sort thread and block dims. for mut dim in dims { - let mut add_thread_dim = - |mut dim: Dimension<'a>, nesting: usize, events: &mut Vec<_>| - { - for level in dim.drain_induction_levels() { - let event = EntryEvent::ParallelInductionLevel(level); - events.push(CfgEvent::Enter(dim.id(), event)); - } - match thread_dims[nesting] { - Some(ref mut other_dim) => other_dim.merge_from(dim), - ref mut x @ None => *x = Some(dim), - } - }; match dim.kind() { - DimKind::BLOCK => { - for level in dim.drain_induction_levels() { - let event = EntryEvent::ParallelInductionLevel(level); - events.push(CfgEvent::Enter(dim.id(), event)); - } - block_dims.push(dim) + DimKind::BLOCK => block_dims.push(dim), + DimKind::THREAD => { + events.push(CfgEvent::Exit(dim.id(), ExitEvent::ThreadDim)); + thread_dims.push(dim); }, - DimKind::THREAD_X => { - events.push(CfgEvent::Exit(dim.id(), ExitEvent::Threads)); - add_thread_dim(dim, 0, &mut events); - }, - DimKind::THREAD_Y => add_thread_dim(dim, 1, &mut events), - DimKind::THREAD_Z => add_thread_dim(dim, 2, &mut events), _ => { - events.push(CfgEvent::Enter(dim.id(), EntryEvent::SeqDim)); - events.push(CfgEvent::Exit(dim.id(), ExitEvent::SeqDim(dim))); + events.push(CfgEvent::Exit(dim.id(), ExitEvent::SeqDim)); + events.push(CfgEvent::Enter(dim.id(), EntryEvent::SeqDim(dim))); }, } } - block_dims.sort_by(|lhs, rhs| { + // Sort block dims. + block_dims.sort_unstable_by(|lhs, rhs| { if lhs.id() == rhs.id() { return std::cmp::Ordering::Equal; } match space.domain().get_order(lhs.id().into(), rhs.id().into()) { Order::OUTER => std::cmp::Ordering::Less, @@ -235,5 +273,33 @@ fn gen_events<'a>(space: &'a SearchSpace<'a>, lhs.id(), rhs.id()), } }); - (block_dims, Itertools::flatten(thread_dims.into_iter()).collect(), events) + // Sort and group thread dims. + let mut sorted_thread_dims = Vec::with_capacity(3); + for dim in thread_dims { + let pos = sorted_thread_dims.binary_search_by(|probe: &Vec| { + if probe[0].id() == dim.id() { return std::cmp::Ordering::Equal; } + match space.domain().get_thread_mapping(probe[0].id(), dim.id()) { + ThreadMapping::MAPPED_OUT => std::cmp::Ordering::Less, + ThreadMapping::MAPPED_IN => std::cmp::Ordering::Greater, + ThreadMapping::MAPPED => std::cmp::Ordering::Equal, + mapping => { + panic!("invalid mapping between thread dims {:?} and {:?}: {:?}", + probe[0].id(), dim.id(), mapping) + } + } + }); + match pos { + Ok(pos) => sorted_thread_dims[pos].push(dim), + Err(pos) => sorted_thread_dims.insert(pos, vec![dim]), + } + } + // Register thread entering events. + let thread_dims = sorted_thread_dims.into_iter().enumerate().map(|(pos, mut dims)| { + for dim in &mut dims { + let event = EntryEvent::ThreadDim(pos, dim.drain_induction_levels()); + events.push(CfgEvent::Enter(dim.id(), event)); + } + unwrap!(dims.into_iter().fold1(|mut x, y| { x.merge_from(y); x })) + }).collect(); + (block_dims, thread_dims, events) } diff --git a/src/codegen/dimension.rs b/src/codegen/dimension.rs index 7cfa38e25..01f4993b2 100644 --- a/src/codegen/dimension.rs +++ b/src/codegen/dimension.rs @@ -250,8 +250,7 @@ fn get_ind_var_levels<'a>(ind_var: &'a ir::InductionVar<'a>, space: &SearchSpace match space.domain().get_dim_kind(dim) { DimKind::VECTOR => (), DimKind::LOOP | DimKind::UNROLL => mut_levels.push((dim, size)), - DimKind::BLOCK | DimKind::THREAD_X | DimKind::THREAD_Y | DimKind::THREAD_Z => - const_levels.push((dim, size)), + DimKind::BLOCK | DimKind::THREAD => const_levels.push((dim, size)), x => panic!("unspecified dim kind {:?}", x), } } diff --git a/src/codegen/function.rs b/src/codegen/function.rs index 5aa2e5d32..769597879 100644 --- a/src/codegen/function.rs +++ b/src/codegen/function.rs @@ -14,6 +14,7 @@ pub struct Function<'a> { device_code_args: Vec>, induction_vars: Vec>, mem_blocks: Vec>, + init_induction_levels: Vec>, // TODO(cleanup): remove dependency on the search space space: &'a SearchSpace<'a>, } @@ -22,7 +23,7 @@ impl<'a> Function<'a> { /// Creates a device `Function` from an IR instance. pub fn build(space: &'a SearchSpace<'a>) -> Function<'a> { let mut dims = dimension::group_merged_dimensions(space); - let (induction_vars, precomputed_indvar_levels) = + let (induction_vars, init_induction_levels) = dimension::register_induction_vars(&mut dims, space); trace!("dims = {:?}", dims); let insts = space.ir_instance().insts() @@ -30,10 +31,9 @@ impl<'a> Function<'a> { let device_code_args = dims.iter().flat_map(|d| d.host_values(space)) .chain(induction_vars.iter().flat_map(|v| v.host_values(space))) .chain(insts.iter().flat_map(|i| i.host_values(space))) - .chain(precomputed_indvar_levels.iter().flat_map(|l| l.host_values(space))) + .chain(init_induction_levels.iter().flat_map(|l| l.host_values(space))) .collect_vec(); - let (block_dims, thread_dims, cfg) = cfg::build( - space, insts, dims, precomputed_indvar_levels); + let (block_dims, thread_dims, cfg) = cfg::build(space, insts, dims); let mem_blocks = register_mem_blocks(space, &block_dims); let device_code_args = device_code_args.into_iter() .chain(mem_blocks.iter().flat_map(|x| x.host_values(space))) @@ -41,7 +41,7 @@ impl<'a> Function<'a> { debug!("compiling cfg {:?}", cfg); Function { cfg, thread_dims, block_dims, induction_vars, device_code_args, space, - mem_blocks, + mem_blocks, init_induction_levels, } } @@ -74,8 +74,10 @@ impl<'a> Function<'a> { /// Returns all the induction levels in the function. pub fn induction_levels(&self) -> impl Iterator { - self.dimensions().flat_map(|d| d.induction_levels()) + self.block_dims.iter().chain(&self.thread_dims) + .flat_map(|d| d.induction_levels()) .chain(self.cfg.induction_levels()) + .chain(self.init_induction_levels()) } /// Returns the memory blocks allocated by the function. @@ -86,6 +88,12 @@ impl<'a> Function<'a> { /// Returns the underlying implementation space. // TODO(cleanup): prefer access to the space from individual wrappers on ir objects. pub fn space(&self) -> &SearchSpace { self.space } + + /// Returns the induction levels computed at the beginning of the kernel. Levels must + /// be computed in the provided order. + pub fn init_induction_levels(&self) -> &[InductionLevel] { + &self.init_induction_levels + } } impl<'a> std::ops::Deref for Function<'a> { @@ -303,4 +311,7 @@ impl<'a> Instruction<'a> { /// Returns the memory flag of the intruction, if any. pub fn mem_flag(&self) -> Option { self.mem_flag } + + /// Indicates if the instruction has observable side effects. + pub fn has_side_effects(&self) -> bool { self.instruction.has_side_effects() } } diff --git a/src/codegen/namer.rs b/src/codegen/namer.rs index 480a62354..5b6020b92 100644 --- a/src/codegen/namer.rs +++ b/src/codegen/namer.rs @@ -55,6 +55,8 @@ pub struct NameMap<'a, 'b> { induction_levels: HashMap<(ir::IndVarId, ir::dim::Id), String>, /// Casted sizes. size_casts: HashMap<(&'a ir::Size<'a>, ir::Type), String>, + /// Guard to use in front of instructions with side effects. + side_effect_guard: Option, } impl<'a, 'b> NameMap<'a, 'b> { @@ -105,6 +107,7 @@ impl<'a, 'b> NameMap<'a, 'b> { total_num_threads: function.num_threads(), size_casts: HashMap::default(), indexes, params, mem_blocks, induction_vars, induction_levels, + side_effect_guard: None, }; // Setup induction variables. for var in function.induction_vars() { @@ -325,4 +328,14 @@ impl<'a, 'b> NameMap<'a, 'b> { }, } } + + /// Returns the side-effect guard, if any is set. + pub fn side_effect_guard(&self) -> Option { + self.side_effect_guard.clone() + } + + /// Sets the predicate to use in front of side-effect instruction. + pub fn set_side_effect_guard(&mut self, guard: Option) { + self.side_effect_guard = guard; + } } diff --git a/src/device/context.rs b/src/device/context.rs index bece3db84..f407ca1f5 100644 --- a/src/device/context.rs +++ b/src/device/context.rs @@ -16,7 +16,7 @@ pub trait Context: Sync { /// Returns the description of the device the code runs on. fn device(&self) -> &Device; /// Returns the execution time of a fully specified implementation in nanoseconds. - fn evaluate(&self, space: &Function) -> Result; + fn evaluate(&self, space: &Function, mode: EvalMode) -> Result; /// Compiles and benchmarks a functions. As opposed to `Self::evaluate`, the measured /// time contains potential startup times. fn benchmark(&self, space: &Function, num_samples: usize) -> Vec; diff --git a/src/device/cuda/api/jit_daemon.rs b/src/device/cuda/api/jit_daemon.rs index 22101405f..e3d67f15e 100644 --- a/src/device/cuda/api/jit_daemon.rs +++ b/src/device/cuda/api/jit_daemon.rs @@ -30,7 +30,7 @@ impl Drop for JITDaemon { unwrap!(self.ptx_sender.send(&[])); unsafe { if libc::waitpid(self.daemon, std::ptr::null_mut(), 0) == -1 { - panic!("unable to kill jit process: {}", errno()); + info!("unable to kill jit process: {}", errno()); } } } diff --git a/src/device/cuda/context.rs b/src/device/cuda/context.rs index a144cfd68..f5a62554d 100644 --- a/src/device/cuda/context.rs +++ b/src/device/cuda/context.rs @@ -15,7 +15,7 @@ use device::context::AsyncCallback; /// Max number of candidates waiting to be evaluated. const EVAL_BUFFER_SIZE: usize = 100; // TODO(perf): enable optimizations when possible -const JIT_OPT_LEVEL: usize = 1; +const JIT_OPT_LEVEL: usize = 2; /// A CUDA evaluation context. pub struct Context<'a> { @@ -58,6 +58,14 @@ impl<'a> Context<'a> { pub fn bind_param(&mut self, name: String, arg: Arc) { self.parameters.insert(name, arg); } + + /// Returns the optimization level to use. + fn opt_level(mode: EvalMode) -> usize { + match mode { + EvalMode::TestBound => 1, + EvalMode::FindBest => JIT_OPT_LEVEL, + } + } } @@ -84,9 +92,9 @@ impl<'a> device::Context for Context<'a> { fn param_as_size(&self, name: &str) -> Option { self.get_param(name).as_size() } - fn evaluate(&self, function: &device::Function) -> Result { + fn evaluate(&self, function: &device::Function, mode: EvalMode) -> Result { let gpu = &self.gpu_model; - let kernel = Kernel::compile(function, gpu, self.executor, JIT_OPT_LEVEL); + let kernel = Kernel::compile(function, gpu, self.executor, Self::opt_level(mode)); Ok(kernel.evaluate(self)? as f64 / self.gpu_model.smx_clock) } @@ -102,7 +110,6 @@ impl<'a> device::Context for Context<'a> { let blocked_time = &atomic::AtomicUsize::new(0); let (send, recv) = mpsc::sync_channel(EVAL_BUFFER_SIZE); let clock_rate = self.gpu_model.smx_clock; - let opt_level = if mode == EvalMode::TestBound { 1 } else { JIT_OPT_LEVEL }; // Correct because the thread handle is not escaped. crossbeam::scope(move |scope| { // Start the explorer threads. @@ -110,7 +117,7 @@ impl<'a> device::Context for Context<'a> { let mut evaluator = AsyncEvaluator { context: self, sender: send.clone(), - ptx_daemon: self.executor.spawn_jit(opt_level), + ptx_daemon: self.executor.spawn_jit(Self::opt_level(mode)), blocked_time, }; unwrap!(scope.builder().name("Telamon - Explorer Thread".to_string()) @@ -160,7 +167,8 @@ pub struct AsyncEvaluator<'a, 'b> where 'a: 'b { impl<'a, 'b, 'c> device::AsyncEvaluator<'a, 'c> for AsyncEvaluator<'a, 'b> where 'a: 'b, 'c: 'b { - fn add_kernel(&mut self, candidate: explorer::Candidate<'a>, callback: device::AsyncCallback<'a, 'c> ) { + fn add_kernel(&mut self, candidate: explorer::Candidate<'a>, + callback: device::AsyncCallback<'a, 'c> ) { let thunk = { let dev_fun = device::Function::build(&candidate.space); let gpu = &self.context.gpu(); diff --git a/src/device/cuda/gpu.rs b/src/device/cuda/gpu.rs index 5741e04bf..30688c6b9 100644 --- a/src/device/cuda/gpu.rs +++ b/src/device/cuda/gpu.rs @@ -1,6 +1,6 @@ //! Describes CUDA-enabled GPUs. -use device::{self, Device}; use codegen::Function; +use device::{self, Device}; use device::cuda::printer as p; use device::cuda::mem_model::{self, MemInfo}; use ir::{self, Type}; @@ -12,6 +12,11 @@ use std::fs::File; use std::io::{Read, Write}; use utils::*; +// FIXME: fix performance model +// - l1_lines constraint for stores ? +// - test if global pressure is needed +// - l1_lines per threads ? + /// Specifies the performance parameters of an instruction. #[derive(Default, RustcDecodable, RustcEncodable, Clone, Copy, Debug)] pub struct InstDesc { @@ -27,21 +32,26 @@ pub struct InstDesc { pub mem: f64, /// The number of L1 cache lines that are fetched from the L2. pub l1_lines_from_l2: f64, - /// The number of L2 cache lines that are fetched from the L2. - pub l2_lines_from_l2: f64, + /// The number of L2 cache lines read. + pub l2_lines_read: f64, + /// Number of l2 cache lines stored. + pub l2_lines_stored: f64, /// The ram bandwidth used. pub ram_bw: f64, } impl InstDesc { - /// Multiplies concerned bottlenecks by the wrap use ratio. - fn apply_use_ratio(self, ratio: f64) -> Self { + fn wasted_ratio(ratio: f64) -> Self { InstDesc { - issue: self.issue * ratio, - alu: self.alu * ratio, - sync: self.sync * ratio, - mem: self.mem * ratio, - .. self + latency: 1.0, + issue: ratio, + alu: ratio, + sync: ratio, + mem: ratio, + l1_lines_from_l2: 1.0, + l2_lines_read: 1.0, + l2_lines_stored: 1.0, + ram_bw: 1.0, } } } @@ -54,7 +64,8 @@ impl Into for InstDesc { self.sync, self.mem, self.l1_lines_from_l2, - self.l2_lines_from_l2, + self.l2_lines_read, + self.l2_lines_stored, self.ram_bw, ]; HwPressure::new(self.latency, vec) @@ -159,13 +170,6 @@ impl Gpu { p::function(fun, self) } - /// Returns the ratio of threads actually used per wrap. - fn wrap_use_ratio(&self, max_num_threads: u64) -> f64 { - let wrap_size = u64::from(self.wrap_size); - let n_wraps = (max_num_threads + wrap_size - 1)/wrap_size; - max_num_threads as f64 / (n_wraps * wrap_size) as f64 - } - /// Returns the description of a load instruction. fn load_desc(&self, mem_info: &MemInfo, flags: InstFlag) -> InstDesc { // TODO(search_space,model): support CA and NC flags. @@ -182,14 +186,14 @@ impl Gpu { let l1_lines_from_l2 = if flags.intersects(InstFlag::MEM_SHARED) { 0.0 } else { mem_info.l1_coalescing }; - let l2_lines_from_l2 = if flags.intersects(InstFlag::MEM_SHARED) { + let l2_lines_read = if flags.intersects(InstFlag::MEM_SHARED) { 0.0 } else { mem_info.l2_coalescing }; InstDesc { latency: f64::min(gbl_latency, shared_latency), issue: mem_info.replay_factor, mem: mem_info.replay_factor, - l1_lines_from_l2, l2_lines_from_l2, + l1_lines_from_l2, l2_lines_read, ram_bw: mem_info.l2_miss_ratio * f64::from(self.l2_cache_line), .. InstDesc::default() } @@ -200,14 +204,14 @@ impl Gpu { // TODO(search_space,model): support CA flags. // TODO(model): understand how writes use the BW. assert!(InstFlag::MEM_COHERENT.contains(flags)); - let l2_lines_from_l2 = if flags.intersects(InstFlag::MEM_SHARED) { + let l2_lines_stored = if flags.intersects(InstFlag::MEM_SHARED) { 0.0 } else { mem_info.l2_coalescing }; // L1 lines per L2 is not limiting. InstDesc { issue: mem_info.replay_factor, mem: mem_info.replay_factor, - l2_lines_from_l2, + l2_lines_stored, ram_bw: 2.0 * mem_info.l2_miss_ratio * f64::from(self.l2_cache_line), .. InstDesc::default() } @@ -220,10 +224,10 @@ impl Gpu { pressure.repeat_sequential(f64::from(size)); pressure.add_sequential(&self.loop_init_overhead.into()); pressure - } else if kind == DimKind::THREAD_X { - let mut pressure: HwPressure = self.syncthread_inst.into(); - pressure.repeat_parallel(f64::from(size)); - pressure + } else if DimKind::THREAD.contains(kind) { + // The repetition along the thread is taken into account by + // `num_unmapped_thread` as the current thread is accounted as not mapped. + self.syncthread_inst.into() } else { HwPressure::zero(self) } } @@ -234,14 +238,14 @@ impl Gpu { use ir::Operator::*; let t = self.lower_type(inst.t(), space).unwrap_or_else(|| inst.t()); match (inst.operator(), t) { - (&Add(..), Type::F(32)) | - (&Sub(..), Type::F(32)) => self.add_f32_inst.into(), - (&Add(..), Type::F(64)) | - (&Sub(..), Type::F(64)) => self.add_f64_inst.into(), - (&Add(..), Type::I(32)) | - (&Sub(..), Type::I(32)) => self.add_i32_inst.into(), - (&Add(..), Type::I(64)) | - (&Sub(..), Type::I(64)) => self.add_i64_inst.into(), + (&BinOp(ir::BinOp::Add, ..), Type::F(32)) | + (&BinOp(ir::BinOp::Sub, ..), Type::F(32)) => self.add_f32_inst.into(), + (&BinOp(ir::BinOp::Add, ..), Type::F(64)) | + (&BinOp(ir::BinOp::Sub, ..), Type::F(64)) => self.add_f64_inst.into(), + (&BinOp(ir::BinOp::Add, ..), Type::I(32)) | + (&BinOp(ir::BinOp::Sub, ..), Type::I(32)) => self.add_i32_inst.into(), + (&BinOp(ir::BinOp::Add, ..), Type::I(64)) | + (&BinOp(ir::BinOp::Sub, ..), Type::I(64)) => self.add_i64_inst.into(), (&Mul(..), Type::F(32)) => self.mul_f32_inst.into(), (&Mul(..), Type::F(64)) => self.mul_f64_inst.into(), (&Mul(..), Type::I(32)) | @@ -266,10 +270,10 @@ impl Gpu { self.mad_wide_inst.into() } }, - (&Div(..), Type::F(32)) => self.div_f32_inst.into(), - (&Div(..), Type::F(64)) => self.div_f64_inst.into(), - (&Div(..), Type::I(32)) => self.div_i32_inst.into(), - (&Div(..), Type::I(64)) => self.div_i64_inst.into(), + (&BinOp(ir::BinOp::Div, ..), Type::F(32)) => self.div_f32_inst.into(), + (&BinOp(ir::BinOp::Div, ..), Type::F(64)) => self.div_f64_inst.into(), + (&BinOp(ir::BinOp::Div, ..), Type::I(32)) => self.div_i32_inst.into(), + (&BinOp(ir::BinOp::Div, ..), Type::I(64)) => self.div_i64_inst.into(), (&Ld(..), _) | (&TmpLd(..), _) => { let flag = space.domain().get_inst_flag(inst.id()); let mem_info = mem_model::analyse(space, self, inst, dim_sizes); @@ -289,8 +293,7 @@ impl Gpu { /// Computes the number of blocks that can fit in an smx. pub fn blocks_per_smx(&self, space: &SearchSpace) -> u32 { let mut block_per_smx = self.max_block_per_smx; - let num_thread = space.ir_instance().insts() - .map(|inst| space.domain().get_num_threads(inst.id()).min).max().unwrap_or(1); + let num_thread = space.domain().get_num_threads().min; min_assign(&mut block_per_smx, self.thread_per_smx/num_thread); let shared_mem_used = space.domain().get_shared_mem_used().min; if shared_mem_used != 0 { @@ -301,6 +304,19 @@ impl Gpu { shared_mem_used, num_thread); block_per_smx } + + /// Returns the pressure of an an instruction skipped by a predicate. + fn skipped_pressure(&self) -> HwPressure { + (InstDesc { issue: 1.0, .. InstDesc::default() }).into() + } + + /// Computes the ratio `num_wraps*wrap_size/num_threads`. This ratio may be `>1` + /// because the hardware creates additionnal threads to fill the wraps. + fn waste_ratio(&self, lcm_threads_per_block: u64) -> f64 { + let wrap_size = u64::from(self.wrap_size); + let n_wraps = (lcm_threads_per_block + wrap_size - 1)/wrap_size; + (n_wraps * wrap_size) as f64/lcm_threads_per_block as f64 + } } impl device::Device for Gpu { @@ -348,11 +364,10 @@ impl device::Device for Gpu { bb: &ir::BasicBlock) -> model::HwPressure { if let Some(inst) = bb.as_inst() { self.inst_pressure(space, dim_sizes, inst) - } else { - let dim = unwrap!(bb.as_dim()); + } else if let Some(dim) = bb.as_dim() { let kind = space.domain().get_dim_kind(dim.id()); self.dim_pressure(kind, dim_sizes[&dim.id()]) - } + } else { panic!() } } fn loop_iter_pressure(&self, kind: DimKind) -> (HwPressure, HwPressure) { @@ -362,20 +377,16 @@ impl device::Device for Gpu { .. InstDesc::default() }; (self.loop_iter_overhead.into(), end_pressure.into()) - } else if kind == DimKind::THREAD_X { + } else if DimKind::THREAD.contains(kind) { (self.syncthread_inst.into(), HwPressure::zero(self)) } else { (HwPressure::zero(self), HwPressure::zero(self)) } } fn thread_rates(&self) -> HwPressure { self.thread_rates.into() } - fn block_rates(&self, max_num_threads: u64) -> HwPressure { - self.smx_rates.apply_use_ratio(self.wrap_use_ratio(max_num_threads)).into() - } + fn block_rates(&self) -> HwPressure { self.smx_rates.into() } - fn total_rates(&self, max_num_threads: u64) -> HwPressure { - self.gpu_rates.apply_use_ratio(self.wrap_use_ratio(max_num_threads)).into() - } + fn total_rates(&self) -> HwPressure { self.gpu_rates.into() } fn bottlenecks(&self) -> &[&'static str] { &["issue", @@ -383,7 +394,8 @@ impl device::Device for Gpu { "syncthread", "mem_units", "l1_lines_from_l2", - "l2_lines_from_l2", + "l2_lines_read", + "l2_lines_stored", "bandwidth"] } @@ -406,6 +418,21 @@ impl device::Device for Gpu { _ => panic!(), } } + + fn add_block_overhead(&self, predicated_dims_size: u64, + max_threads_per_blocks: u64, + pressure: &mut HwPressure) { + assert!(predicated_dims_size > 0); + assert!(max_threads_per_blocks > 0); + let active_ratio = self.waste_ratio(max_threads_per_blocks/predicated_dims_size); + pressure.multiply(&InstDesc::wasted_ratio(active_ratio).into()); + if predicated_dims_size > 1 { + let full_ratio = self.waste_ratio(max_threads_per_blocks); + let num_skipped = full_ratio * predicated_dims_size as f64 - active_ratio; + assert!(num_skipped >= 0.); + pressure.repeat_and_add_bottlenecks(num_skipped, &self.skipped_pressure()); + } + } } /// Asigns min(lhs, rhs) to lhs. diff --git a/src/device/cuda/mem_model.rs b/src/device/cuda/mem_model.rs index ba95dddf7..5443b41c0 100644 --- a/src/device/cuda/mem_model.rs +++ b/src/device/cuda/mem_model.rs @@ -1,8 +1,8 @@ //! Memory accesses analysis. use device::cuda; -use ir::{self, BasicBlock}; +use ir; use itertools::Itertools; -use search_space::{DimKind, Domain, InstFlag, Order, SearchSpace}; +use search_space::{DimKind, Domain, InstFlag, ThreadMapping, SearchSpace}; use std; use num::integer; use utils::*; @@ -11,7 +11,8 @@ use utils::*; // take this into account be computing the pressure incrementatly when applying levels. /// Result of the memory analysis for one instruction. Vector instructions are considered -/// as one instruction. +/// as a single instance and predicated dimensions are not considered to compute the +/// average pressure. #[derive(Debug)] pub struct MemInfo { /// The proportion of instruction that produce a L2 miss. @@ -74,7 +75,6 @@ fn info(space: &SearchSpace, let mut info = NO_ACCESS_INFO; let thread_dims = tensor_thread_dims( space, inst, stride, dims, sizes, gpu); - trace!("thread dims: {:?}", thread_dims); if is_shared_access.maybe_true() { info.replay_factor = shared_replay_factor( stride, &thread_dims, dims, sizes, space, gpu); @@ -114,7 +114,7 @@ fn unknown_info(is_shared_access: Trivalent, gpu: &cuda::Gpu) -> MemInfo { /// Computes the replay factor for a shared memory access. fn shared_replay_factor(stride: i32, - thread_dims: &[ThreadDimInfo], + thread_dims: &[ThreadDimInfo], tensor_dims: &[ir::dim::Id], dim_sizes: &HashMap, space: &SearchSpace, gpu: &cuda::Gpu) -> f64 { @@ -149,6 +149,7 @@ fn global_coalescing(thread_dims: &[ThreadDimInfo], space: &SearchSpace, gpu: &c let mut l1_line_accessed = 1; let mut l2_line_accessed = 1; for dim_info in sort_thread_dims(thread_dims, space, |d| d.stride as f64) { + trace!("glb dim info: {:?}", dim_info); let mut size = dim_info.size; total_size *= size; if total_size > u64::from(gpu.wrap_size) { @@ -193,13 +194,14 @@ fn tensor_thread_dims(space: &SearchSpace, *stride *= u64::from(size); Some((dim, (size, current_stride))) }).collect::>(); + let external_dims = external_thread_dims(inst, space); inst.iteration_dims().iter().flat_map(|&dim| { match space.domain().get_dim_kind(dim).is(DimKind::THREAD) { Trivalent::False => None, Trivalent::Maybe => Some((dim, false)), Trivalent::True => Some((dim, true)), } - }).map(|(id, is_active_thread)| { + }).chain(external_dims).map(|(id, is_active_thread)| { let (size, stride) = non_zero_strides.get(&id).cloned() .unwrap_or_else(|| (sizes[&id], 0)); // TODO(model): handle strides that are not a multiple of the bank_Stride. @@ -215,13 +217,33 @@ fn tensor_thread_dims(space: &SearchSpace, }).collect_vec() } +/// Returns the thread dimensions that are mapped outside an instruction but not active +/// under this instruction. The returned boolean indicates if the thread dimension cannot +/// be mapped to an active dimension and if the dimension is predicated. +fn external_thread_dims<'a>(inst: &'a ir::Instruction, space: &'a SearchSpace) + -> impl Iterator + 'a +{ + space.ir_instance().thread_dims().flat_map(move |dim| { + let is_mapped = inst.iteration_dims().iter().map(|&other| { + if dim.id() == other { return Trivalent::True; } + let mapping = space.domain().get_thread_mapping(dim.id(), other); + mapping.is(ThreadMapping::MAPPED) + }).fold(Trivalent::False, |l, r| l | r); + match is_mapped { + Trivalent::True => None, + Trivalent::Maybe => Some((dim.id(), false)), + Trivalent::False => Some((dim.id(), true)), + } + }) +} + fn sort_thread_dims<'a, F>(dims: &'a [ThreadDimInfo], space: &SearchSpace, cost: F) -> Vec<&'a ThreadDimInfo> where F: Fn(&ThreadDimInfo) -> f64 { dims.iter().sorted_by(|lhs, rhs| { if lhs.id == rhs.id { return std::cmp::Ordering::Equal; } - let nest_order = space.domain().get_order(lhs.id.into(), rhs.id.into()); - let maybe_out = nest_order.intersects(Order::OUTER); - let maybe_in = nest_order.intersects(Order::INNER); + let mapping = space.domain().get_thread_mapping(lhs.id, rhs.id); + let maybe_out = mapping.intersects(ThreadMapping::MAPPED_OUT); + let maybe_in = mapping.intersects(ThreadMapping::MAPPED_IN); let (lhs_cost, rhs_cost) = (cost(lhs), cost(rhs)); match (maybe_in, maybe_out, lhs.is_active_thread, rhs.is_active_thread) { (true, false, true, _) => std::cmp::Ordering::Less, @@ -365,6 +387,7 @@ mod tests { use helper; use ir; use env_logger; + use search_space::Order; /// Generates function with a load in two thread dimensions, with non-coalesced /// accessed on the first one. diff --git a/src/device/cuda/printer.rs b/src/device/cuda/printer.rs index 1dac09a90..a481830d2 100644 --- a/src/device/cuda/printer.rs +++ b/src/device/cuda/printer.rs @@ -5,7 +5,9 @@ use ir::{self, dim, op, Operand, Size, Type}; use itertools::Itertools; use search_space::{DimKind, Domain, InstFlag}; use std::io::Write; +use std::fmt::Write as WriteFmt; use self::InstArg::*; +use utils::*; // TODO(cc_perf): avoid concatenating strings. /// Prints a rounding mode selector. @@ -118,9 +120,16 @@ fn inst_arg(arg: &InstArg, namer: &mut NameMap) -> String { } /// Assembles the different parts of an instruction in a single string. -fn assemble(operator: &str, t: Type, args: &[InstArg], namer: &mut NameMap) -> String { +fn assemble(operator: &str, + predicate: Option, + t: Type, + args: &[InstArg], + namer: &mut NameMap) -> String { let args_str = args.iter().map(|x| inst_arg(x, namer)).collect_vec().join(", "); - format!("{}.{} {};", operator, ptx_type(t), args_str) + let pred = if let Some(ref pred) = predicate { + format!("@{} ", pred) + } else { String::new() }; + format!("{}{}.{} {};", pred, operator, ptx_type(t), args_str) } // TODO(cleanup): remove this function once values are preprocessed by codegen. If values @@ -129,16 +138,21 @@ fn lower_type(t: ir::Type, fun: &Function) -> ir::Type { unwrap!(fun.space().ir_instance().device().lower_type(t, fun.space())) } +/// Returns the string representing a binary operator. +fn binary_op(op: ir::BinOp) -> &'static str { + match op { + ir::BinOp::Add => "add", + ir::BinOp::Sub => "sub", + ir::BinOp::Div => "div", + } +} + /// Prints an instruction. fn inst(inst: &Instruction, namer: &mut NameMap, fun: &Function) -> String { match *inst.operator() { - op::Add(ref lhs, ref rhs, round) => { - let operator = format!("add{}", rounding(round)); - assemble(&operator, inst.t(), &[Inst(inst), Op(lhs), Op(rhs)], namer) - }, - op::Sub(ref lhs, ref rhs, round) => { - let operator = format!("sub{}", rounding(round)); - assemble(&operator, inst.t(), &[Inst(inst), Op(lhs), Op(rhs)], namer) + op::BinOp(op, ref lhs, ref rhs, round) => { + let operator = format!("{}{}", binary_op(op), rounding(round)); + assemble(&operator, None, inst.t(), &[Inst(inst), Op(lhs), Op(rhs)], namer) }, op::Mul(ref lhs, ref rhs, rounding, return_type) => { let operator = if rounding == op::Rounding::Exact { @@ -146,7 +160,8 @@ fn inst(inst: &Instruction, namer: &mut NameMap, fun: &Function) -> String { } else { format!("mul{}", self::rounding(rounding)) }; - assemble(&operator, lower_type(lhs.t(), fun), &[Inst(inst), Op(lhs), Op(rhs)], namer) + let t = lower_type(lhs.t(), fun); + assemble(&operator, None, t, &[Inst(inst), Op(lhs), Op(rhs)], namer) }, op::Mad(ref mul_lhs, ref mul_rhs, ref add_rhs, rounding) => { let operator = if rounding == op::Rounding::Exact { @@ -155,21 +170,21 @@ fn inst(inst: &Instruction, namer: &mut NameMap, fun: &Function) -> String { format!("fma{}", self::rounding(rounding)) }; let args = &[Inst(inst), Op(mul_lhs), Op(mul_rhs), Op(add_rhs)]; - assemble(&operator, lower_type(mul_lhs.t(), fun), args, namer) - }, - op::Div(ref lhs, ref rhs, round) => { - let operator = format!("div{}", rounding(round)); - assemble(&operator, inst.t(), &[Inst(inst), Op(lhs), Op(rhs)], namer) + assemble(&operator, None, lower_type(mul_lhs.t(), fun), args, namer) }, op::Mov(ref op) => - assemble("mov", inst.t(), &[Inst(inst), Op(op)], namer), + assemble("mov", None, inst.t(), &[Inst(inst), Op(op)], namer), op::Ld(_, ref addr, _) => { let operator = ld_operator(unwrap!(inst.mem_flag())); - assemble(operator, inst.t(), &[Inst(inst), Addr(addr)], namer) + assemble(operator, None, inst.t(), &[Inst(inst), Addr(addr)], namer) }, op::St(ref addr, ref val, _, _) => { let operator = st_operator(unwrap!(inst.mem_flag())); - assemble(operator, lower_type(val.t(), fun), &[Addr(addr), Op(val)], namer) + let t = lower_type(val.t(), fun); + let guard = if inst.has_side_effects() { + namer.side_effect_guard() + } else { None }; + assemble(operator, guard, t, &[Addr(addr), Op(val)], namer) }, op::Cast(ref op, t) => { let rounding = match (op.t(), t) { @@ -179,7 +194,8 @@ fn inst(inst: &Instruction, namer: &mut NameMap, fun: &Function) -> String { _ => "", }; let operator = format!("cvt{}.{}", rounding, ptx_type(lower_type(t, fun))); - assemble(&operator, lower_type(op.t(), fun), &[Inst(inst), Op(op)], namer) + let t = lower_type(op.t(), fun); + assemble(&operator, None, t, &[Inst(inst), Op(op)], namer) }, op::TmpLd(..) | op::TmpSt(..) => panic!("non-printable instruction") } @@ -195,12 +211,15 @@ fn vector_inst(inst: &Instruction, dim: &Dimension, namer: &mut NameMap, fun: &F op::Ld(_, ref addr, _) => { let operator = format!("{}.v{}", ld_operator(flag), size); let args = [VecInst(inst, dim.id(), size), Addr(addr)]; - assemble(&operator, inst.t(), &args, namer) + assemble(&operator, None, inst.t(), &args, namer) }, op::St(ref addr, ref val, _, _) => { let operator = format!("{}.v{}", st_operator(flag), size); let operands = [Addr(addr), VecOp(val, dim.id(), size)]; - assemble(&operator, lower_type(val.t(), fun), &operands, namer) + let guard = if inst.has_side_effects() { + namer.side_effect_guard() + } else { None }; + assemble(&operator, guard, lower_type(val.t(), fun), &operands, namer) }, _ => panic!("non-vectorizable instruction"), } @@ -220,13 +239,39 @@ fn cfg<'a>(fun: &Function, c: &Cfg<'a>, namer: &mut NameMap) -> String { match *c { Cfg::Root(ref cfgs) => cfg_vec(fun, cfgs, namer), Cfg::Loop(ref dim, ref cfgs) => ptx_loop(fun, dim, cfgs, namer), - Cfg::Barrier => "bar.sync 0;".to_string(), + Cfg::Threads(ref dims, ref ind_levels, ref inner) => { + let mut res = enable_threads(fun, dims, namer); + for level in ind_levels { + res.push_str(¶llel_induction_level(level, namer)); + res.push_str("\n "); + } + res.push_str(&cfg_vec(fun, inner, namer)); + res.push_str("\n bar.sync 0;"); + res + } Cfg::Instruction(ref i) => inst(i, namer, fun), - Cfg::ParallelInductionLevel(ref level) => - parallel_induction_level(level, namer) } } +/// Change the side-effect guards so that only thre specified threads are enabled. +fn enable_threads(fun: &Function, threads: &[bool], namer: &mut NameMap) -> String { + let mut ops = String::new(); + let mut guard = None; + for (&is_active, dim) in threads.iter().zip_eq(fun.thread_dims().iter()) { + if is_active { continue; } + let new_guard = namer.gen_name(ir::Type::I(1)); + let index = namer.name_index(dim.id()); + unwrap!(writeln!(ops, " setp.eq.s32 {}, {}, 0;", new_guard, index)); + if let Some(ref guard) = guard { + unwrap!(writeln!(ops, " and.pred {}, {}, {};", guard, guard, new_guard)); + } else { + guard = Some(new_guard); + }; + } + namer.set_side_effect_guard(guard.map(RcStr::new)); + ops +} + /// Prints a multiplicative induction var level. fn parallel_induction_level(level: &InductionLevel, namer: &NameMap) -> String { let dim_id = level.increment.map(|(dim, _)| dim); @@ -337,9 +382,9 @@ fn ptx_loop(fun: &Function, dim: &Dimension, cfgs: &[Cfg], namer: &mut NameMap) }, DimKind::VECTOR => match *cfgs { [Cfg::Instruction(ref inst)] => vector_inst(inst, dim, namer, fun), - _ => panic!("Invalid vector dimension body"), + ref body => panic!("invalid vector dimension body: {:?}", body), }, - kind => panic!("Invalid loop kind for ptx printing: {:?}", kind) + kind => panic!("invalid loop kind for ptx printing: {:?}", kind) } } @@ -432,6 +477,9 @@ pub fn function(function: &Function, gpu: &Gpu) -> String { } } } + let ind_levels = function.init_induction_levels().into_iter() + .chain(function.block_dims().iter().flat_map(|d| d.induction_levels())); + init.extend(ind_levels.map(|level| parallel_induction_level(level, name_map))); body = cfg(function, function.cfg(), name_map); } let var_decls = var_decls(&namer); diff --git a/src/device/mod.rs b/src/device/mod.rs index ff921d31f..0bd80ba29 100644 --- a/src/device/mod.rs +++ b/src/device/mod.rs @@ -56,9 +56,9 @@ pub trait Device: Sync { /// Returns the processing rates of a single thread, in units/ns fn thread_rates(&self) -> HwPressure; /// Returns the processing rates of a single block, in units/ns. - fn block_rates(&self, max_num_threads: u64) -> HwPressure; + fn block_rates(&self,) -> HwPressure; /// Returns the processing rates of the whole accelerator un units/ns. - fn total_rates(&self, max_num_threads: u64) -> HwPressure; + fn total_rates(&self) -> HwPressure; /// Returns the names of potential bottlenecks. fn bottlenecks(&self) -> &[&'static str]; /// Returns the number of blocks that can be executed in parallel on the device. @@ -67,6 +67,12 @@ pub trait Device: Sync { fn additive_indvar_pressure(&self, t: &ir::Type) -> HwPressure; /// Returns the pressure caused by a multiplicative induction variable level. fn multiplicative_indvar_pressure(&self, t: &ir::Type) -> HwPressure; + /// Adds the overhead (per instance) due to partial wraps and predicated dimensions to + /// the pressure. If the instruction is not predicated, `predicated_dims_size` should + /// be `1`. + fn add_block_overhead(&self, predicated_dims_size: u64, + max_threads_per_blocks: u64, + pressure: &mut HwPressure); /// Lowers a type using the memory space information. Returns `None` if some /// information is not yet specified. diff --git a/src/explorer/choice.rs b/src/explorer/choice.rs index 3e5fcf3b7..605a2d51a 100644 --- a/src/explorer/choice.rs +++ b/src/explorer/choice.rs @@ -27,13 +27,18 @@ pub fn list<'a>(space: &'a SearchSpace<'a>) -> impl Iterator + 'a { }).chain(fun.dims().flat_map(move |dim| { let kinds = space.domain().get_dim_kind(dim.id()); gen_choice(kinds.list(), &|k| Action::DimKind(dim.id(), k)) + })).chain(fun.dims().enumerate().flat_map(move |(i, lhs)| { + fun.dims().take(i).flat_map(move |rhs| { + let mappings = space.domain().get_thread_mapping(lhs.id(), rhs.id()); + gen_choice(mappings.list(), &|m| Action::ThreadMapping(lhs.id(), rhs.id(), m)) + }) })).chain(fun.internal_mem_blocks().flat_map(move |block| { let mem_spaces = space.domain().get_mem_space(block.mem_id()); gen_choice(mem_spaces.list(), &|s| Action::MemSpace(block.mem_id(), s)) })).chain(fun.dims().enumerate().flat_map(move |(i, lhs)| { // TODO(search_space): avoid picking ordering decisions that have little impact. // For this, we should avoid dimension-instruction and dimension-vector dim - // orderings. The problem is that we do not know wich choice to pick in the end. + // orderings. The problem is that we do not know wich choice to pick in the end. let lhs = lhs.bb_id(); let dims = fun.dims().take(i).map(|x| x.bb_id()); dims.chain(fun.insts().map(|x| x.bb_id())).flat_map(move |rhs| { @@ -46,16 +51,6 @@ pub fn list<'a>(space: &'a SearchSpace<'a>) -> impl Iterator + 'a { })) } -/* -/// Indicates if two dimensions are worth ordering. -fn should_order_dims(space: &SearchSpace, lhs: ir::dim::Id, rhs: ir::dim::Id) -> bool { - // TODO(search_space): currently ignored ordering decisions may actually - // have an impact. We should use a differential model to detect when. - let lhs_kind = space.domain().get_dim_kind(lhs); - let rhs_kind = space.domain().get_dim_kind(rhs); - !(lhs_kind.intersects(DimKind::VECTOR) || rhs_kind.intersects(DimKind::VECTOR)) -}*/ - /// Generates a choice from a list of possible values. fn gen_choice(values: IT, action_gen: &Fn(T) -> Action) -> Option where IT: IntoIterator { @@ -65,13 +60,13 @@ fn gen_choice(values: IT, action_gen: &Fn(T) -> Action) -> Option /// Chooses an order between instructions and dimensions when multiple are possible. /// The function assumes the order between dimensions is already fixed. +// TODO(search_space): fix order has currently no effect. Should we remove it ? +// It is unused because inst-dim and dim-dim decisions are fixed by the explorer. We +// cannot make them free as we might end-up in a dead-end. pub fn fix_order(mut space: SearchSpace) -> SearchSpace { - // FIXME: unused for the moment, need to replace it // TODO(search_space): make fix_order useless with a differential model trace!("adding arbitrary constraints to the order"); // Fix the order between instructions and dimensions. - // TODO(search_space): put the nesting back into the search space, as it might not - // be avoided by fix_order due to dependencies between orders. let pairs = space.ir_instance().blocks() .cartesian_product(space.ir_instance().dims()) .map(|(lhs, rhs)| (lhs.bb_id(), rhs.bb_id())) diff --git a/src/helper/builder.rs b/src/helper/builder.rs index 043e352c0..836223f83 100644 --- a/src/helper/builder.rs +++ b/src/helper/builder.rs @@ -42,22 +42,28 @@ impl<'a> Builder<'a> { op.get(&self.function, &self.open_dims) } - /// Adds an `Add` instruction to the fuction. - pub fn add<'b: 'a>(&mut self, lhs: &AutoOperand<'b>, rhs: &AutoOperand<'b> - ) -> InstId { + /// Creates a binary operator. + pub fn binop<'b: 'a>(&mut self, + op: ir::BinOp, + lhs: &AutoOperand<'b>, + rhs: &AutoOperand<'b>) -> InstId { let lhs_op = self.get_op(lhs); let rhs_op = self.get_op(rhs); let rounding = default_rounding(&lhs_op.t()); - self.inst(op::Add(lhs_op, rhs_op, rounding)) + self.inst(op::BinOp(op, lhs_op, rhs_op, rounding)) + } + + /// Adds an `Add` instruction to the fuction. + pub fn add<'b: 'a>(&mut self, lhs: &AutoOperand<'b>, rhs: &AutoOperand<'b>) + -> InstId + { + self.binop(ir::BinOp::Add, lhs, rhs) } /// Adds a `Sub` instruction to the function. pub fn sub<'b: 'a>(&mut self, lhs: &AutoOperand<'b>, rhs: &AutoOperand<'b> ) -> InstId { - let lhs_op = self.get_op(lhs); - let rhs_op = self.get_op(rhs); - let rounding = default_rounding(&lhs_op.t()); - self.inst(op::Sub(lhs_op, rhs_op, rounding)) + self.binop(ir::BinOp::Sub, lhs, rhs) } /// Adds a `Mul` instruction to the function. Defaults to low mode. @@ -95,10 +101,7 @@ impl<'a> Builder<'a> { /// Adds a `Div` instruction to the fuction. pub fn div<'b: 'a>(&mut self, lhs: &AutoOperand<'b>, rhs: &AutoOperand<'b> ) -> InstId { - let lhs_op = self.get_op(lhs); - let rhs_op = self.get_op(rhs); - let rounding = default_rounding(&lhs_op.t()); - self.inst(op::Div(lhs_op, rhs_op, rounding)) + self.binop(ir::BinOp::Div, lhs, rhs) } /// Adds a `Mov` instruction to the function. diff --git a/src/helper/mod.rs b/src/helper/mod.rs index 07f7b75a5..c88a35780 100644 --- a/src/helper/mod.rs +++ b/src/helper/mod.rs @@ -25,12 +25,17 @@ impl MetaDimension for ir::dim::Id { } /// A groups of dimensions that act as a single logical dimension. -#[derive(Clone)] +#[derive(Clone, Default)] pub struct DimGroup { dims: Vec } impl DimGroup { /// Creates a dimension group containing the given dimensions. pub fn new(dims: Vec) -> Self { DimGroup { dims } } + + /// Iterates over the sub-dimensions of the group. + pub fn iter(&self) -> std::iter::Cloned> { + self.into_iter() + } } impl MetaDimension for DimGroup { @@ -45,6 +50,13 @@ impl std::ops::Index for DimGroup { fn index(&self, index: usize) -> &ir::dim::Id { &self.dims[index] } } +impl<'a> IntoIterator for &'a DimGroup { + type Item = ir::dim::Id; + type IntoIter = std::iter::Cloned>; + + fn into_iter(self) -> Self::IntoIter { self.dims.iter().cloned() } +} + /// A logical basic block, that can actually be implemented by multiple ones. pub trait MetaBasicBlock { /// Returns the ids on the underlying basic blocks. diff --git a/src/helper/tensor.rs b/src/helper/tensor.rs index d1378de48..738526fb2 100644 --- a/src/helper/tensor.rs +++ b/src/helper/tensor.rs @@ -130,3 +130,10 @@ impl std::ops::Index for VirtualTensor { fn index(&self, idx: usize) -> &Self::Output { &self.dims[idx] } } + +impl<'a> IntoIterator for &'a VirtualTensor { + type Item = &'a DimGroup; + type IntoIter = std::slice::Iter<'a, DimGroup>; + + fn into_iter(self) -> Self::IntoIter { self.dims.iter() } +} diff --git a/src/ir/dimension.rs b/src/ir/dimension.rs index da3823e79..1b5b66adb 100644 --- a/src/ir/dimension.rs +++ b/src/ir/dimension.rs @@ -23,13 +23,18 @@ pub struct Dimension<'a> { size: ir::Size<'a>, id: Id, iterated: Vec, + is_thread_dim: bool, } impl<'a> Dimension<'a> { /// Creates a new dimension. pub fn new(size: ir::Size, id: Id) -> Dimension { assert_ne!(size.as_int(), Some(1)); - Dimension { size, id, iterated: Vec::new() } + Dimension { + size, id, + iterated: Vec::new(), + is_thread_dim: false, + } } /// Retruns the size of the dimension. @@ -45,6 +50,12 @@ impl<'a> Dimension<'a> { /// Adds a bb that is iterated along self. pub fn add_iterated(&mut self, inst: ir::InstId) { self.iterated.push(inst); } + + /// Indicates if the dimension is a thread dimension. + pub fn is_thread_dim(&self) -> bool { self.is_thread_dim } + + /// Sets the dimension as a thread dimension. + pub fn set_thread_dim(&mut self) { self.is_thread_dim = true } } impl<'a> BasicBlock<'a> for Dimension<'a> { diff --git a/src/ir/function.rs b/src/ir/function.rs index e7093f2f5..795933ec5 100644 --- a/src/ir/function.rs +++ b/src/ir/function.rs @@ -34,6 +34,7 @@ pub struct Function<'a> { device: &'a Device, insts: Vec>, dims: Vec>, + thread_dims: VecSet, mem_insts: Vec, mem_blocks: mem::BlockMap<'a>, layouts_to_lower: Vec, @@ -50,6 +51,7 @@ impl<'a> Function<'a> { insts: vec![], mem_insts: vec![], dims: vec![], + thread_dims: VecSet::default(), mem_blocks, layouts_to_lower: Vec::new(), induction_vars: Vec::new(), @@ -110,6 +112,11 @@ impl<'a> Function<'a> { self.insts.iter().map(|x| x as _).chain(self.dims.iter().map(|x| x as _)) } + /// Returns the list of thread dimensions. + pub fn thread_dims(&self) -> impl Iterator> { + self.thread_dims.iter().map(move |&d| self.dim(d)) + } + /// Returns an instruction given its id. pub fn inst(&self, id: InstId) -> &Instruction<'a> { &self.insts[id.0 as usize] } @@ -121,6 +128,11 @@ impl<'a> Function<'a> { /// Retuns a dimension given its id. pub fn dim(&self, id: dim::Id) -> &Dimension<'a> { &self.dims[id.0 as usize] } + /// Returns a mutable reference to a dimension given its ID. + fn dim_mut(&mut self, id: dim::Id) -> &mut Dimension<'a> { + &mut self.dims[id.0 as usize] + } + /// Returns a `BasicBlock` given its id. pub fn block(&self, id: BBId) -> &BasicBlock<'a> { match id { @@ -129,14 +141,6 @@ impl<'a> Function<'a> { } } - /// Returns a mutable reference to a basicblock. - fn block_mut(&mut self, id: BBId) -> &mut BasicBlock<'a> { - match id { - BBId::Inst(id) => &mut self.insts[id.0 as usize], - BBId::Dim(id) => &mut self.dims[id.0 as usize], - } - } - /// Returns the list of memory blocks. The block with id `i` is in i-th position. pub fn mem_blocks<'b>(&'b self) -> impl Iterator { self.mem_blocks.blocks() @@ -176,11 +180,18 @@ impl<'a> Function<'a> { /// iteration dimension was not aleady present in the set. pub fn set_iteration_dim(&mut self, inst: ir::InstId, dim: ir::dim::Id) -> bool { if self.inst_mut(inst).add_iteration_dimension(dim) { - self.dims[dim.0 as usize].add_iterated(inst); + self.dim_mut(dim).add_iterated(inst); true } else { false } } + /// Adds a thread dimension. Indicates if the the dimension was not already present + /// in the set. + pub fn add_thread_dim(&mut self, dim: ir::dim::Id) -> bool { + self.dim_mut(dim).set_thread_dim(); + self.thread_dims.insert(dim) + } + /// Trigger to call when two dimensions are merged. // TODO(cleanup): externalize in the search space the merging of dimensions in dim // maps. diff --git a/src/ir/mod.rs b/src/ir/mod.rs index 94aae5d8d..39597087d 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -19,7 +19,7 @@ pub use self::function::{Function, Signature, Parameter}; pub use self::instruction::{InstId, Instruction}; pub use self::induction_var::{IndVarId, InductionVar}; pub use self::operand::{Operand, DimMapScope}; -pub use self::operator::Operator; +pub use self::operator::{BinOp, Operator}; pub use self::size::Size; pub use self::types::Type; @@ -53,6 +53,7 @@ pub struct NewObjs { pub internal_mem_blocks: Vec, pub mem_insts: Vec, pub iteration_dims: Vec<(InstId, dim::Id)>, + pub thread_dims: Vec, } impl NewObjs { @@ -73,6 +74,7 @@ impl NewObjs { pub fn add_dimension(&mut self, dim: &Dimension) { self.add_bb(dim); self.dimensions.push(dim.id()); + if dim.is_thread_dim() { self.add_thread_dim(dim.id()); } } /// Registers a new basic block. @@ -85,6 +87,9 @@ impl NewObjs { self.iteration_dims.push((inst, dim)); } + /// Sets a dimension as a new thread dimension. + pub fn add_thread_dim(&mut self, dim: dim::Id) { self.thread_dims.push(dim) } + /// Registers a new memory block. pub fn add_mem_block(&mut self, id: mem::InternalId) { self.mem_blocks.push(id.into()); diff --git a/src/ir/operator.rs b/src/ir/operator.rs index 46ef2cab1..850caa5c2 100644 --- a/src/ir/operator.rs +++ b/src/ir/operator.rs @@ -21,20 +21,38 @@ pub enum Rounding { Negative, } +/// Represents binary arithmetic operators. +#[derive(Clone, Copy, Debug)] +pub enum BinOp { + /// Adds two operands. + Add, + /// Substracts two operands. + Sub, + /// Divides two operands, + Div, +} + +impl BinOp { + /// Returns a string representing the operator. + fn as_str(&self) -> &'static str { + match *self { + BinOp::Add => "add", + BinOp::Sub => "sub", + BinOp::Div => "div", + } + } +} + /// The operation performed by an instruction. #[derive(Clone, Debug)] pub enum Operator<'a> { - /// Adds two operands. - Add(Operand<'a>, Operand<'a>, Rounding), - /// Substracts two operands. - Sub(Operand<'a>, Operand<'a>, Rounding), + /// A binary arithmetic operator. + BinOp(BinOp, Operand<'a>, Operand<'a>, Rounding), /// Performs a multiplication with the given return type. Mul(Operand<'a>, Operand<'a>, Rounding, Type), /// Performs s multiplication between the first two operands and adds the /// result to the third. Mad(Operand<'a>, Operand<'a>, Operand<'a>, Rounding), - /// Performs a division. - Div(Operand<'a>, Operand<'a>, Rounding), /// Moves a value into a register. Mov(Operand<'a>), /// Loads a value of the given type from the given address. @@ -62,9 +80,7 @@ impl<'a> Operator<'a> { assert!(device.is_valid_type(&t)); } match *self { - Add(ref lhs, ref rhs, rounding) | - Sub(ref lhs, ref rhs, rounding) | - Div(ref lhs, ref rhs, rounding) => { + BinOp(_, ref lhs, ref rhs, rounding) => { assert!(lhs.t().is_float() ^ (rounding == Rounding::Exact)); assert_eq!(lhs.t(), rhs.t()); }, @@ -104,11 +120,9 @@ impl<'a> Operator<'a> { /// Returns the type of the value produced. pub fn t(&self) -> Type { match *self { - Add(ref op, _, _) | - Sub(ref op, _, _) | + BinOp(_, ref op, ..) | Mov(ref op) | - Mad(_, _, ref op, _) | - Div(ref op, _, _) => op.t(), + Mad(_, _, ref op, _) => op.t(), Ld(t, ..) | TmpLd(t, _) | Cast(_, t) | Mul(.., t) => t, St(..) | TmpSt(..) => Type::Void, } @@ -117,10 +131,8 @@ impl<'a> Operator<'a> { /// Retruns the list of operands. pub fn operands(&self) -> Vec<&Operand<'a>> { match *self { - Add(ref lhs, ref rhs, _) | - Sub(ref lhs, ref rhs, _) | + BinOp(_, ref lhs, ref rhs, _) | Mul(ref lhs, ref rhs, _, _) | - Div(ref lhs, ref rhs, _) | St(ref lhs, ref rhs, _, _) => vec![lhs, rhs], Mad(ref mul_lhs, ref mul_rhs, ref add_rhs, _) => vec![mul_lhs, mul_rhs, add_rhs], @@ -135,10 +147,8 @@ impl<'a> Operator<'a> { /// Retruns the list of mutable references to operands. pub fn operands_mut<'b>(&'b mut self) -> Vec<&'b mut Operand<'a>> { match *self { - Add(ref mut lhs, ref mut rhs, _) | - Sub(ref mut lhs, ref mut rhs, _) | + BinOp(_, ref mut lhs, ref mut rhs, _) | Mul(ref mut lhs, ref mut rhs, _, _) | - Div(ref mut lhs, ref mut rhs, _) | St(ref mut lhs, ref mut rhs, _, _) => vec![lhs, rhs], Mad(ref mut mul_lhs, ref mut mul_rhs, ref mut add_rhs, _) => vec![mul_lhs, mul_rhs, add_rhs], @@ -154,12 +164,10 @@ impl<'a> Operator<'a> { pub fn has_side_effects(&self) -> bool { match *self { St(_, _, b, _) => b, - Add(..) | - Sub(..) | + BinOp(..) | Mul(..) | Mad(..) | Mov(..) | - Div(..) | Ld(..) | TmpLd(..) | TmpSt(..) | @@ -184,11 +192,9 @@ impl<'a> Operator<'a> { pattern.stride(dim.id()) == Stride::Int(type_len as i32) } else { false } }, - Add(..) | - Sub(..) | + BinOp(..) | Mul(..) | Mad(..) | - Div(..) | Mov(..) | Cast(..) => false, TmpLd(..) | @@ -228,12 +234,10 @@ impl<'a> Operator<'a> { impl<'a> fmt::Display for Operator<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let name = match *self { - Add(..) => "add", - Sub(..) => "sub", + BinOp(op, ..) => op.as_str(), Mul(..) => "mul", Mad(..) => "mad", Mov(..) => "mov", - Div(..) => "div", Ld(..) => "ld", St(..) => "st", TmpLd(..) => "tmp_ld", diff --git a/src/model/hw_pressure.rs b/src/model/hw_pressure.rs index 6dbd91a93..4d23a3fdb 100644 --- a/src/model/hw_pressure.rs +++ b/src/model/hw_pressure.rs @@ -135,7 +135,7 @@ pub enum FastOrigin { } /// The level at which a bottleneck is computed. -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] pub enum BottleneckLevel { Global, Block, Thread } impl BottleneckLevel { @@ -242,6 +242,7 @@ impl Origin { x @ Origin::Latency | x @ Origin::Bottleneck(..) | x @ Origin::HardwareEvaluation => (false, x, false), + Origin::Loop { iterations: 0, .. } => (true, Origin::Latency, true), Origin::Loop { dims, iterations, inner } => { let inner = Box::new(inner.simplify().1); (true, Origin::Loop { dims, iterations, inner }, true) @@ -292,11 +293,11 @@ impl fmt::Display for Origin { write!(f, "the pressure on {} at the {}", name, level), Origin::HardwareEvaluation => write!(f, "the evaluation on the hardware"), Origin::Loop { ref dims, iterations, ref inner } => { - write!(f, "{} iterations along dimensions [{}] of {}", + write!(f, "{} iterations along dimensions [{}] of {{ {} }}", iterations, dims.iter().format(", "), inner) }, Origin::Scale { ref inner, factor } => - write!(f, "scale by {:.2e}: {}", factor, inner), + write!(f, "scale by {:.2e}: {}", factor, inner), Origin::Chain { ref before, ref mid_point, ref after } => { display_inline_chain(before, f)?; write!(f, " to {}, then ", mid_point)?; @@ -312,7 +313,7 @@ fn display_inline_chain(bound: &Bound, f: &mut fmt::Formatter) -> fmt::Result { if let Origin::Chain { .. } = bound.origin { write!(f, "{}", bound.origin) } else { - write!(f, "{:.2e}ns ({})", bound.value, bound.origin) + write!(f, "{:.2e}ns: {}", bound.value, bound.origin) } } @@ -397,4 +398,12 @@ impl HwPressure { /// Returns the pressure on a bottleneck. #[cfg(test)] pub fn get_bottleneck(&self, index: usize) -> f64 { self.bottlenecks[index] } + + /// Pointwise multiplication of the pressure on each resource. + pub fn multiply(&mut self, other: &HwPressure) { + self.latency *= other.latency; + for (b, &other_b) in self.bottlenecks.iter_mut().zip_eq(&other.bottlenecks) { + *b *= other_b; + } + } } diff --git a/src/model/level.rs b/src/model/level.rs index 26625a8da..904d9e5a5 100644 --- a/src/model/level.rs +++ b/src/model/level.rs @@ -42,7 +42,7 @@ impl Level { // Compute the thread-level pressure. let thread_rates = device.thread_rates(); let pressure = sum_pressure( - device, space, local_info, BottleneckLevel::Thread, 1, &dims); + device, space, local_info, BottleneckLevel::Thread, &dims); let end_latency = dims.iter().map(|d| { local_info.dim_overhead[d].1.bound(BottleneckLevel::Thread, &thread_rates) }).min().unwrap_or_else(FastBound::zero); @@ -63,14 +63,23 @@ pub fn sum_pressure(device: &Device, space: &SearchSpace, local_info: &LocalInfo, bound_level: BottleneckLevel, - min_num_threads: u64, dims: &[ir::dim::Id]) -> HwPressure { // Compute the pressure induced by the dimensions overhead. let mut pressure = HwPressure::min(dims.iter().map(|d| &local_info.dim_overhead[d].0)) .unwrap_or_else(|| HwPressure::zero(device)); if dims.is_empty() { - let thread_overhead = &local_info.thread_overhead; - pressure.repeat_and_add_bottlenecks(min_num_threads as f64, thread_overhead); + let threads_per_block = space.domain().get_num_threads().min as u64; + let num_threads = match bound_level { + BottleneckLevel::Global => + threads_per_block * local_info.parallelism.min_num_blocks, + BottleneckLevel::Block => threads_per_block, + BottleneckLevel::Thread => 1, + }; + let mut init_pressure = local_info.thread_overhead.clone(); + if bound_level <= BottleneckLevel::Block { + device.add_block_overhead(1, num_threads, &mut init_pressure); + } + pressure.repeat_and_add_bottlenecks(num_threads as f64, &init_pressure); } // Get the list of inner dimensions and inner dimensions on wich the pressure is summed. let inner_dim_sets = dims.iter().map(|&d| &local_info.nesting[&d.into()].inner_dims); @@ -89,21 +98,38 @@ pub fn sum_pressure(device: &Device, }); // Sum the pressure on all bbs. for bb in inner_bbs { + let nesting = &local_info.nesting[&bb]; // Skip dimensions that can be merged into another one. let merge_dims = &local_info.nesting[&bb].bigger_merged_dims; if inner_dims.intersection(merge_dims).next().is_some() { continue; } // Compute the pressure of a single instance and the number of instances. - let num_instances = inner_sum_dims + let mut num_instances = inner_sum_dims .intersection(&local_info.nesting[&bb].outer_dims) .map(|d| f64::from(local_info.dim_sizes[d])) .product::(); - let bb_pressure = if let ir::BBId::Dim(dim) = bb { + let mut bb_pressure = if let ir::BBId::Dim(dim) = bb { let kind = space.domain().get_dim_kind(dim); if !bound_level.accounts_for_dim(kind) { - &local_info.dim_overhead[&dim].0 - } else { &local_info.hw_pressure[&bb] } - } else { &local_info.hw_pressure[&bb] }; - pressure.repeat_and_add_bottlenecks(num_instances, bb_pressure); + local_info.dim_overhead[&dim].0.clone() + } else { local_info.hw_pressure[&bb].clone() } + } else { local_info.hw_pressure[&bb].clone() }; + // From parallel levels, we must take into account the thread dimensions that re + // not mapped to a dimension outside of the block. Predicated instructions require + // special care as they are only active on the dimensions they are nested on. Other + // threads just skip the instruction. + if bound_level <= BottleneckLevel::Block { + let is_predicated = space.ir_instance().block(bb).as_inst() + .map(|i| i.has_side_effects()).unwrap_or(false); + let predicated_size = if is_predicated { + nesting.num_unmapped_threads as u64 + } else { + num_instances *= nesting.num_unmapped_threads as f64; + 1 + }; + let max_threads = nesting.max_threads_per_block; + device.add_block_overhead(predicated_size, max_threads, &mut bb_pressure); + } + pressure.repeat_and_add_bottlenecks(num_instances, &bb_pressure); } pressure } @@ -122,16 +148,12 @@ fn intersect_sets<'a, T, IT>(mut it: IT) -> Option> /// Generates a bound based on the pressure produced by a block of threads. fn block_bound(device: &Device, space: &SearchSpace, info: &LocalInfo, dims: &[ir::dim::Id]) -> FastBound { - // Compute the minimal and maximal number of threads. - let min_num_threads = info.parallelism.min_num_threads_per_block; - let max_num_threads = info.parallelism.max_num_threads_per_block; // Compute the pressure on the execution units in a single iteration. - let mut pressure = sum_pressure(device, space, info, BottleneckLevel::Block, - min_num_threads, dims); + let mut pressure = sum_pressure(device, space, info, BottleneckLevel::Block, dims); // Repeat the pressure by the number of iterations of the level and compute the bound. let n_iters = dims.iter().map(|&d| u64::from(info.dim_sizes[&d])).product::(); pressure.repeat_parallel(n_iters as f64); - pressure.bound(BottleneckLevel::Block, &device.block_rates(max_num_threads)) + pressure.bound(BottleneckLevel::Block, &device.block_rates()) } /// Indicates if a dimension should be considered for dimension levels. diff --git a/src/model/local_info.rs b/src/model/local_info.rs index e20b461b9..7a6fac34a 100644 --- a/src/model/local_info.rs +++ b/src/model/local_info.rs @@ -1,9 +1,11 @@ //! Compute and represent local information on the different objects representing of the IR. use device::{Context, Device}; use ir::{self, BasicBlock}; +use itertools::Itertools; use model::HwPressure; -use search_space::{DimKind, Domain, Order, SearchSpace}; -use std::cmp; +use num::integer::lcm; +use search_space::{DimKind, Domain, Order, SearchSpace, ThreadMapping}; +use std; use utils::*; /// Local information on the different objects. @@ -29,14 +31,30 @@ impl LocalInfo { pub fn compute(space: &SearchSpace, context: &Context) -> Self { let dim_sizes = space.ir_instance().dims() .map(|d| (d.id(), context.eval_size(d.size()))).collect(); - let nesting = space.ir_instance().blocks() - .map(|bb| (bb.bb_id(), Nesting::compute(space, bb.bb_id()))).collect(); + let nesting: HashMap<_, _> = space.ir_instance().blocks().map(|bb| { + (bb.bb_id(), Nesting::compute(space, bb.bb_id(), &dim_sizes)) + }).collect(); let mut hw_pressure = space.ir_instance().blocks().map(|bb| { - (bb.bb_id(), context.device().hw_pressure(space, &dim_sizes, &nesting, bb)) + let is_thread = if let ir::BBId::Dim(id) = bb.bb_id() { + space.domain().get_dim_kind(id) == DimKind::THREAD + } else { false }; + // Only keep the pressure of innermost thread dimensions. Otherwise it + // will be taken multiple times into account. + let pressure = if is_thread && nesting[&bb.bb_id()].has_inner_thread_dims { + HwPressure::zero(context.device()) + } else { context.device().hw_pressure(space, &dim_sizes, &nesting, bb) }; + (bb.bb_id(), pressure) }).collect(); let mut dim_overhead = space.ir_instance().dims().map(|d| { let kind = space.domain().get_dim_kind(d.id()); - (d.id(), context.device().loop_iter_pressure(kind)) + if kind == DimKind::THREAD && nesting[&d.bb_id()].has_inner_thread_dims { + // Only keep the overhead on innermost thread dimensions. Otherwise it + // will be taken multiple times into account. + let zero = HwPressure::zero(context.device()); + (d.id(), (zero.clone(), zero)) + } else { + (d.id(), context.device().loop_iter_pressure(kind)) + } }).collect(); let parallelism = parallelism(space, &nesting, &dim_sizes); // Add the pressure induced by induction variables. @@ -63,12 +81,15 @@ fn add_indvar_pressure(device: &Device, if dim_kind.intersects(DimKind::VECTOR) { continue; } let t = device.lower_type(indvar.base().t(), space).unwrap_or(ir::Type::I(32)); let mut overhead = if dim_kind.intersects(DimKind::UNROLL | DimKind::LOOP) { + // FIXME: do not add the latency if the induction level can statically computed. + // This is the case when: + // - the loop is unrolled + // - the increment is a constant + // - both the conditions are also true for an inner dimension. device.additive_indvar_pressure(&t) } else { device.multiplicative_indvar_pressure(&t) }; - // FIXME: do not add the latency for additive unrolled dimension that can be - // precomputed let size = dim_sizes[&dim]; if dim_kind.intersects(DimKind::THREAD | DimKind::BLOCK) { thread_overhead.add_parallel(&overhead); @@ -84,11 +105,11 @@ fn add_indvar_pressure(device: &Device, /// Nesting of an object. #[derive(Debug)] pub struct Nesting { - /// Dimensions nested outside the current BB. + /// Dimensions nested inside the current BB. pub inner_dims: VecSet, /// Basic blocks nested inside the current BB. pub inner_bbs: VecSet, - /// Dimensions nested inside the current BB. + /// Dimensions nested outsidethe current BB. pub outer_dims: VecSet, /// Dimensions to be processed before the current BB. pub before_self: VecSet, @@ -96,36 +117,68 @@ pub struct Nesting { pub after_self: VecSet, /// The dimensions that can be merged to this one and have a bigger ID. pub bigger_merged_dims: VecSet, + /// Indicates if the block may have thread dimensions nested inside it. + /// Only consider thread dimensions that are sure to be mapped to threads. + has_inner_thread_dims: bool, + /// Number of threads that are not represented in the active dimensions of the block. + pub num_unmapped_threads: u32, + /// Maximal number of threads this block can be in, considering only outer and mapped + /// out dimensions. + pub max_threads_per_block: u64 } impl Nesting { /// Computes the nesting of a `BasicBlock`. - fn compute(space: &SearchSpace, bb: ir::BBId) -> Self { + fn compute(space: &SearchSpace, bb: ir::BBId, + dim_sizes: &HashMap) -> Self { let mut inner_dims = Vec::new(); let mut inner_bbs = Vec::new(); let mut before_self = Vec::new(); let mut after_self = Vec::new(); let mut bigger_merged_dims = Vec::new(); - for other_bb in space.ir_instance().blocks().map(|bb| bb.bb_id()) { - if other_bb == bb { continue; } - let order = space.domain().get_order(other_bb, bb); - if Order::INNER.contains(order) { inner_bbs.push(other_bb); } - if let ir::BBId::Dim(id) = other_bb { - if Order::INNER.contains(order) { inner_dims.push(id); } - if (Order::INNER | Order::BEFORE).contains(order) { before_self.push(id); } - if (Order::OUTER | Order::AFTER).contains(order) { after_self.push(id); } - if order.intersects(Order::MERGED) && other_bb > bb { - bigger_merged_dims.push(id); + let mut has_inner_thread_dims = false; + for other_bb in space.ir_instance().blocks() { + if other_bb.bb_id() == bb { continue; } + let order = space.domain().get_order(other_bb.bb_id(), bb); + if Order::INNER.contains(order) { inner_bbs.push(other_bb.bb_id()); } + if let Some(dim) = other_bb.as_dim() { + let other_kind = space.domain().get_dim_kind(dim.id()); + if Order::INNER.contains(order) { inner_dims.push(dim.id()); } + if order.intersects(Order::INNER) { + if other_kind == DimKind::THREAD { has_inner_thread_dims = true; } + } + if (Order::INNER | Order::BEFORE).contains(order) { + before_self.push(dim.id()); + } + if (Order::OUTER | Order::AFTER).contains(order) { + after_self.push(dim.id()); + } + if order.intersects(Order::MERGED) && other_bb.bb_id() > bb { + bigger_merged_dims.push(dim.id()); } } } + let outer_dims = Self::get_iteration_dims(space, bb); + let num_unmapped_threads = space.ir_instance().thread_dims().filter(|dim| { + !outer_dims.iter().any(|&other| { + if dim.id() == other { return true; } + let mapping = space.domain().get_thread_mapping(dim.id(), other); + mapping.intersects(ThreadMapping::MAPPED) + }) + }).map(|d| dim_sizes[&d.id()]).product::(); + let max_threads_per_block = outer_dims.iter().cloned().filter(|&d| { + space.domain().get_dim_kind(d).intersects(DimKind::THREAD) + }).map(|d| dim_sizes[&d] as u64).product::() * num_unmapped_threads as u64; Nesting { inner_dims: VecSet::new(inner_dims), inner_bbs: VecSet::new(inner_bbs), - outer_dims: Self::get_iteration_dims(space, bb), + outer_dims, before_self: VecSet::new(before_self), after_self: VecSet::new(after_self), bigger_merged_dims: VecSet::new(bigger_merged_dims), + has_inner_thread_dims, + num_unmapped_threads, + max_threads_per_block, } } @@ -157,23 +210,14 @@ pub struct Parallelism { /// Minimal number of block of threads. pub min_num_blocks: u64, /// Maximal number of blocks of threads. - pub max_num_blocks: u64, - /// Minimal number of threads in the whole GPU. - pub min_num_threads: u64, - /// Minimal number of threads per thread blocks. - pub min_num_threads_per_block: u64, - /// Maximal number of threads per thread blocks. - pub max_num_threads_per_block: u64, + pub lcm_num_blocks: u64, } impl Default for Parallelism { fn default() -> Self { Parallelism { min_num_blocks: 1, - max_num_blocks: 1, - min_num_threads: 1, - min_num_threads_per_block: 1, - max_num_threads_per_block: 1, + lcm_num_blocks: 1, } } } @@ -187,20 +231,11 @@ fn parallelism(space: &SearchSpace, nesting: &HashMap, let kind = space.domain().get_dim_kind(dim); let size = u64::from(dim_sizes[&dim]); if kind == DimKind::BLOCK { par.min_num_blocks *= size; } - if kind.intersects(DimKind::BLOCK) { par.max_num_blocks *= size; } - let thread_or_block = DimKind::THREAD | DimKind::BLOCK; - if thread_or_block.contains(kind) { par.min_num_threads *= size; } - if kind == DimKind::THREAD { par.min_num_threads_per_block *= size; } - if DimKind::THREAD.intersects(kind) { par.max_num_threads_per_block *= size; } + if kind.intersects(DimKind::BLOCK) { par.lcm_num_blocks *= size; } } par - }).fold(Parallelism::default(), |lhs, rhs| Parallelism { - min_num_blocks: cmp::max(lhs.min_num_blocks, rhs.min_num_blocks), - max_num_blocks: cmp::max(lhs.max_num_blocks, rhs.max_num_blocks), - min_num_threads: cmp::max(lhs.min_num_threads, rhs.min_num_threads), - min_num_threads_per_block: cmp::max( - lhs.min_num_threads_per_block, rhs.min_num_threads_per_block), - max_num_threads_per_block: cmp::max( - lhs.max_num_threads_per_block, rhs.max_num_threads_per_block), - }) + }).fold1(|lhs, rhs| Parallelism { + min_num_blocks: std::cmp::min(lhs.min_num_blocks, rhs.min_num_blocks), + lcm_num_blocks: lcm(lhs.lcm_num_blocks, rhs.lcm_num_blocks), + }).unwrap_or(Parallelism::default()) } diff --git a/src/model/mod.rs b/src/model/mod.rs index b4817aabb..f0f886b44 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -5,7 +5,7 @@ mod hw_pressure; mod level; mod local_info; -pub use self::hw_pressure::{Bound, HwPressure}; +pub use self::hw_pressure::{Bound, HwPressure, BottleneckLevel}; pub use self::local_info::Nesting; // TODO(model): One some instruction, the latency dependens on the operand position. @@ -34,7 +34,7 @@ use model::code_point::{CodePoint, CodePointDag}; use model::dependency_map::DependencyMap; use model::level::{Level, RepeatLevel, LevelDag, sum_pressure}; use model::local_info::LocalInfo; -use model::hw_pressure::{FastBound, BottleneckLevel}; +use model::hw_pressure::{FastBound}; use search_space::SearchSpace; use std::cmp; use utils::*; @@ -75,14 +75,13 @@ pub fn bound(space: &SearchSpace, context: &Context) -> Bound { // Scale the latency to the block level. let block_parallelism = u64::from(context.device().block_parallelism(space)); let min_num_blocks = local_info.parallelism.min_num_blocks; - let max_num_blocks = local_info.parallelism.max_num_blocks; - let latency = block_latency.scale(block_parallelism, min_num_blocks, max_num_blocks); + let lcm_num_blocks = local_info.parallelism.lcm_num_blocks; + let latency = block_latency.scale(block_parallelism, min_num_blocks, lcm_num_blocks); // Compute the throughput bound at the whole device level. - let min_num_threads = local_info.parallelism.min_num_threads; - let max_num_threads = local_info.parallelism.max_num_threads_per_block; let global_pressure = sum_pressure(context.device(), space, &local_info, - BottleneckLevel::Global, min_num_threads, &[]); - let device_rates = context.device().total_rates(max_num_threads); + BottleneckLevel::Global, &[]); + trace!("global pressure {:?}", global_pressure); + let device_rates = context.device().total_rates(); let throughput_bound = global_pressure.bound(BottleneckLevel::Global, &device_rates); // Return the biggest bound. debug!("full block lat: {}", unwrap!(levels[0].repeated_latency.as_ref()).value()); @@ -283,70 +282,301 @@ fn apply_dim_map(device: &Device, } } -#[test] #[cfg(feature="cuda")] -fn inner_bound_0() { - use device::{Context, cuda}; - use helper; - use search_space::{Action, DimKind, Order}; - - let _ = ::env_logger::try_init(); - let executor = cuda::Executor::init(); - let mut context = cuda::Context::new(&executor); - let b; - let signature = { - let mut builder = helper::SignatureBuilder::new("bound_error", &mut context); - builder.scalar("k", 1024); - b = builder.array::("b", 1024*8).0; - builder.get() - }; - - let mut builder = helper::Builder::new(&signature, context.device()); - - let size_4 = builder.cst_size(4); - let size_2 = builder.cst_size(2); - - let a_dim_0 = builder.open_dim(size_4.clone()); - let a_dim_1 = builder.open_dim(size_4.clone()); - builder.mov(&0f32); - builder.close_dim(&a_dim_1); - builder.close_dim(&a_dim_0); - - let b_dim_0 = builder.open_dim(size_4); - let b_dim_1 = builder.open_dim(size_2); - let t = ir::Type::F(32); - let (addr, pattern) = builder.tensor_access(&"b", b, &t, &[&b_dim_0, &b_dim_1]); - let ld_b = builder.ld(t, &addr, pattern); - builder.close_dim(&b_dim_0); - - builder.action(Action::DimKind(a_dim_1, DimKind::THREAD_Z)); - builder.action(Action::DimKind(a_dim_0, DimKind::THREAD_Y)); - builder.action(Action::DimKind(b_dim_1, DimKind::THREAD_X)); - - builder.order(&a_dim_1, &ld_b, Order::OUTER); - builder.order(&a_dim_0, &ld_b, Order::OUTER); - - let mut space = builder.get(); - let partial_pressure = { - let local_info = LocalInfo::compute(&space, &context); - let min_num_threads = local_info.parallelism.min_num_threads; - println!("partial nesting {:?}", local_info.nesting[&ld_b.into()].outer_dims); - println!("partial pressure {}", local_info.hw_pressure[&ld_b.into()].get_bottleneck(4)); - sum_pressure(context.device(), &space, &local_info, - BottleneckLevel::Global, min_num_threads, &[]) - }.get_bottleneck(4); - - let actions = vec![Action::DimKind(b_dim_0, DimKind::THREAD_Z)]; - assert!(space.apply_decisions(actions).is_ok()); - let final_pressure = { - let local_info = LocalInfo::compute(&space, &context); - let min_num_threads = local_info.parallelism.min_num_threads; - println!("final nesting {:?}", local_info.nesting[&ld_b.into()].outer_dims); - println!("final pressure {}", local_info.hw_pressure[&ld_b.into()].get_bottleneck(4)); - sum_pressure(context.device(), &space, &local_info, - BottleneckLevel::Global, min_num_threads, &[]) - }.get_bottleneck(4); - - assert!(partial_pressure <= final_pressure * 1.001, - "{} > {}", partial_pressure, final_pressure); +#[cfg(test)] +mod cuda_tests { + use codegen; + use device::{Context, cuda, EvalMode}; + use env_logger; + use helper::*; + use model; + use search_space::*; + use super::*; + + #[test] + fn partial_bound_0() { + let _ = env_logger::try_init(); + let executor = cuda::Executor::init(); + let mut context = cuda::Context::new(&executor); + let z; + let signature = { + let mut builder = SignatureBuilder::new("test", &mut context); + z = builder.array::("z", 16).0; + builder.get() + }; + + let mut builder = Builder::new(&signature, context.device()); + let size = builder.cst_size(4); + + let dim_x = builder.open_dim_ex(size.clone(), DimKind::THREAD); + let dim_y = builder.open_dim_ex(size.clone(), DimKind::THREAD); + builder.mov(&0f32); + builder.close_dim(&dim_y); + builder.close_dim(&dim_x); + + let dim_z = builder.open_dim_ex(size, DimKind::THREAD); + let (addr, pattern) = builder.tensor_access(&"z", z, &ir::Type::F(32), &[&dim_z]); + let st_z = builder.st(&addr, &0f32, pattern); + + builder.order(&dim_x, &dim_z, Order::BEFORE); + builder.order(&dim_x, &dim_y, Order::OUTER); + + let partial_pressure = { + let space = builder.get_clone(); + let local_info = LocalInfo::compute(&space, &context); + trace!("partial nesting: {:?}", local_info.nesting[&st_z.into()]); + sum_pressure(context.device(), &space, &local_info, + BottleneckLevel::Global, &[]) + }.get_bottleneck(3); + + builder.action(Action::ThreadMapping(dim_z, dim_x, ThreadMapping::MAPPED_OUT)); + let final_pressure = { + let space = builder.get_clone(); + let local_info = LocalInfo::compute(&space, &context); + trace!("final nesting: {:?}", local_info.nesting[&st_z.into()]); + sum_pressure(context.device(), &space, &local_info, + BottleneckLevel::Global, &[]) + }.get_bottleneck(3); + + assert!(final_pressure*1.001 >= partial_pressure, "{} < {}", + final_pressure, partial_pressure); + } + + #[test] + fn partial_bound_1() { + let _ = env_logger::try_init(); + let executor = cuda::Executor::init(); + let mut context = cuda::Context::new(&executor); + let z; + let signature = { + let mut builder = SignatureBuilder::new("test", &mut context); + z = builder.array::("z", 256).0; + builder.get() + }; + + let mut builder = Builder::new(&signature, context.device()); + let size = builder.cst_size(256); + let dim_x = builder.open_dim_ex(size.clone(), DimKind::THREAD); + builder.mov(&0f32); + builder.close_dim(&dim_x); + + let dim_z = builder.open_dim(size); + let (addr, pattern) = builder.tensor_access(&"z", z, &ir::Type::F(32), &[&dim_z]); + let st_z = builder.st(&addr, &0f32, pattern); + + let partial_pressure = { + let space = builder.get_clone(); + let local_info = LocalInfo::compute(&space, &context); + trace!("partial nesting: {:?}", local_info.nesting[&st_z.into()]); + sum_pressure(context.device(), &space, &local_info, + BottleneckLevel::Global, &[]) + }.get_bottleneck(5); + + builder.action(Action::DimKind(dim_z, DimKind::THREAD)); + let final_pressure = { + let space = builder.get(); + let local_info = LocalInfo::compute(&space, &context); + trace!("final nesting: {:?}", local_info.nesting[&st_z.into()]); + sum_pressure(context.device(), &space, &local_info, + BottleneckLevel::Global, &[]) + }.get_bottleneck(5); + + assert!(final_pressure*1.001 >= partial_pressure, "{} < {}", + final_pressure, partial_pressure); + } + + + #[test] + fn partial_bound_2() { + let _ = env_logger::try_init(); + let executor = cuda::Executor::init(); + let mut context = cuda::Context::new(&executor); + + let (x, y, a); + let signature = { + let mut builder = SignatureBuilder::new("test", &mut context); + builder.scalar("m", 1i32 << 13); + builder.scalar("n", 1i32 << 13); + let m_size = tensor::DimSize::Param("m"); + let n_size = tensor::DimSize::Param("n"); + x = builder.tensor::("x", vec![n_size], true); + a = builder.tensor::("a", vec![m_size, n_size], true); + y = builder.tensor::("y", vec![m_size], false); + builder.get() + }; + + let m_tiling = &[2]; + + let mut builder = Builder::new(&signature, context.device()); + let ld_x = x.load(&[&[]], &mut builder); + let ld_a = a.load(&[m_tiling, &[]], &mut builder); + + let init_dim_m = builder.open_mapped_dim(&ld_a[0]); + let init = builder.mov(&0f32); + let acc_dim_m = builder.open_mapped_dim(&init_dim_m); + let acc_dim_n = builder.open_mapped_dim(&ld_x[0]); + let a_op = ld_a.dim_map(&[&acc_dim_m, &acc_dim_n], ir::DimMapScope::Global, + &mut builder); + let x_op = ld_x.dim_map(&[&acc_dim_n], ir::DimMapScope::Global, &mut builder); + let acc = builder.mad(&a_op, &x_op, &Reduce(init)); + builder.close_dim(&acc_dim_n); + + let sum = tensor::VirtualTensor::new(acc, vec![acc_dim_m.clone()]); + let st_y = sum.store(&y, &mut builder); + + builder.action(Action::DimKind(ld_a[0][1], DimKind::UNROLL)); + builder.action(Action::DimKind(init_dim_m[1], DimKind::UNROLL)); + builder.action(Action::DimKind(st_y[0][1], DimKind::UNROLL)); + + builder.order(&acc_dim_n, &st_y.inst(), Order::BEFORE); + builder.order(&ld_a[0][1], &ld_x.inst(), Order::BEFORE); + builder.order(&acc_dim_m[1], &ld_x.inst(), Order::AFTER); + + builder.action(Action::InstFlag(ld_x.inst(), InstFlag::MEM_CG)); + builder.action(Action::InstFlag(ld_a.inst(), InstFlag::MEM_CG)); + builder.action(Action::InstFlag(st_y.inst(), InstFlag::MEM_CS)); + + let partial_bound = model::bound(&builder.get_clone(), &context); + builder.action(Action::DimKind(ld_a[0][0], DimKind::BLOCK)); + + let final_bound = model::bound(&builder.get(), &context); + + assert!(final_bound.value()*1.001 >= partial_bound.value(), "{} < {}", + final_bound, partial_bound); + + } + + #[test] + fn partial_bound_3() { + let _ = env_logger::try_init(); + let executor = cuda::Executor::init(); + let mut context = cuda::Context::new(&executor); + + let (a, b, c); + let signature = { + let mut builder = SignatureBuilder::new("test", &mut context); + + builder.scalar("m", 1024i32); + builder.scalar("n", 1024i32); + builder.scalar("k", 1024i32); + let m_size = tensor::DimSize::Param("m"); + let n_size = tensor::DimSize::Param("n"); + let k_size = tensor::DimSize::Param("k"); + a = builder.tensor::("a", vec![m_size, k_size], true); + b = builder.tensor::("b", vec![k_size, n_size], true); + c = builder.tensor::("c", vec![m_size, n_size], false); + builder.get() + }; + + let full_tiling = vec![64, 4]; + let small_tiling = vec![64]; + let mut builder = Builder::new(&signature, context.device()); + + let ld_a = a.load(&[&full_tiling, &small_tiling], &mut builder); + let ld_b = b.load(&[&small_tiling, &full_tiling], &mut builder); + + let init_dim_m = builder.open_mapped_dim(&ld_a[0]); + let init_dim_n = builder.open_mapped_dim(&ld_b[1]); + let acc_init = builder.mov(&0f32); + let acc_dim_m = builder.open_mapped_dim(&init_dim_m); + let acc_dim_n = builder.open_mapped_dim(&init_dim_n); + let acc_dim_k = builder.open_mapped_dim(&ld_a[1]); + let a_op = ld_a.dim_map(&[&acc_dim_m, &acc_dim_k], ir::DimMapScope::Global, &mut builder); + let b_op = ld_b.dim_map(&[&acc_dim_k, &acc_dim_n], ir::DimMapScope::Global, &mut builder); + let acc = builder.mad(&a_op, &b_op, &Reduce(acc_init)); + builder.close_dim(&acc_dim_k); + + builder.action(Action::InstFlag(ld_a.inst(), InstFlag::MEM_CG)); + builder.action(Action::InstFlag(ld_b.inst(), InstFlag::MEM_CG)); + + builder.action(Action::DimKind(ld_a[0][0], DimKind::BLOCK)); + builder.action(Action::DimKind(ld_a[0][1], DimKind::THREAD)); + builder.action(Action::DimKind(ld_a[0][2], DimKind::UNROLL)); + builder.action(Action::DimKind(ld_a[1][1], DimKind::LOOP)); + + builder.action(Action::DimKind(ld_b[0][1], DimKind::LOOP)); + builder.action(Action::DimKind(ld_b[1][0], DimKind::BLOCK)); + builder.action(Action::DimKind(ld_b[1][1], DimKind::UNROLL)); + builder.action(Action::DimKind(ld_b[1][2], DimKind::VECTOR)); + + builder.action(Action::DimKind(init_dim_m[1], DimKind::THREAD)); + builder.action(Action::DimKind(init_dim_m[2], DimKind::THREAD)); + builder.action(Action::ThreadMapping(ld_a[0][1], init_dim_m[1], ThreadMapping::MAPPED)); + builder.action(Action::ThreadMapping( + init_dim_m[1], init_dim_m[2], ThreadMapping::MAPPED_IN)); + builder.order(&ld_a[0][0], &ld_b[1][0], Order::OUTER); + builder.action(Action::DimKind(init_dim_n[2], DimKind::THREAD)); + + let partial_pressure = { + let space = builder.get_clone(); + let local_info = LocalInfo::compute(&space, &context); + sum_pressure(context.device(), &space, &local_info, + BottleneckLevel::Global, &[]) + }.get_bottleneck(4); + + builder.action(Action::ThreadMapping(init_dim_n[2], ld_a[0][1], ThreadMapping::MAPPED_IN)); + + let final_pressure = { + let space = builder.get(); + let local_info = LocalInfo::compute(&space, &context); + sum_pressure(context.device(), &space, &local_info, + BottleneckLevel::Global, &[]) + }.get_bottleneck(4); + + + assert!(final_pressure*1.001 >= partial_pressure, "{} < {}", + final_pressure, partial_pressure); + } + + #[test] + fn final_bound_0() { + let _ = env_logger::try_init(); + let executor = cuda::Executor::init(); + let mut context = cuda::Context::new(&executor); + + let (x, y, z); + let signature = { + let mut builder = SignatureBuilder::new("test", &mut context); + builder.scalar("n", 1 << 25); + let n_size = tensor::DimSize::Param("n"); + x = builder.tensor::("x", vec![n_size], true); + y = builder.tensor::("y", vec![n_size], true); + z = builder.tensor::("z", vec![n_size], false); + builder.get() + }; + + let tiling = &[1024, 4]; + let mut builder = Builder::new(&signature, context.device()); + + let ld_x = x.load(&[tiling], &mut builder); + let ld_y = y.load(&[tiling], &mut builder); + let mad_dim = builder.open_mapped_dim(&ld_x[0]); + let x_op = ld_x.dim_map(&[&mad_dim], ir::DimMapScope::Global, &mut builder); + let y_op = ld_y.dim_map(&[&mad_dim], ir::DimMapScope::Global, &mut builder); + let mad = tensor::VirtualTensor::new( + builder.mad(&x_op, &4.33f32, &y_op), vec![mad_dim.clone()]); + let st_z = mad.store(&z, &mut builder); + + builder.action(Action::DimKind(ld_x[0][2], DimKind::VECTOR)); + builder.action(Action::DimKind(ld_x[0][1], DimKind::THREAD)); + builder.action(Action::DimKind(ld_x[0][0], DimKind::BLOCK)); + builder.action(Action::DimKind(ld_y[0][2], DimKind::VECTOR)); + builder.action(Action::DimKind(ld_y[0][1], DimKind::THREAD)); + builder.action(Action::DimKind(mad_dim[1], DimKind::THREAD)); + builder.action(Action::DimKind(mad_dim[2], DimKind::UNROLL)); + builder.action(Action::DimKind(st_z[0][1], DimKind::THREAD)); + builder.action(Action::DimKind(st_z[0][2], DimKind::VECTOR)); + builder.order(&ld_x[0][2], &ld_y.inst(), Order::BEFORE); + builder.order(&ld_x[0][1], &ld_y.inst(), Order::BEFORE); + builder.order(&ld_y[0][1], &mad.inst(), Order::BEFORE); + builder.order(&mad_dim[1], &st_z.inst(), Order::OUTER); + builder.action(Action::InstFlag(ld_x.inst(), InstFlag::MEM_CS)); + builder.action(Action::InstFlag(ld_y.inst(), InstFlag::MEM_CG)); + builder.action(Action::InstFlag(st_z.inst(), InstFlag::MEM_CG)); + let space = builder.get(); + let bound = model::bound(&space, &context); + let kernel = codegen::Function::build(&space); + let eval = unwrap!(context.evaluate(&kernel, EvalMode::TestBound)); + assert!(eval * 1.001 >= bound.value(), "{:.2e} < {}", eval, bound); + } } diff --git a/src/search_space/choices.exh b/src/search_space/choices.exh index 509920ed5..b521c0837 100644 --- a/src/search_space/choices.exh +++ b/src/search_space/choices.exh @@ -81,6 +81,19 @@ quotient IterationDims($inst in Instructions) of $dim in Dimensions: add_to_set = "::search_space::add_iteration_dim($fun, $inst, $item)" end +quotient ThreadDims of $dim in Dimensions: + is_thread_dim = dim_kind($dim) is THREAD / thread_mapping is MAPPED + item_type = "ir::Dimension" + id_type = "ir::dim::Id" + item_getter = "$fun.dim($id)" + id_getter = "$item.id()" + iterator = "$fun.thread_dims()" + var_prefix = "thread_dim" + new_objs = "$objs.thread_dims" + from_superset = "(if $item.is_thread_dim() { Some($item) } else { None })" + add_to_set = "::search_space::add_thread_dim($fun, $item)" +end + /// Specifies how iteration dimensions are implemented. define enum dim_kind($dim in Dimensions): /// The dimension is implemented as a regular loop. @@ -104,22 +117,8 @@ define enum dim_kind($dim in Dimensions): dim_kind($other_dim) is BLOCK || order($dim, $other_dim) is OUTER requires forall $other in BasicBlocks: order($dim, $other) is NESTED | MERGED - /// Outermost thread dimension (reverse CUDA convention). - value THREAD_X: - requires forall $other in Dimensions: - order($dim, $other) is not INNER || dim_kind($other) is not THREAD - /// Middle thread dimension. - value THREAD_Y: - requires num_thread_x($dim) > "0" - requires forall $other in Dimensions: - order($dim, $other) is not INNER || dim_kind($other) is not THREAD_Y | THREAD_Z - /// Innermost thread dimension (reverse CUDA convention). - value THREAD_Z: - requires num_thread_y($dim) > "0" - requires forall $other in Dimensions: - order($dim, $other) is not INNER || dim_kind($other) is not THREAD_Z /// The dimension is mapped to a thread dimension on the device. - alias THREAD = THREAD_X | THREAD_Y | THREAD_Z: + value THREAD: requires "$dim.size().as_int().is_some()" /// The dimension is parallel. alias PARALLEL = BLOCK | THREAD | VECTOR: @@ -226,42 +225,6 @@ require forall $lhs in Dimensions: // Merge constraitns "$lhs.size() == $rhs.size()" || order($lhs, $rhs) is not MERGED dim_kind($lhs) == dim_kind($rhs) || order($lhs, $rhs) is not MERGED - // Threads mapped to the same slot must have the same size - dim_kind($lhs) is not THREAD || dim_kind($lhs) != dim_kind($rhs) - || "$lhs.size() == $rhs.size()" - -/// Counts the number of thread dimensions. -// TODO(cc_perf): try to rely exclusively on the counter instead of thread slots. - -// FIXME: replace with a late counter -define internal counter num_thread_x($bb in BasicBlocks): - forall $dim in Dimensions: - sum "1" when: - order($dim, $bb) is OUTER - dim_kind($dim) is THREAD_X -end - -// FIXME: replace with a late counter -define internal counter num_thread_y($bb in BasicBlocks): - forall $dim in Dimensions: - sum "1" when: - order($dim, $bb) is OUTER - dim_kind($dim) is THREAD_Y -end - -// FIXME: replace with a late counter -define internal counter num_thread_z($bb in BasicBlocks): - forall $dim in Dimensions: - sum "1" when: - order($dim, $bb) is OUTER - dim_kind($dim) is THREAD_Z -end - -require forall $lhs in Instructions: - forall $rhs in Instructions: - num_thread_x($lhs) <= "0" || num_thread_x($rhs) > "0" - num_thread_y($lhs) <= "0" || num_thread_y($rhs) > "0" - num_thread_z($lhs) <= "0" || num_thread_z($rhs) > "0" /// Specifies the valid mappings between two dimensions. define enum dim_mapping($lhs in Dimensions, $rhs in Dimensions): @@ -273,20 +236,54 @@ define enum dim_mapping($lhs in Dimensions, $rhs in Dimensions): requires dim_kind($lhs) is UNROLL | VECTOR || order($lhs, $rhs) is MERGED /// Values may be transmitted using one register for each thread. value THREAD_MAP: - requires dim_kind($lhs) is THREAD - requires dim_kind($lhs) == dim_kind($rhs) + requires thread_mapping($lhs, $rhs) is MAPPED /// Values are transmitted through registers. alias MAPPED = UNROLL_MAP | THREAD_MAP: requires "$lhs.size() == $rhs.size()" end +/// Indicates how are thread dimensions mapped on the GPU. +define enum thread_mapping($lhs in Dimensions, $rhs in Dimensions): + antisymmetric: + MAPPED_OUT -> MAPPED_IN + /// One of the dimensions is a not thread. + value NOT_THREADS: + requires dim_kind($lhs) is not THREAD || dim_kind($rhs) is not THREAD + /// The two dimensions are threads mapped to the same dimension on the GPU. + value MAPPED: + requires dim_kind($lhs) is THREAD + requires dim_kind($rhs) is THREAD + requires order($lhs, $rhs) is MERGED | ORDERED + requires "$lhs.size() == $rhs.size()" + /// The two dimensions are threads, but `lhs` is mapped to a dimension outside of `rhs`. + value MAPPED_OUT: + requires dim_kind($lhs) is THREAD + requires dim_kind($rhs) is THREAD + requires order($lhs, $rhs) is OUTER | ORDERED + /// The two dimensions are threads, but `lhs` is mapped to a dimension inside of `rhs`. + value MAPPED_IN: + requires dim_kind($lhs) is THREAD + requires dim_kind($rhs) is THREAD + requires order($lhs, $rhs) is INNER | ORDERED +end + +// Enforce coherence between threads activations. +require forall $lhs in Dimensions: + forall $rhs in Dimensions: + forall $other in Dimensions: + thread_mapping($lhs, $rhs) is not MAPPED || + thread_mapping($lhs, $other) == thread_mapping($rhs, $other) + thread_mapping($lhs, $other) is not MAPPED_OUT || + thread_mapping($other, $rhs) is not MAPPED_OUT || + thread_mapping($lhs, $rhs) is MAPPED_OUT + // Thread dimensions are grouped together require forall $outer in Dimensions: forall $inner in Dimensions: forall $mid in Dimensions: order($outer, $mid) is not OUTER || order($mid, $inner) is not OUTER || dim_kind($outer) is not THREAD || dim_kind($inner) is not THREAD - || dim_kind($mid) is THREAD_Y + || dim_kind($mid) is THREAD // A basic block nested with a thread dimension is nested or merged with the other require forall $bb in BasicBlocks: @@ -297,6 +294,23 @@ require forall $bb in BasicBlocks: || dim_kind($other_thread) is not THREAD || order($bb, $other_thread) is not ORDERED +/// Limits the number of threads. +define half counter num_threads(): + forall $dim in Dimensions: + mul "$dim.size().as_int().unwrap_or(1)" when: + is_thread_dim($dim) is TRUE +end + +require num_threads() <= "$fun.device().max_threads()" + +/// Limits the number of thread dimensions. +define half counter num_thread_dims(): + forall $dim in Dimensions: + sum "1" when: is_thread_dim($dim) is TRUE +end + +require num_thread_dims() <= "3" + /// Limits the number of nested unrolled loop. define half counter unroll_factor($inst in Instructions): forall $dim in Dimensions: @@ -313,18 +327,9 @@ define half counter num_block_dims($inst in Instructions): dim_kind($dim) is BLOCK end -/// Limits the number of threads. -define half counter num_threads($inst in Instructions): - forall $dim in Dimensions: - mul "$dim.size().as_int().unwrap_or(1)" when: - is_iteration_dim($inst, $dim) is TRUE - dim_kind($dim) is THREAD -end - require forall $inst in Instructions: unroll_factor($inst) <= "$fun.device().max_unrolling()" num_block_dims($inst) <= "$fun.device().max_block_dims()" - num_threads($inst) <= "$fun.device().max_threads()" /// Counts the number on instructions nested in each dimension. define half counter num_nested_inst($dim in Dimensions): diff --git a/src/search_space/mod.rs b/src/search_space/mod.rs index 68d84ae13..fdd263099 100644 --- a/src/search_space/mod.rs +++ b/src/search_space/mod.rs @@ -6,13 +6,11 @@ mod operand; generated_file!(choices); pub use self::choices::{Action, Bool, DimKind, Domain, DomainStore, InstFlag, Order, - MemSpace}; + MemSpace, ThreadMapping}; use self::choices::{apply_action, DomainDiff, init_domain}; use std::sync::Arc; -// FIXME: unrolled loops of size 1 should not be allowed - /// A partially specified implementation. #[derive(Clone)] pub struct SearchSpace<'a> { @@ -97,3 +95,11 @@ fn add_iteration_dim(ir_instance: &mut ir::Function, } new_objs } + +/// Adds a dimension to the list of thread dimensions. +fn add_thread_dim(ir_instance: &mut ir::Function, dim: ir::dim::Id) -> ir::NewObjs { + debug!("set {:?} as a thread dimension", dim); + let mut new_objs = ir::NewObjs::default(); + if ir_instance.add_thread_dim(dim) { new_objs.add_thread_dim(dim); } + new_objs +} diff --git a/telamon-gen/src/print/template/main.rs b/telamon-gen/src/print/template/main.rs index dda919372..f39534c07 100644 --- a/telamon-gen/src/print/template/main.rs +++ b/telamon-gen/src/print/template/main.rs @@ -61,6 +61,7 @@ use super::process_lowering; #[allow(unused_variables, unused_mut)] pub fn init_domain(store: &mut DomainStore, ir_instance: &mut ir::Function) -> Result, ()> { + trace!("called init_domain from file {}", file!()); // Run all the filters once. let ref mut diff = DomainDiff::default(); // Pass an empty diff to propagate and triggers. let mut unused_diff = DomainDiff::default(); diff --git a/telamon-utils/src/vec_set.rs b/telamon-utils/src/vec_set.rs index e917ab82a..fcf3323a6 100644 --- a/telamon-utils/src/vec_set.rs +++ b/telamon-utils/src/vec_set.rs @@ -114,11 +114,14 @@ where T: Ord } /// Inserts an element in the `VecSet`. This operation has a complexity in - /// O(n). - pub fn insert(&mut self, item: T) { + /// O(n). Returns `false` if the item was already present. + pub fn insert(&mut self, item: T) -> bool { match self.data.binary_search(&item) { - Ok(_) => (), - Err(pos) => self.data.insert(pos, item), + Ok(_) => false, + Err(pos) => { + self.data.insert(pos, item); + true + }, } } } diff --git a/tests/common/fake.rs b/tests/common/fake.rs index 443bc23de..bfbeac6e2 100644 --- a/tests/common/fake.rs +++ b/tests/common/fake.rs @@ -69,9 +69,11 @@ impl device::Device for Device { fn thread_rates(&self) -> HwPressure { HwPressure::new(1.0, vec![1.0, 1.0, 1.0]) } - fn block_rates(&self, _: u64) -> HwPressure { HwPressure::new(1.0, vec![1.0, 1.0, 1.0]) } + fn block_rates(&self) -> HwPressure { HwPressure::new(1.0, vec![1.0, 1.0, 1.0]) } - fn total_rates(&self, _: u64) -> HwPressure { HwPressure::new(1.0, vec![1.0, 1.0, 1.0]) } + fn total_rates(&self) -> HwPressure { HwPressure::new(1.0, vec![1.0, 1.0, 1.0]) } + + fn add_block_overhead(&self, _: u64, _: u64, _: &mut HwPressure) { } } /// A fake context. @@ -83,7 +85,9 @@ pub struct Context { impl device::Context for Context { fn device(&self) -> &device::Device { &self.device } - fn evaluate(&self, _: &codegen::Function) -> Result { Ok(1.0) } + fn evaluate(&self, _: &codegen::Function, _: device::EvalMode) -> Result { + Ok(1.0) + } fn benchmark(&self, _: &codegen::Function, num_samples: usize) -> Vec { vec![1.0; num_samples] diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 8365f9f05..beef613f7 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -4,7 +4,7 @@ extern crate env_logger; pub mod fake; -use telamon::device::Context; +use telamon::device::{Context, EvalMode}; use telamon::{explorer, ir, codegen}; use telamon::search_space::SearchSpace; use std::io::sink; @@ -31,7 +31,7 @@ pub fn check_candidates(space: SearchSpace, ctx: &Context, mut check: F) where F: FnMut() { explorer::gen_space(ctx, space, |_| (), |candidate| { let fun = codegen::Function::build(&candidate.space); - ctx.evaluate(&fun).unwrap(); + ctx.evaluate(&fun, EvalMode::FindBest).unwrap(); check(); }); } diff --git a/tests/cuda.rs b/tests/cuda.rs index d72e35943..7294f90df 100644 --- a/tests/cuda.rs +++ b/tests/cuda.rs @@ -455,14 +455,14 @@ fn dim_map_active() { let mut builder = helper::Builder::new(&signature, context.device()); let size_32 = builder.cst_size(32); - let d0 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD_X); - let d1 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD_Y); + let d0 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD); + let d1 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD); let a = builder.mov(&0f32); builder.close_dim(&d0); builder.close_dim(&d1); - let d2 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD_X); - let _d3 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD_Y); + let d2 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD); + let _d3 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD); let d4 = builder.open_dim_ex(size_32.clone(), DimKind::UNROLL); let op = builder.dim_map(a, &[(&d0, &d2), (&d1, &d4)], ir::DimMapScope::Global); builder.mov(&op); @@ -480,14 +480,14 @@ fn test0() { let mut builder = helper::Builder::new(&signature, context.device()); let size_32 = builder.cst_size(32); - let d0 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD_X); + let d0 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD); let d1 = builder.open_dim(size_32.clone()); let i0 = builder.mov(&0f32); builder.close_dim(&d0); builder.close_dim(&d1); - let _d2 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD_X); - let d3 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD_Y); + let _d2 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD); + let d3 = builder.open_dim_ex(size_32.clone(), DimKind::THREAD); let d4 = builder.open_dim_ex(size_32.clone(), DimKind::SEQUENTIAL); let op = builder.dim_map(i0, &[(&d0, &d3), (&d1, &d4)], ir::DimMapScope::Global); let i1 = builder.mov(&op); diff --git a/tests/lib.rs b/tests/lib.rs index 07f5bb93f..8ce3f859c 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -144,7 +144,7 @@ fn block_dims() { assert_eq!(space.domain().get_is_iteration_dim(inst.into(), d2), Bool::TRUE); assert_eq!(space.domain().get_is_iteration_dim(inst.into(), d3), Bool::TRUE); assert_eq!(space.domain().get_dim_kind(d0), - DimKind::LOOP | DimKind::THREAD_X | DimKind::UNROLL); + DimKind::LOOP | DimKind::THREAD | DimKind::UNROLL); assert_eq!(space.domain().get_order(d1.into(), d2.into()), Order::NESTED); assert_eq!(space.domain().get_order(d1.into(), d3.into()), Order::NESTED); assert_eq!(space.domain().get_order(d2.into(), d3.into()), Order::NESTED); diff --git a/tools/bench_perf_model/main.rs b/tools/bench_perf_model/main.rs index 9f0be7679..099778bab 100644 --- a/tools/bench_perf_model/main.rs +++ b/tools/bench_perf_model/main.rs @@ -12,7 +12,7 @@ mod latency; mod memory; mod tests; -use telamon::device::{ArgMap, Context}; +use telamon::device::{self, ArgMap, Context}; use telamon::helper; use telamon::model::bound; use telamon::search_space::Action; @@ -62,7 +62,7 @@ fn run(pattern: &Regex) { let fun = builder.get(); let model_perf = bound(&fun, &context); let dev_fun = telamon::codegen::Function::build(&fun); - let run_perf = unwrap!(context.evaluate(&dev_fun)); + let run_perf = unwrap!(context.evaluate(&dev_fun, device::EvalMode::TestBound)); if let Some(early_model_perf) = early_model_perf { info!("bound: {}", model_perf); diff --git a/tools/cuda_characterize/gen.rs b/tools/cuda_characterize/gen.rs index 9912b94ea..a74061078 100644 --- a/tools/cuda_characterize/gen.rs +++ b/tools/cuda_characterize/gen.rs @@ -7,7 +7,7 @@ use telamon::explorer; use telamon::helper::{AutoOperand, Builder, DimGroup, Reduce}; use telamon::ir; use telamon::ir::Signature; -use telamon::search_space::{DimKind, InstFlag, SearchSpace, Order}; +use telamon::search_space::{Action, DimKind, InstFlag, SearchSpace, ThreadMapping, Order}; use itertools::Itertools; use std; use table::Table; @@ -116,9 +116,11 @@ pub fn init_stride_array<'a>(signature: &'a Signature, device: &'a Device, let byte_stride = stride * 8; let mut builder = Builder::new(signature, device); let size = builder.cst_size(n); - let kind = if n == 1 { DimKind::UNROLL } else { DimKind::LOOP }; - let dim = builder.open_dim_ex(size, kind); - let addr = builder.mad(&dim, &byte_stride, &array); + let (dim, addr) = if n > 1 { + let dim = builder.open_dim_ex(size, DimKind::LOOP); + let addr = builder.mad(&dim, &byte_stride, &array); + (DimGroup::new(vec![dim]), addr) + } else { (DimGroup::default(), builder.mov(&array)) }; let next_addr = builder.mad(&byte_stride, &1i32, &addr); let pattern0 = builder.unknown_access_pattern(mem_id); builder.st_ex(&addr, &next_addr, true, pattern0, InstFlag::MEM_CG); @@ -203,50 +205,45 @@ pub fn parallel_load<'a>(signature: &'a Signature, gpu: &'a Gpu, num_blocks: &st let block_size = builder.param_size(num_blocks); let _ = builder.open_dim_ex(block_size, DimKind::BLOCK); // Initialize the result - let d1_kind = if num_wraps == 1 { DimKind::UNROLL } else { DimKind::THREAD }; - let d1_0 = builder.open_dim_ex(ir::Size::new(num_wraps, vec![], 1), d1_kind); - let wrap_size = builder.cst_size(gpu.wrap_size); - let d2_0 = builder.open_dim_ex(wrap_size, DimKind::THREAD); + let init_size = builder.cst_size(num_wraps * gpu.wrap_size); + let thread_tilling = if num_wraps == 1 { vec![] } else { vec![gpu.wrap_size] }; + let d1_0 = builder.open_tiled_dim(init_size, &thread_tilling); + for d in &d1_0 { builder.action(Action::DimKind(d, DimKind::THREAD)); } + for (x, y) in d1_0.iter().tuple_windows() { builder.order(&x, &y, Order::OUTER); } let init = builder.mov(&0f32); // Sum in the result. let loop_size = builder.param_size(n); let d0 = builder.open_dim_ex(loop_size, DimKind::LOOP); let d1_1 = builder.open_mapped_dim(&d1_0); - let d2_1 = builder.open_mapped_dim(&d2_0); + for (x, y) in d1_1.iter().tuple_windows() { builder.order(&x, &y, Order::OUTER); } let d3 = builder.open_dim_ex(ir::Size::new(n_chained, vec![], 1), DimKind::UNROLL); let d4_0 = builder.open_dim_ex(ir::Size::new(n_unroll, vec![], 1), DimKind::UNROLL); let pattern = builder.unknown_access_pattern(mem_id); - let addr = if stride != 0 { - builder.induction_var(&array, vec![ - (d3, ir::Size::new(n_unroll*num_wraps*gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), - (d4_0, ir::Size::new(num_wraps*gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), - (d1_1[0], ir::Size::new(gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), - (d2_1[0], ir::Size::new(stride*4, vec![], 1)), - ]) - } else { - builder.induction_var(&array, vec![ - (d3, ir::Size::new(n_unroll*num_wraps*gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), - (d4_0, ir::Size::new(num_wraps*gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), - (d1_1[0], ir::Size::new(gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), - ]) + let mut strides = vec![ + (d3, ir::Size::new(n_unroll*num_wraps*gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), + (d4_0, ir::Size::new(num_wraps*gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), + ]; + if stride != 0 { + let i = if num_wraps == 1 { 0 } else { + strides.push((d1_1[0], ir::Size::new(gpu.wrap_size*gpu.l1_cache_line, vec![], 1))); + 1 + }; + strides.push((d1_1[i], ir::Size::new(stride*4, vec![], 1))); }; + let addr = builder.induction_var(&array, strides); let val = builder.ld_ex(ir::Type::F(32), &addr, pattern, InstFlag::MEM_CG); let d4_1 = builder.open_mapped_dim(&d4_0)[0]; let acc = builder.add(&val, &Reduce(init)); builder.close_dim(&DimGroup::new(vec![d0, d3, d4_1])); // Write the result let d1_2 = builder.open_mapped_dim(&d1_1); - let d2_2 = builder.open_mapped_dim(&d2_1); + for (x, y) in d1_2.iter().tuple_windows() { builder.order(&x, &y, Order::OUTER); } let out_pattern = builder.unknown_access_pattern(out_id); builder.st_ex(&out, &acc, true, out_pattern, InstFlag::MEM_CS); - builder.order(&d1_0, &d2_0, Order::OUTER); builder.order(&d1_0, &d0, Order::BEFORE); builder.order(&d0, &d1_1, Order::OUTER); - builder.order(&d1_1, &d2_1, Order::OUTER); - builder.order(&d2_1, &d3, Order::OUTER); builder.order(&d0, &d1_2, Order::BEFORE); - builder.order(&d1_2, &d2_2, Order::OUTER); builder.order(&d3, &d4_0, Order::OUTER); builder.order(&d3, &d4_1, Order::OUTER); builder.order(&d4_0, &d4_1, Order::BEFORE); @@ -263,38 +260,35 @@ pub fn parallel_store<'a>(signature: &'a Signature, gpu: &'a Gpu, num_blocks: &s let mut builder = Builder::new(signature, gpu); let block_size = builder.param_size(num_blocks); let _ = builder.open_dim_ex(block_size, DimKind::BLOCK); - // Initialize the result - let wrap_size = builder.cst_size(gpu.wrap_size); - // Sum in the result. let loop_size = builder.param_size(n); let d0 = builder.open_dim_ex(loop_size, DimKind::LOOP); - let d1_kind = if num_wraps == 1 { DimKind::UNROLL } else { DimKind::THREAD }; - let d1 = builder.open_dim_ex(ir::Size::new(num_wraps, vec![], 1), d1_kind); - let d2 = builder.open_dim_ex(wrap_size, DimKind::THREAD); + + let thread_tilling = if num_wraps == 1 { vec![] } else { vec![gpu.wrap_size] }; + let thread_size = builder.cst_size(num_wraps * gpu.wrap_size); + let d1 = builder.open_tiled_dim(thread_size, &thread_tilling); + for d in &d1 { builder.action(Action::DimKind(d, DimKind::THREAD)); } + for (x, y) in d1.iter().tuple_windows() { builder.order(&x, &y, Order::OUTER); } + let d3 = builder.open_dim_ex(ir::Size::new(n_chained, vec![], 1), DimKind::UNROLL); let d4 = builder.open_dim_ex(ir::Size::new(n_unroll, vec![], 1), DimKind::UNROLL); let pattern = builder.unknown_access_pattern(mem_id); - let d3_incr = n_unroll*num_wraps*gpu.wrap_size*gpu.l1_cache_line; - let addr = if stride != 0 { - builder.induction_var(&array, vec![ - (d3, ir::Size::new(d3_incr, vec![], 1)), - (d4, ir::Size::new(num_wraps*gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), - (d1, ir::Size::new(gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), - (d2, ir::Size::new(stride*4, vec![], 1)), - ]) - } else { - builder.induction_var(&array, vec![ - (d3, ir::Size::new(d3_incr, vec![], 1)), - (d4, ir::Size::new(num_wraps*gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), - (d1, ir::Size::new(gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), - ]) + let mut strides = vec![ + (d3, ir::Size::new(n_unroll*num_wraps*gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), + (d4, ir::Size::new(num_wraps*gpu.wrap_size*gpu.l1_cache_line, vec![], 1)), + ]; + if stride != 0 { + let i = if num_wraps == 1 { 0 } else { + strides.push((d1[0], ir::Size::new(gpu.wrap_size*gpu.l1_cache_line, vec![], 1))); + 1 + }; + strides.push((d1[i], ir::Size::new(stride*4, vec![], 1))); }; + let addr = builder.induction_var(&array, strides); builder.st_ex(&addr, &42f32, true, pattern, InstFlag::MEM_CG); builder.close_dim(&DimGroup::new(vec![d0, d3, d4])); builder.order(&d0, &d1, Order::OUTER); - builder.order(&d1, &d2, Order::OUTER); - builder.order(&d2, &d3, Order::OUTER); + builder.order(&d1, &d3, Order::OUTER); builder.order(&d3, &d4, Order::OUTER); builder.get() @@ -351,6 +345,8 @@ pub fn chain_in_syncthread<'a>(signature: &'a Signature, device: &'a Device, n_i builder.order(&d2, &d4, Order::OUTER); builder.order(&d0, &d1, Order::BEFORE); builder.order(&d1, &d5, Order::BEFORE); + builder.action(Action::ThreadMapping(d0, d3, ThreadMapping::MAPPED)); + builder.action(Action::ThreadMapping(d0, d5, ThreadMapping::MAPPED)); let mut kernel = builder.get(); kernel.domain_mut().set_order(d1.into(), d2.into(), Order::OUTER); @@ -406,8 +402,8 @@ pub fn run(context: &mut Context, space: &SearchSpace, args_range: &[(&str, &[i32])], counters: &PerfCounterSet, result_prefix: &[u64], result: &mut Table ) { - if explorer::choice::list(space).next() != None { - panic!("The benchmark is not completely scheduled!"); + if let Some(choice) = explorer::choice::list(space).next() { + panic!("The benchmark is not completely scheduled: {:?}", choice); } let dev_fun = codegen::Function::build(space); let kernel = Kernel::compile(&dev_fun, context.gpu(), context.executor(), 1); diff --git a/tools/cuda_characterize/gpu.rs b/tools/cuda_characterize/gpu.rs index 9b55fc811..c13484aa1 100644 --- a/tools/cuda_characterize/gpu.rs +++ b/tools/cuda_characterize/gpu.rs @@ -10,7 +10,8 @@ const EMPTY_INST_DESC: InstDesc = InstDesc { alu: 0.0, mem: 0.0, l1_lines_from_l2: 0.0, - l2_lines_from_l2: 0.0, + l2_lines_read: 0.0, + l2_lines_stored: 0.0, sync: 0.0, ram_bw: 0.0, }; @@ -138,7 +139,8 @@ fn smx_rates(gpu: &cuda::Gpu, executor: &Executor) -> InstDesc { (major, minor) => panic!("Unkown compute capability: {}.{}", major, minor) }; let l1_lines_bw = instruction::smx_bandwidth_l1_lines(gpu, executor); - let l2_lines_bw = instruction::smx_bandwidth_l2_lines(gpu, executor); + let l2_lines_read_bw = instruction::smx_read_bandwidth_l2_lines(gpu, executor); + let l2_lines_store_bw = instruction::smx_write_bandwidth_l2_lines(gpu, executor); InstDesc { latency: gpu.smx_clock, issue: f64::from(issue) * gpu.smx_clock, @@ -146,7 +148,8 @@ fn smx_rates(gpu: &cuda::Gpu, executor: &Executor) -> InstDesc { mem: f64::from(mem) * gpu.smx_clock, sync: f64::from(sync) * gpu.smx_clock, l1_lines_from_l2: l1_lines_bw * gpu.smx_clock, - l2_lines_from_l2: l2_lines_bw * gpu.smx_clock, + l2_lines_read: l2_lines_read_bw * gpu.smx_clock, + l2_lines_stored: l2_lines_store_bw * gpu.smx_clock, ram_bw: ram_bandwidth(executor), } } @@ -162,7 +165,8 @@ fn thread_rates(gpu: &cuda::Gpu, smx_rates: &InstDesc) -> InstDesc { mem: smx_rates.mem / wrap_size, sync: smx_rates.sync / wrap_size, l1_lines_from_l2: smx_rates.l1_lines_from_l2, // FIXME: actually smaller - l2_lines_from_l2: smx_rates.l2_lines_from_l2, + l2_lines_read: smx_rates.l2_lines_read, + l2_lines_stored: smx_rates.l2_lines_stored, ram_bw: smx_rates.ram_bw, } } @@ -177,7 +181,8 @@ fn gpu_rates(gpu: &cuda::Gpu, smx_rates: &InstDesc) -> InstDesc { mem: smx_rates.mem * num_smx, sync: smx_rates.sync * num_smx, l1_lines_from_l2: smx_rates.l1_lines_from_l2 * num_smx, - l2_lines_from_l2: smx_rates.l2_lines_from_l2 * num_smx, + l2_lines_read: smx_rates.l2_lines_read * num_smx, + l2_lines_stored: smx_rates.l2_lines_stored * num_smx, ram_bw: smx_rates.ram_bw, } } diff --git a/tools/cuda_characterize/instruction.rs b/tools/cuda_characterize/instruction.rs index fba822364..648d57389 100644 --- a/tools/cuda_characterize/instruction.rs +++ b/tools/cuda_characterize/instruction.rs @@ -263,17 +263,27 @@ pub fn smx_bandwidth_l1_lines(gpu: &Gpu, executor: &Executor) -> f64 { info!("L1 lines SMX bandwidth"); let wraps = gpu.max_threads()/gpu.wrap_size; let strides = (16..33).collect_vec(); - infer_smx_bandwidth(gpu, executor, wraps, &strides) + infer_smx_bandwidth(gpu, executor, wraps, &strides, true) } /// Measures the number of L2 cache lines an SMX can fetch. -pub fn smx_bandwidth_l2_lines(gpu: &Gpu, executor: &Executor) -> f64 { - info!("L2 lines SMX bandwidth"); +pub fn smx_read_bandwidth_l2_lines(gpu: &Gpu, executor: &Executor) -> f64 { + info!("L2 lines SMX read bandwidth"); let wraps = gpu.max_threads()/gpu.wrap_size; let line_len = gpu.l2_cache_line/4; let strides = (1..line_len+1).collect_vec(); let access_per_wrap = f64::from(gpu.wrap_size/line_len); - infer_smx_bandwidth(gpu, executor, wraps, &strides)*access_per_wrap + infer_smx_bandwidth(gpu, executor, wraps, &strides, true)*access_per_wrap +} + +/// Measures the number of L2 cache lines an SMX can fetch. +pub fn smx_write_bandwidth_l2_lines(gpu: &Gpu, executor: &Executor) -> f64 { + info!("L2 lines SMX write bandwidth"); + let wraps = gpu.max_threads()/gpu.wrap_size; + let line_len = gpu.l2_cache_line/4; + let strides = (1..line_len+1).collect_vec(); + let access_per_wrap = f64::from(gpu.wrap_size/line_len); + infer_smx_bandwidth(gpu, executor, wraps, &strides, false)*access_per_wrap } /*/// Measures the number of L1 cache lines a thread can fetch. @@ -284,16 +294,22 @@ pub fn thread_bandwidth_l1_lines(gpu: &Gpu, executor: &Executor) -> f64 { infer_smx_bandwidth(gpu, executor, 1, &strides) }*/ -pub fn infer_smx_bandwidth(gpu: &Gpu, executor: &Executor, wraps: u32, strides: &[u32]) - -> f64 -{ +pub fn infer_smx_bandwidth(gpu: &Gpu, + executor: &Executor, + wraps: u32, + strides: &[u32], + bench_reads: bool) -> f64 { const N: i32 = 100; const CHAINED: u32 = 8; const UNROLL: u32 = 16; let n_values = [10, N+10]; - let table = smx_bandwidth( - gpu, executor, &[1], &n_values, CHAINED, UNROLL, &[wraps], strides); // Table: wraps, stride, blocks, n, inst, cycles, replays + let table = if bench_reads { + smx_bandwidth(gpu, executor, &[1], &n_values, CHAINED, UNROLL, &[wraps], strides) + } else { + smx_store_bandwidth( + gpu, executor, &[1], &n_values, CHAINED, UNROLL, &[wraps], strides) + }; let cycles = table.column(5) .batching(|it| it.next().map(|n10| it.next().unwrap() - n10)) .map(|cycles| cycles as f64/f64::from(gpu.num_smx)).collect_vec(); @@ -465,7 +481,7 @@ pub fn syncthread(gpu: &Gpu, executor: &Executor) -> InstDesc { /// Computes the overhead of a loop iteration. pub fn loop_iter_overhead(gpu: &Gpu, executor: &Executor) -> InstDesc { const M: u32 = 1024; - let n_range = (10..1000).step_by(10).collect_vec(); + let n_range = (1..100).map(|i| i*10).collect_vec(); // Setup the table. info!("Loop iteration overhead"); let perf_counters = [ @@ -501,7 +517,7 @@ pub fn loop_iter_overhead(gpu: &Gpu, executor: &Executor) -> InstDesc { /// Computes the latency overhead at the end of a loop iteration. pub fn loop_iter_end_latency(gpu: &Gpu, executor: &Executor, add_latency: f64) -> f64 { - let n_range = (100_000..150_000).step_by(100).collect_vec(); + let n_range = (1000..1500).map(|i| i*100).collect_vec(); // Setup the table. info!("Loop iteration end latency"); let perf_counters = [ diff --git a/tools/cuda_characterize/main.rs b/tools/cuda_characterize/main.rs index 2ec9a76c6..eaa772b6c 100644 --- a/tools/cuda_characterize/main.rs +++ b/tools/cuda_characterize/main.rs @@ -1,4 +1,3 @@ -#![feature(iterator_step_by)] extern crate env_logger; extern crate telamon; extern crate getopts; From 74f640a29c6db8a9ada47a8830efc25bca2816e1 Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 18 May 2018 14:45:49 +0200 Subject: [PATCH 57/70] unwrap for generate/file --- build.rs | 2 +- examples/common.rs | 35 ----------------------------------- 2 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 examples/common.rs diff --git a/build.rs b/build.rs index cdd1b4ddd..350c41793 100644 --- a/build.rs +++ b/build.rs @@ -27,7 +27,7 @@ fn main() { add_dependency(exh_file); let exh_out = Path::new(&out_dir).join("choices.rs"); - telamon_gen::process_file(&Path::new(exh_file), &exh_out, cfg!(feature="format_exh")); + telamon_gen::process_file(&Path::new(exh_file), &exh_out, cfg!(feature="format_exh")).unwrap(); if cfg!(feature="cuda") { compile_link_cuda(); } if cfg!(feature = "mppa") { diff --git a/examples/common.rs b/examples/common.rs deleted file mode 100644 index 1336e1bc3..000000000 --- a/examples/common.rs +++ /dev/null @@ -1,35 +0,0 @@ -/// Function shared among examples. -use itertools::Itertools; -use telamon::device::Context; -use telamon::{explorer, ir}; -use telamon::search_space::SearchSpace; -use std; - -/// Generates the code for the best candidate in the search space. -pub fn gen_best<'a>(search_space: Vec, - context: &'a Context, - out: &str) { - let conf = explorer::Config::read(); - let begin_time = std::time::Instant::now(); - let best_opt = explorer::find_best(&conf, context, search_space); - let duration = std::time::Instant::now() - begin_time; - warn!("Search completed in {}s", duration.as_secs()); - match best_opt { - Some(best) => { - let mut file = std::fs::File::create(out).unwrap(); - context.device().gen_code(&best, &mut file) - } - None => println!("Did not find any well suited candidate before timeout"), - } -} - -/// Generate a name for the output file. -pub fn file_name(name: &str, - _: ir::Type, - sizes: &[i32], - instantiated: bool) -> String { - const PATH: &str = "examples/out/"; - std::fs::create_dir_all(PATH).unwrap(); - let sizes = sizes.iter().format_with("", |i, f| f(&format_args!("_{}", i))); - format!("{}{}_{}{}.c", PATH, name, instantiated, sizes) -} From 74f6990bdeb67bcef425ed0314a875776049f32f Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 18 May 2018 14:46:09 +0200 Subject: [PATCH 58/70] move common module into example --- examples/sgemm_low.rs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/examples/sgemm_low.rs b/examples/sgemm_low.rs index 46abecce7..c78e12780 100644 --- a/examples/sgemm_low.rs +++ b/examples/sgemm_low.rs @@ -5,7 +5,36 @@ extern crate itertools; extern crate log; extern crate rayon; -mod common; +mod common { + /// Generates the code for the best candidate in the search space. + pub fn gen_best<'a>(search_space: Vec, + context: &'a Context, + out: &str) { + let conf = explorer::Config::read(); + let begin_time = std::time::Instant::now(); + let best_opt = explorer::find_best(&conf, context, search_space); + let duration = std::time::Instant::now() - begin_time; + warn!("Search completed in {}s", duration.as_secs()); + match best_opt { + Some(best) => { + let mut file = std::fs::File::create(out).unwrap(); + context.device().gen_code(&best, &mut file) + } + None => println!("Did not find any well suited candidate before timeout"), + } + } + + /// Generate a name for the output file. + pub fn file_name(name: &str, + _: ir::Type, + sizes: &[i32], + instantiated: bool) -> String { + const PATH: &str = "examples/out/"; + std::fs::create_dir_all(PATH).unwrap(); + let sizes = sizes.iter().format_with("", |i, f| f(&format_args!("_{}", i))); + format!("{}{}_{}{}.c", PATH, name, instantiated, sizes) + } +} #[allow(unused_imports)] use telamon::{explorer, helper, ir}; From f251f3d04e3f3ecde46f37c00dec0da36370eb1a Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 18 May 2018 15:09:58 +0200 Subject: [PATCH 59/70] line number is now set from the lexer constructer --- telamon-gen/src/lexer/mod.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index b0692dc44..52292c8d3 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -58,11 +58,20 @@ impl From> for Lexer { // The function [yylex_init](https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html#index-yylex_005finit) // innitializes the scanner. yylex_init(&scanner); + + // scans len bytes starting at location bytes. + let buffer: YyBufferState = yy_scan_bytes(buffer.as_ptr() as *const _, buffer.len() as _, scanner); + + // Issue [flex/60](https://github.com/westes/flex/issues/60) + // yylineno should be set. + // The function [yyset_lineno](https://westes.github.io/flex/manual/Reentrant-Functions.html#index-yyset_005flineno) + // sets the current line number. + yyset_lineno(0, scanner); Lexer { scanner: scanner, // The function [yy_scan_bytes](https://westes.github.io/flex/manual/Multiple-Input-Buffers.html) // scans len bytes starting at location bytes. - buffer: yy_scan_bytes(buffer.as_ptr() as *const _, buffer.len() as _, scanner), + buffer: buffer, } } } @@ -71,9 +80,6 @@ impl From> for Lexer { impl Drop for Lexer { fn drop(&mut self) { unsafe { - // The function [yyset_lineno](https://westes.github.io/flex/manual/Reentrant-Functions.html#index-yyset_005flineno) - // clears the current line number. - yyset_lineno(0, self.scanner); // The function [yy_delete_buffer](https://westes.github.io/flex/manual/Multiple-Input-Buffers.html) // clears the current contents of a buffer using. yy_delete_buffer(self.buffer, self.scanner); From a56f0b3490828322bea00440df47252b463bff3f Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 18 May 2018 16:48:43 +0200 Subject: [PATCH 60/70] remove unecessary manifest autoexample field --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 01e6f689b..cc8c9cf51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,6 @@ build = "build.rs" name = "telamon" readme = "README.md" version = "0.2.0" -autoexamples = true [[bin]] name = "cuda-characterize" From 127f961e643f1a13654b1259ad8ee83e47ad8f6a Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 18 May 2018 18:04:01 +0200 Subject: [PATCH 61/70] move exh.c into src --- telamon-gen/build.rs | 4 ++-- telamon-gen/{ => src}/exh.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) rename telamon-gen/{ => src}/exh.c (99%) diff --git a/telamon-gen/build.rs b/telamon-gen/build.rs index 0e6ffc5a5..9b8e72ca4 100644 --- a/telamon-gen/build.rs +++ b/telamon-gen/build.rs @@ -16,7 +16,7 @@ fn main() { let bin = env::var("LEX").unwrap_or(String::from("flex")); Command::new(bin) - .arg("-oexh.c") + .arg("-osrc/exh.c") .arg("src/exh.l") .status() .expect("failed to execute Flex's process"); @@ -24,7 +24,7 @@ fn main() { // Compile the lexer . cc::Build::new() - .file("exh.c") + .file("src/exh.c") .include("src") .flag("-Wno-unused-parameter") .flag("-Wno-unused-variable") diff --git a/telamon-gen/exh.c b/telamon-gen/src/exh.c similarity index 99% rename from telamon-gen/exh.c rename to telamon-gen/src/exh.c index 9ed32b880..a6d680fd0 100644 --- a/telamon-gen/exh.c +++ b/telamon-gen/src/exh.c @@ -1,6 +1,6 @@ -#line 2 "exh.c" +#line 2 "src/exh.c" -#line 4 "exh.c" +#line 4 "src/exh.c" #define YY_INT_ALIGNED short int @@ -646,7 +646,7 @@ static yyconst flex_int32_t yy_rule_can_match_eol[71] = } /* Patterns documentation: http://westes.github.io/flex/manual/Patterns.html#Patterns */ -#line 650 "exh.c" +#line 650 "src/exh.c" #define INITIAL 0 #define C_COMMENT 1 @@ -901,7 +901,7 @@ YY_DECL #line 115 "src/exh.l" -#line 905 "exh.c" +#line 905 "src/exh.c" while ( 1 ) /* loops until end-of-file is reached */ { @@ -1329,7 +1329,7 @@ YY_RULE_SETUP #line 194 "src/exh.l" ECHO; YY_BREAK -#line 1333 "exh.c" +#line 1333 "src/exh.c" case YY_END_OF_BUFFER: { From 8015e0ffb36f9bc388bfde34ab35336df9035fc9 Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 18 May 2018 18:05:10 +0200 Subject: [PATCH 62/70] rename Span as Spanned --- telamon-gen/src/lexer/ffi.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index 9a6af0aaa..92d610c7d 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -35,14 +35,14 @@ pub struct Position { /// A F/lex's token with a span. #[derive(Copy, Clone, Debug)] #[repr(C)] -pub struct Span { +pub struct Spanned { pub leg: Position, pub end: Position, /// Spanned data pub data: Y, } -pub type YyExtraType = Span; +pub type YyExtraType = Spanned; #[derive(Copy, Clone, Debug)] #[repr(C)] From c7bed5ddb40d55b1681b3ff5cd0a2bda0e036101 Mon Sep 17 00:00:00 2001 From: adjivas Date: Fri, 18 May 2018 18:25:24 +0200 Subject: [PATCH 63/70] LALRPOP documentation --- telamon-gen/src/lexer/mod.rs | 12 +++++++++--- telamon-gen/src/lexer/token.rs | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index 52292c8d3..bdb51975f 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -1,5 +1,6 @@ -/// Tokens from the textual representation of constraints. - +/// This lexer is a application of +/// [Writing a custom lexer](https://github.com/lalrpop/lalrpop/blob/master/doc/src/lexer_tutorial/index.md)'s +/// documentation. This includes a Spanned definition and a Iterator. mod ffi; mod token; @@ -34,7 +35,10 @@ pub enum LexicalError { UnexpectedToken(Position, Token, Position), } -pub type Spanned = Result<(P, T, P), E>; +/// The alias Spanned is a definition of the stream format. +/// The parser will accept an iterator where each item +/// in the stream has the following structure. +pub type Spanned = Result<(Pos, Tok, Pos), Err>; pub struct Lexer { scanner: YyScan, @@ -90,6 +94,7 @@ impl Drop for Lexer { } } +/// the Lalrpop Iterator is a exh implementation:for lexer. impl Iterator for Lexer { type Item = Spanned; @@ -192,6 +197,7 @@ impl Iterator for Lexer { YyToken::AntiSymmetric => Some(Ok((extra.leg, Token::AntiSymmetric, extra.end))), YyToken::Arrow => Some(Ok((extra.leg, Token::Arrow, extra.end))), YyToken::Divide => Some(Ok((extra.leg, Token::Divide, extra.end))), + // Return None to signal EOF.for a reached end of the string. YyToken::EOF => None, } } diff --git a/telamon-gen/src/lexer/token.rs b/telamon-gen/src/lexer/token.rs index 7d960c097..484e833db 100644 --- a/telamon-gen/src/lexer/token.rs +++ b/telamon-gen/src/lexer/token.rs @@ -1,3 +1,4 @@ +/// Tokens from the textual representation of constraints. use ir; #[derive(Debug, PartialEq)] From d67714b9b54e9db8bb1408e4de1793c6108aa1a2 Mon Sep 17 00:00:00 2001 From: LabElec Date: Sun, 20 May 2018 17:05:14 +0200 Subject: [PATCH 64/70] generated_file as (pub) macro; danielkeep.github.io/tlborm/book/pat-visibility.html --- telamon-gen/src/lib.rs | 2 +- telamon-utils/src/lib.rs | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/telamon-gen/src/lib.rs b/telamon-gen/src/lib.rs index 786322910..192fd98e4 100644 --- a/telamon-gen/src/lib.rs +++ b/telamon-gen/src/lib.rs @@ -20,7 +20,7 @@ mod constraint; mod flat_filter; pub mod ir; pub mod lexer; -pub_generated_file!(parser); +generated_file!(pub parser); mod print; mod truth_table; diff --git a/telamon-utils/src/lib.rs b/telamon-utils/src/lib.rs index 12d217cea..3e1feefa7 100644 --- a/telamon-utils/src/lib.rs +++ b/telamon-utils/src/lib.rs @@ -173,15 +173,10 @@ macro_rules! generated_file { mod $name { include!(concat!(env!("OUT_DIR"), "/", stringify!($name), ".rs")); } - } -} - -/// Pulbic includes a generates file into the current file. -#[macro_export] -macro_rules! pub_generated_file { - ($name:ident) => { + }; + (pub $name:ident) => { #[cfg_attr(feature = "cargo-clippy", allow(clippy))] - pub mod $name { + mod $name { include!(concat!(env!("OUT_DIR"), "/", stringify!($name), ".rs")); } } From 038a01695b7d801b1c4e1b00582b1a5f17fcb908 Mon Sep 17 00:00:00 2001 From: LabElec Date: Sun, 20 May 2018 17:46:34 +0200 Subject: [PATCH 65/70] keyword pub --- telamon-utils/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telamon-utils/src/lib.rs b/telamon-utils/src/lib.rs index 3e1feefa7..6c8f24f2c 100644 --- a/telamon-utils/src/lib.rs +++ b/telamon-utils/src/lib.rs @@ -176,7 +176,7 @@ macro_rules! generated_file { }; (pub $name:ident) => { #[cfg_attr(feature = "cargo-clippy", allow(clippy))] - mod $name { + pub mod $name { include!(concat!(env!("OUT_DIR"), "/", stringify!($name), ".rs")); } } From 9f2438bd9b8c810e668d3a7a9d9a5e37d3a673e6 Mon Sep 17 00:00:00 2001 From: adjivas Date: Tue, 22 May 2018 12:54:18 +0200 Subject: [PATCH 66/70] add the Error trait for LexicalError --- telamon-gen/src/bin/cli_gen.rs | 13 +++++++++++- telamon-gen/src/lexer/ffi.rs | 8 +++++++ telamon-gen/src/lexer/mod.rs | 38 ++++++++++++++++++++++++++++++++-- telamon-gen/src/lexer/token.rs | 2 +- telamon-gen/tests/lexer.rs | 2 +- telamon-gen/tests/parser.rs | 4 ++-- 6 files changed, 60 insertions(+), 7 deletions(-) diff --git a/telamon-gen/src/bin/cli_gen.rs b/telamon-gen/src/bin/cli_gen.rs index 8638f5579..30636e21b 100644 --- a/telamon-gen/src/bin/cli_gen.rs +++ b/telamon-gen/src/bin/cli_gen.rs @@ -1,8 +1,19 @@ /// Tool that generates constraints from stdin to stdout. extern crate telamon_gen; +extern crate lalrpop_util; extern crate env_logger; +use lalrpop_util::ParseError; +use std::process; + fn main() { env_logger::init(); - telamon_gen::process(&mut std::io::stdin(), &mut std::io::stdout(), true).unwrap(); + if let Err(ParseError::User { error }) = telamon_gen::process( + &mut std::io::stdin(), + &mut std::io::stdout(), + true + ) { + eprintln!("{}", error); + process::exit(-1); + } } diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index 92d610c7d..cb0c27fa5 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -2,6 +2,8 @@ use ::libc; use ::ir; +use std::fmt; + /// A [yyscan](https://westes.github.io/flex/manual/About-yyscan_005ft.html) type is the internal /// representation of a [yylex_init](https://westes.github.io/flex/manual/Init-and-Destroy-Functions.html) structure. pub type YyScan = *const libc::c_void; @@ -32,6 +34,12 @@ pub struct Position { pub column: libc::c_uint, } +impl fmt::Display for Position { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "[{}; {}]", self.line, self.column) + } +} + /// A F/lex's token with a span. #[derive(Copy, Clone, Debug)] #[repr(C)] diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index bdb51975f..f06241645 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -5,6 +5,8 @@ mod ffi; mod token; use std::{io,ptr}; +use std::error::Error; +use std::fmt; pub use self::token::Token; @@ -31,10 +33,42 @@ pub use self::ffi::Position; #[derive(Debug, PartialEq)] pub enum LexicalError { - InvalidToken(Position, String, Position), + InvalidToken(Position, Token, Position), UnexpectedToken(Position, Token, Position), } +impl Error for LexicalError { + fn description(&self) -> &str { + match self { + LexicalError::InvalidToken(..) => "invalid token", + LexicalError::UnexpectedToken(..) => "expected expression", + } + } +} + +impl fmt::Display for LexicalError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + LexicalError::UnexpectedToken(leg, tok, end) => { + write!(f, "{}, found '{:?}' between {}:{}", + self.description(), + tok, + leg, + end + ) + }, + LexicalError::InvalidToken(leg, tok, end) => { + write!(f, "{}, found '{:?}' between {}:{}", + self.description(), + tok, + leg, + end + ) + }, + } + } +} + /// The alias Spanned is a definition of the stream format. /// The parser will accept an iterator where each item /// in the stream has the following structure. @@ -114,7 +148,7 @@ impl Iterator for Lexer { CStr::from_ptr(out) .to_str().ok() - .and_then(|s: &str| Some(Err(LexicalError::InvalidToken(extra.leg, s.to_owned(), extra.end)))) + .and_then(|s: &str| Some(Err(LexicalError::InvalidToken(extra.leg, Token::InvalidToken(s.to_owned()), extra.end)))) }, YyToken::ChoiceIdent => { let out = yyget_text(self.scanner); diff --git a/telamon-gen/src/lexer/token.rs b/telamon-gen/src/lexer/token.rs index 484e833db..5da59e5ec 100644 --- a/telamon-gen/src/lexer/token.rs +++ b/telamon-gen/src/lexer/token.rs @@ -3,7 +3,7 @@ use ir; #[derive(Debug, PartialEq)] pub enum Token { - ValueIdent(String), ChoiceIdent(String), Var(String), Doc(String), CmpOp(ir::CmpOp), + InvalidToken(String), ValueIdent(String), ChoiceIdent(String), Var(String), Doc(String), CmpOp(ir::CmpOp), Code(String), CounterKind(ir::CounterKind), Bool(bool), CounterVisibility(ir::CounterVisibility), And, Trigger, When, Alias, Counter, Define, Enum, Equal, Forall, In, Is, Not, Require, diff --git a/telamon-gen/tests/lexer.rs b/telamon-gen/tests/lexer.rs index 341bb88b6..0152a8d9d 100644 --- a/telamon-gen/tests/lexer.rs +++ b/telamon-gen/tests/lexer.rs @@ -9,7 +9,7 @@ fn initial() { assert_eq!(Lexer::from(b"!".to_vec()).collect::>(), vec![ Err(LexicalError::InvalidToken( Position::default(), - String::from("!"), + Token::InvalidToken(String::from("!")), Position { column: 1, ..Default::default() } )), ]); diff --git a/telamon-gen/tests/parser.rs b/telamon-gen/tests/parser.rs index bade8477c..9f9dec99f 100644 --- a/telamon-gen/tests/parser.rs +++ b/telamon-gen/tests/parser.rs @@ -1,7 +1,7 @@ extern crate telamon_gen; extern crate lalrpop_util; -use telamon_gen::lexer::{Lexer, LexicalError, Position}; +use telamon_gen::lexer::{Lexer, Token, LexicalError, Position}; use telamon_gen::parser; use lalrpop_util::ParseError; @@ -12,7 +12,7 @@ fn invalid_token() { ParseError::User { error: LexicalError::InvalidToken( Position::default(), - String::from("!"), + Token::InvalidToken(String::from("!")), Position { column: 1, ..Default::default() } ), } From aaf0a4ddb68afe687250a521941cc5df49010feb Mon Sep 17 00:00:00 2001 From: adjivas Date: Tue, 22 May 2018 14:21:25 +0200 Subject: [PATCH 67/70] process function too returns filename --- telamon-gen/src/bin/cli_gen.rs | 9 ++++++--- telamon-gen/src/lib.rs | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/telamon-gen/src/bin/cli_gen.rs b/telamon-gen/src/bin/cli_gen.rs index 30636e21b..2e564a3ed 100644 --- a/telamon-gen/src/bin/cli_gen.rs +++ b/telamon-gen/src/bin/cli_gen.rs @@ -4,16 +4,19 @@ extern crate lalrpop_util; extern crate env_logger; use lalrpop_util::ParseError; + use std::process; +use std::path::Path; fn main() { env_logger::init(); - if let Err(ParseError::User { error }) = telamon_gen::process( + if let Err((ParseError::User { error }, filename)) = telamon_gen::process( &mut std::io::stdin(), &mut std::io::stdout(), - true + true, + &Path::new("std") ) { - eprintln!("{}", error); + eprintln!("{}: {}", filename, error); process::exit(-1); } } diff --git a/telamon-gen/src/lib.rs b/telamon-gen/src/lib.rs index 192fd98e4..3eb429abe 100644 --- a/telamon-gen/src/lib.rs +++ b/telamon-gen/src/lib.rs @@ -25,7 +25,6 @@ mod print; mod truth_table; use std::{fs, io, path}; -use std::ffi::OsString; use lalrpop_util::ParseError; @@ -51,24 +50,27 @@ fn to_type_name(name: &str) -> String { } /// Process a file and stores the result in an other file. -pub fn process_file(input_path: &path::Path, output_path: &path::Path, - format: bool) -> Result<(), (ParseError, OsString)> { +pub fn process_file<'a>(input_path: &'a path::Path, output_path: &path::Path, + format: bool) -> Result<(), (ParseError, + path::Display<'a>)> { let mut input = fs::File::open(path::Path::new(input_path)).unwrap(); let mut output = fs::File::create(path::Path::new(output_path)).unwrap(); let input_path_str = input_path.to_string_lossy(); info!("compiling {} to {}", input_path_str, output_path.to_string_lossy()); - process(&mut input, &mut output, format) - .map_err(|e| (e, input_path.file_name().unwrap().to_os_string())) + process(&mut input, &mut output, format, input_path) } /// Parses a constraint description file. -pub fn process(input: &mut io::Read, output: &mut T, - format: bool) -> Result<(), ParseError(input: &mut io::Read, output: &mut T, + format: bool, input_path: &'a path::Path) -> Result<(), (ParseError> { + lexer::LexicalError>, + path::Display<'a>)> { // Parse and check the input. let tokens = lexer::Lexer::new(input); - let ast: ast::Ast = parser::parse_ast(tokens)?; + let ast: ast::Ast = parser::parse_ast(tokens).map_err(|e| (e, input_path.display()))?; let (mut ir_desc, constraints) = ast.type_check(); debug!("constraints: {:?}", constraints); // Generate flat filters. From 22ddba397d21c895cf42c1a992f18640068b993c Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 23 May 2018 10:54:36 +0200 Subject: [PATCH 68/70] token derive from clone and lexer has now a struct Span --- telamon-gen/src/lexer/ffi.rs | 14 ++++++++++++++ telamon-gen/src/lexer/token.rs | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index cb0c27fa5..ea5c7e5b6 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -40,6 +40,20 @@ impl fmt::Display for Position { } } +/// A double sequence's row/column position +#[derive(Default, Copy, Clone, Debug, PartialEq)] +#[repr(C)] +pub struct Span { + pub leg: Position, + pub end: Position, +} + +impl fmt::Display for Span { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}:{}", self.leg, self.end) + } +} + /// A F/lex's token with a span. #[derive(Copy, Clone, Debug)] #[repr(C)] diff --git a/telamon-gen/src/lexer/token.rs b/telamon-gen/src/lexer/token.rs index 5da59e5ec..052682255 100644 --- a/telamon-gen/src/lexer/token.rs +++ b/telamon-gen/src/lexer/token.rs @@ -1,7 +1,7 @@ /// Tokens from the textual representation of constraints. use ir; -#[derive(Debug, PartialEq)] +#[derive(Debug, Clone, PartialEq)] pub enum Token { InvalidToken(String), ValueIdent(String), ChoiceIdent(String), Var(String), Doc(String), CmpOp(ir::CmpOp), Code(String), CounterKind(ir::CounterKind), Bool(bool), From 5cb89776c95c64055961a8d988df79aaa817299c Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 23 May 2018 16:06:47 +0200 Subject: [PATCH 69/70] naive test for ProcessError --- telamon-gen/src/bin/cli_gen.rs | 9 ++-- telamon-gen/src/error.rs | 82 ++++++++++++++++++++++++++++++++++ telamon-gen/src/lexer/ffi.rs | 9 ++-- telamon-gen/src/lexer/mod.rs | 11 +---- telamon-gen/src/lexer/token.rs | 8 ++++ telamon-gen/src/lib.rs | 28 ++++++------ telamon-gen/tests/parser.rs | 11 +++++ 7 files changed, 127 insertions(+), 31 deletions(-) create mode 100644 telamon-gen/src/error.rs diff --git a/telamon-gen/src/bin/cli_gen.rs b/telamon-gen/src/bin/cli_gen.rs index 2e564a3ed..8d1eb450c 100644 --- a/telamon-gen/src/bin/cli_gen.rs +++ b/telamon-gen/src/bin/cli_gen.rs @@ -1,22 +1,19 @@ /// Tool that generates constraints from stdin to stdout. extern crate telamon_gen; -extern crate lalrpop_util; extern crate env_logger; -use lalrpop_util::ParseError; - use std::process; use std::path::Path; fn main() { env_logger::init(); - if let Err((ParseError::User { error }, filename)) = telamon_gen::process( + if let Err(process_error) = telamon_gen::process( &mut std::io::stdin(), &mut std::io::stdout(), true, - &Path::new("std") + &Path::new("exh") ) { - eprintln!("{}: {}", filename, error); + eprintln!("error: {}", process_error); process::exit(-1); } } diff --git a/telamon-gen/src/error.rs b/telamon-gen/src/error.rs new file mode 100644 index 000000000..496348b0b --- /dev/null +++ b/telamon-gen/src/error.rs @@ -0,0 +1,82 @@ +use super::lexer; +use super::lalrpop_util::*; + +use std::{path, fmt}; +use std::error::Error; + +#[derive(Debug)] +pub struct ProcessError<'a> { + pub path: path::Display<'a>, + pub span: Option, + cause: ParseError +} + +impl <'a>From<(path::Display<'a>, + ParseError + )> for ProcessError<'a> { + fn from((path, parse): (path::Display<'a>, + ParseError + )) -> Self { + match parse { + ParseError::InvalidToken { location } + => ProcessError { + path: path, + span: Some(lexer::Span { leg: location, ..Default::default() }), + cause: parse, + }, + ParseError::UnrecognizedToken { token: None, .. } + => ProcessError { + path: path, + span: None, + cause: parse, + }, + ParseError::UnrecognizedToken { token: Some((l, .., e)), .. } | + ParseError::ExtraToken { token: (l, .., e) } | + ParseError::User { error: lexer::LexicalError::UnexpectedToken(l, .., e) } | + ParseError::User { error: lexer::LexicalError::InvalidToken(l, .., e) } + => ProcessError { + path: path, + span: Some(lexer::Span { leg: l, end: Some(e) }), + cause: parse, + }, + } + } +} + +impl <'a> fmt::Display for ProcessError<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + ProcessError { path, span, cause: ParseError::UnrecognizedToken { + token: Some((_, ref token, _)), .. }, ..} | + ProcessError { path, span, cause: ParseError::ExtraToken { + token: (_, ref token, _) }, ..} | + ProcessError { path, span, cause: ParseError::User { + error: lexer::LexicalError::UnexpectedToken(_, ref token, _) }, ..} | + ProcessError { path, span, cause: ParseError::User { + error: lexer::LexicalError::InvalidToken(_, ref token, _) }, ..} => { + if let Some(span) = span { + write!(f, "{} at {} -> {}", token, span, path) + } else { + write!(f, "{} -> {}", token, path) + } + }, + _ => Ok(()), + } + } +} + +impl <'a>Error for ProcessError<'a> { + fn description(&self) -> &str { + "Process error" + } + + fn cause(&self) -> Option<&Error> { + Some(&self.cause) + } +} diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index ea5c7e5b6..bd1ef09d6 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -42,15 +42,18 @@ impl fmt::Display for Position { /// A double sequence's row/column position #[derive(Default, Copy, Clone, Debug, PartialEq)] -#[repr(C)] pub struct Span { pub leg: Position, - pub end: Position, + pub end: Option, } impl fmt::Display for Span { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}:{}", self.leg, self.end) + if let Some(end) = self.end { + write!(f, "{}:{}", self.leg, end) + } else { + write!(f, "{}", self.leg) + } } } diff --git a/telamon-gen/src/lexer/mod.rs b/telamon-gen/src/lexer/mod.rs index f06241645..dad3f89d9 100644 --- a/telamon-gen/src/lexer/mod.rs +++ b/telamon-gen/src/lexer/mod.rs @@ -29,7 +29,7 @@ use self::ffi::{ yyget_extra, }; -pub use self::ffi::Position; +pub use self::ffi::{Position, Span}; #[derive(Debug, PartialEq)] pub enum LexicalError { @@ -49,14 +49,7 @@ impl Error for LexicalError { impl fmt::Display for LexicalError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - LexicalError::UnexpectedToken(leg, tok, end) => { - write!(f, "{}, found '{:?}' between {}:{}", - self.description(), - tok, - leg, - end - ) - }, + LexicalError::UnexpectedToken(leg, tok, end) | LexicalError::InvalidToken(leg, tok, end) => { write!(f, "{}, found '{:?}' between {}:{}", self.description(), diff --git a/telamon-gen/src/lexer/token.rs b/telamon-gen/src/lexer/token.rs index 052682255..9507cf9f6 100644 --- a/telamon-gen/src/lexer/token.rs +++ b/telamon-gen/src/lexer/token.rs @@ -1,6 +1,8 @@ /// Tokens from the textual representation of constraints. use ir; +use std::fmt; + #[derive(Debug, Clone, PartialEq)] pub enum Token { InvalidToken(String), ValueIdent(String), ChoiceIdent(String), Var(String), Doc(String), CmpOp(ir::CmpOp), @@ -11,3 +13,9 @@ pub enum Token { BitOr, Or, SetDefKey(ir::SetDefKey), Set, SubsetOf, SetIdent(String), Base, Disjoint, Quotient, Of, Divide, } + +impl fmt::Display for Token { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{:?}", self) + } +} diff --git a/telamon-gen/src/lib.rs b/telamon-gen/src/lib.rs index 3eb429abe..99fd6f9fb 100644 --- a/telamon-gen/src/lib.rs +++ b/telamon-gen/src/lib.rs @@ -23,11 +23,10 @@ pub mod lexer; generated_file!(pub parser); mod print; mod truth_table; +pub mod error; use std::{fs, io, path}; -use lalrpop_util::ParseError; - use utils::*; /// Converts a choice name to a rust type name. @@ -50,11 +49,11 @@ fn to_type_name(name: &str) -> String { } /// Process a file and stores the result in an other file. -pub fn process_file<'a>(input_path: &'a path::Path, output_path: &path::Path, - format: bool) -> Result<(), (ParseError, - path::Display<'a>)> { +pub fn process_file<'a>( + input_path: &'a path::Path, + output_path: &path::Path, + format: bool +) -> Result<(), error::ProcessError<'a>> { let mut input = fs::File::open(path::Path::new(input_path)).unwrap(); let mut output = fs::File::create(path::Path::new(output_path)).unwrap(); let input_path_str = input_path.to_string_lossy(); @@ -63,14 +62,17 @@ pub fn process_file<'a>(input_path: &'a path::Path, output_path: &path::Path, } /// Parses a constraint description file. -pub fn process<'a, T: io::Write>(input: &mut io::Read, output: &mut T, - format: bool, input_path: &'a path::Path) -> Result<(), (ParseError, - path::Display<'a>)> { +pub fn process<'a, T: io::Write>( + input: &mut io::Read, + output: &mut T, + format: bool, + input_path: &'a path::Path +) -> Result<(), error::ProcessError<'a>> { // Parse and check the input. let tokens = lexer::Lexer::new(input); - let ast: ast::Ast = parser::parse_ast(tokens).map_err(|e| (e, input_path.display()))?; + let ast: ast::Ast = + parser::parse_ast(tokens) + .map_err(|c| error::ProcessError::from((input_path.display(), c)))?; let (mut ir_desc, constraints) = ast.type_check(); debug!("constraints: {:?}", constraints); // Generate flat filters. diff --git a/telamon-gen/tests/parser.rs b/telamon-gen/tests/parser.rs index 9f9dec99f..b6aaa1291 100644 --- a/telamon-gen/tests/parser.rs +++ b/telamon-gen/tests/parser.rs @@ -3,9 +3,12 @@ extern crate lalrpop_util; use telamon_gen::lexer::{Lexer, Token, LexicalError, Position}; use telamon_gen::parser; +use telamon_gen::error; use lalrpop_util::ParseError; +use std::path::Path; + #[test] fn invalid_token() { assert_eq!(parser::parse_ast(Lexer::from(b"!".to_vec())).err(), Some( @@ -17,4 +20,12 @@ fn invalid_token() { ), } )); + + assert_eq!(format!("{}", + parser::parse_ast(Lexer::from(b"!".to_vec())) + .map_err(|c| + error::ProcessError::from( + (Path::new("exh").display(), c))) + .err().unwrap()), + "InvalidToken(\"!\") at [0; 0]:[0; 1] -> exh"); } From 2dd6ea55d9ff948f3fdbbd2591fe7b2e415ef30a Mon Sep 17 00:00:00 2001 From: adjivas Date: Wed, 23 May 2018 16:45:22 +0200 Subject: [PATCH 70/70] change output error and add cause enumeration for ProcessError --- telamon-gen/src/error.rs | 61 ++++++++++++++++++++++++------------ telamon-gen/src/lexer/ffi.rs | 6 ++-- telamon-gen/tests/parser.rs | 2 +- 3 files changed, 45 insertions(+), 24 deletions(-) diff --git a/telamon-gen/src/error.rs b/telamon-gen/src/error.rs index 496348b0b..eda7919ae 100644 --- a/telamon-gen/src/error.rs +++ b/telamon-gen/src/error.rs @@ -4,13 +4,23 @@ use super::lalrpop_util::*; use std::{path, fmt}; use std::error::Error; +#[derive(Debug)] +pub enum Cause { + /// Lalrpop + Parse(ParseError), + /// Will be remplaced by field for Ast [...] + Other, +} + #[derive(Debug)] pub struct ProcessError<'a> { + /// Display of filename. pub path: path::Display<'a>, + /// Position of lexeme. pub span: Option, - cause: ParseError + cause: Cause, } impl <'a>From<(path::Display<'a>, @@ -28,13 +38,13 @@ impl <'a>From<(path::Display<'a>, => ProcessError { path: path, span: Some(lexer::Span { leg: location, ..Default::default() }), - cause: parse, + cause: Cause::Parse(parse), }, ParseError::UnrecognizedToken { token: None, .. } => ProcessError { path: path, span: None, - cause: parse, + cause: Cause::Parse(parse), }, ParseError::UnrecognizedToken { token: Some((l, .., e)), .. } | ParseError::ExtraToken { token: (l, .., e) } | @@ -43,7 +53,7 @@ impl <'a>From<(path::Display<'a>, => ProcessError { path: path, span: Some(lexer::Span { leg: l, end: Some(e) }), - cause: parse, + cause: Cause::Parse(parse), }, } } @@ -52,19 +62,26 @@ impl <'a>From<(path::Display<'a>, impl <'a> fmt::Display for ProcessError<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - ProcessError { path, span, cause: ParseError::UnrecognizedToken { - token: Some((_, ref token, _)), .. }, ..} | - ProcessError { path, span, cause: ParseError::ExtraToken { - token: (_, ref token, _) }, ..} | - ProcessError { path, span, cause: ParseError::User { - error: lexer::LexicalError::UnexpectedToken(_, ref token, _) }, ..} | - ProcessError { path, span, cause: ParseError::User { - error: lexer::LexicalError::InvalidToken(_, ref token, _) }, ..} => { - if let Some(span) = span { - write!(f, "{} at {} -> {}", token, span, path) - } else { - write!(f, "{} -> {}", token, path) - } + ProcessError { path, span, cause: Cause::Parse( + ParseError::UnrecognizedToken { + token: Some((_, ref token, _)), .. + }), ..} | + ProcessError { path, span, cause: Cause::Parse(ParseError::ExtraToken { + token: (_, ref token, _) + }), ..} | + ProcessError { path, span, cause: Cause::Parse( + ParseError::User { + error: lexer::LexicalError::UnexpectedToken(_, ref token, _) + }), ..} | + ProcessError { path, span, cause: Cause::Parse( + ParseError::User { + error: lexer::LexicalError::InvalidToken(_, ref token, _) + }), ..} => { + if let Some(span) = span { + write!(f, "{}, {} -> {}", token, span, path) + } else { + write!(f, "{} -> {}", token, path) + } }, _ => Ok(()), } @@ -77,6 +94,10 @@ impl <'a>Error for ProcessError<'a> { } fn cause(&self) -> Option<&Error> { - Some(&self.cause) + if let Cause::Parse(ref parse) = self.cause { + parse.cause() + } else { + None + } } } diff --git a/telamon-gen/src/lexer/ffi.rs b/telamon-gen/src/lexer/ffi.rs index bd1ef09d6..fa3599e1f 100644 --- a/telamon-gen/src/lexer/ffi.rs +++ b/telamon-gen/src/lexer/ffi.rs @@ -36,7 +36,7 @@ pub struct Position { impl fmt::Display for Position { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "[{}; {}]", self.line, self.column) + write!(f, "line {}, column {}", self.line, self.column) } } @@ -50,9 +50,9 @@ pub struct Span { impl fmt::Display for Span { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if let Some(end) = self.end { - write!(f, "{}:{}", self.leg, end) + write!(f, "between {} and {}", self.leg, end) } else { - write!(f, "{}", self.leg) + write!(f, "at {}", self.leg) } } } diff --git a/telamon-gen/tests/parser.rs b/telamon-gen/tests/parser.rs index b6aaa1291..f200096fa 100644 --- a/telamon-gen/tests/parser.rs +++ b/telamon-gen/tests/parser.rs @@ -27,5 +27,5 @@ fn invalid_token() { error::ProcessError::from( (Path::new("exh").display(), c))) .err().unwrap()), - "InvalidToken(\"!\") at [0; 0]:[0; 1] -> exh"); + "InvalidToken(\"!\"), between line 0, column 0 and line 0, column 1 -> exh"); }