diff --git a/.gitignore b/.gitignore index c1042257..fb102068 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,11 @@ -*.o - morloc -morloc.output -lex.yy.* -*.tab.* -vgcore.* -frontend/morloc tags -tst/ -locout -test.loc -zzz/ - -manifold-nexus.py - -call-* -loc_[0-9]*/ - -*.aux -*.fls -*.log -*.pdf -*.fdb_latexmk - -__pycache__ +Main +*.hi +*.o +.cabal-sandbox/ +cabal.sandbox.config +dist/ +.history +nexus.sh +pool.* diff --git a/.travis.yml b/.travis.yml index 98ab2a64..999bd37b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1 @@ -language: c - -dist: trusty - -script: make && make install && make test +language: haskell diff --git a/CONFIG b/CONFIG new file mode 100644 index 00000000..4e638605 --- /dev/null +++ b/CONFIG @@ -0,0 +1,3 @@ +To install run + +$ cabal install diff --git a/Makefile b/Makefile index 69e45de5..33400a01 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,14 @@ all: - cd frontend && ${MAKE} - -.PHONY: install -install: - mkdir -p ~/.morloc/bin - mkdir -p ~/.morloc/lib - cp frontend/morloc ~/.morloc/bin/morloc - cp -rf backend/core ~/.morloc/lib - test -d ~/bin || mkdir ~/bin - ln -sf ${PWD}/backend/src/morloc/morloc.py ${HOME}/bin/morloc + cabal install --enable-tests .PHONY: test test: - cd tests && ./runtests.sh -K + cabal test + +.PHONY: run +run: + cabal run .PHONY: clean clean: - cd frontend && ${MAKE} clean + rm -f nexus.sh pool.R diff --git a/README.md b/README.md index 265cd29e..98b58a68 100644 --- a/README.md +++ b/README.md @@ -1,336 +1,9 @@ - - +[![Build Status](https://travis-ci.org/arendsee/morloc.svg?branch=haskell)](https://travis-ci.org/arendsee/morloc) -Morloc -====== +Morloc - Haskell rewrite +======================== -Morloc is a typed, language-agnostic, functional workflow language. - -## Installation - -``` -git clone https://github.com/arendsee/morloc -cd morloc -make && make install && make test -``` - -The `make install` command builds the Morloc home (`$HOME/.loc`) where source -code and binaries required for building Morloc projects is located (among other -things). It also links the Morloc executable (`loc`) to `$HOME/bin`, a folder -which is naively assumed to be in `$PATH`. - -To install vim syntax highlighting - -``` -mkdir -p ~/.vim/syntax/ -mkdir -p ~/.vim/ftdetect/ -cp vim-syntax/loc.vim ~/.vim/syntax/ -echo 'au BufRead,BufNewFile *.loc set filetype=loc' > ~/.vim/ftdetect/loc.vim -``` - -## Dependencies - - 1. bison >=3.0.4 - 2. flex - 3. python3 - -Examples -======== - -## Hello World - -![hello-world](docs/images/hello-world.png) - -No executable program can be written in pure Morloc. There are no print -statements, no conditionals, no variables, no functions, no arithmetic -operators. Rather, programs are composed of functions from other languages. -Morloc is a purely metaprogramming language. - -The Hello World example above uses the Bash function `echo`, which is given the -input string "Hello World". - -Morloc scripts are partitioned into sections, each with its own syntax. Only -compositions can be written in the `@path` section. Languages are specified in -the `@lang` section. - -To run a Morloc script: - -``` -$ morloc hello-world.loc -$ ./manifold-nexus.py main -hello world -``` - -The Morloc frontend first compiles the script into an intermediate language (Morloc -Intermediate Language, LIL). The simple language specifies the elements of the -program that will be generated. - -``` -EMIT m0 sh -FUNC m0 echo -INPP m0 0 "hello world" * -``` - -The instruction `EMIT` declares a new "manifold", with id `m0`, that will -contain `sh` (Bash) code. `FUNC` links the function `echo` to `m0` (there may -be multiple manifolds that wrap `echo`, but each will have a unique id). `INPP` -assigns the literal `"hello world"` to the 0th positional argument slot of -`echo`. Ignore the star for now. - -The Morloc backend translates LIL into executable code. It first builds an -executable, named `manifold-nexus.py` by default, that is the interface to the -Morloc program. In this simple hello-world case, it contains the sole command -`main` (much more on this later). - -Next it builds a working directory (by default in `.morloc/tmp`) where generated -code, temporary files, and caches reside. - -For each language used in the Morloc script, a file named `call.` is -created. Each of these files contains a wrapper for each function used in the -Morloc script. - -For this hello-world program, the following (somewhat simplified) `call.sh` -script is generated - -``` bash -#!/usr/bin/env bash - -outdir=$HOME/.morloc/tmp/morloc_0 - -m0 () { - echo "hello world" -} - -manifold_exists() { - type $1 | grep -q function -} - -if manifold_exists $1 - $@ -else - exit 1 -fi -``` - -The `manifold-nexus.py` program passes `m0` to this script when -`./manifold-nexus.py main` is called. It then takes the output of `call.sh m0` -and sends it to the user. - -## Composition - -![composition](docs/images/composition.png) - -The composition in the function above is identical to the shell command: - -``` bash -man ls | grep -Po "[a-z]+ed" | sort | uniq -``` - -Entries in the `@arg` section attach arguments to functions. The composition in -the `@path` section should be as clean and minimal as possible. It should -express the pure and abstract sequence of data transforms at the core of the -analysis. Details, such as parameters, run environments, caching paradigms, -effects, debugging statements, and checking are all implemented in the modifier -sections. So far, I have introduced the `@lang` and `@arg` sections, but there -are many more to come. - -Composition in Morloc is a bit different from conventional composition in, say, -Haskell. The `.` operator passes the elements on the right as the inputs to any -elements of the left that can take inputs. - -This can be a simple chain `h . g . f`. But it can also pass multiple -arguments. For example, in `f . x y z`, the outputs of functions `x`, `y`, and -`z` are passed as the first three positional arguments of `f`. Importantly, it -is not the function `x`, or the manifold that wraps it, that is passed to `f`; -it is the output of `x`. - -Here are the legal elements of composition: - - 1. manifolds - `h . g . f` - 2. constants - `f . 1 "hello"` - 3. literals - ``f . `foo``` - 4. functions - more on this later - -Compositions can also be nested to arbitrary depth - -``` -a . (b . c) (t . r) . z -``` - -The above could be translated into the following conventional function: - -``` -a( b(c(z()))), t(r(z())) ) -``` - -## Random random number generator - -![modifiers](docs/images/modifiers.png) - -The above script samples numbers from a normal distribution where all paramters -are in turn sampled from random distributions. - -This example introduces several new things. - -First of all, I switched to a new language, R. Also I wrote a bit of R source -code (see the `is.positive` function). This code will be passed verbatim to the -`call.R` executable. - -A very important part of any non-trivial pipeline is data validation. This is -handled in Morloc by entries in the `@check` section. Above I attach a function to -the normal sampler that checks whether the standard deviation (which is drawn -N(2,1) distribution) is positive. If it isn't, no output is printed. The checks -not are limited to accessing the inputs of their parents. Rather, they are free -manifolds that can query any manifolds in the program with the sole restriction -that they return a boolean. - -I have also added a cache system, specifying that the outputs of all `rnorm` -and `rbinom` manifolds are stored in memory. I only really need a cache on -`rnorm:sd`, which would otherwise be called twice: once by `rnorm:main` and -once by `is.positive`. - -The string following the `:` (e.g. `rnorm:main`) is a label used to resolve -otherwise indistinguishable manifolds. They are not translated into LIL, since -internally all manifolds get unique ids (e.g. `m0`) and are not referred to by -they abstract names. The syntax `` indicates that a specific -manifold (the `rnorm:sd` implicitly declared in the `@path` section) is to be -called, rather than a new `rnorm:sd`. - -In the argument section, I am now using named arguments. The `=` is a Morloc -operator, it will be translated into the correct language-specific binder by -the frontend. - -The code will be translated into the following LIL (skipping included code): - -``` -NSRC R - - is.positive <- function(x){ all(x > 0) } - -EMIT m0 R -FUNC m0 rnorm -INPM m0 0 m1 * -INPM m0 1 m2 * -INPM m0 2 m3 * -CHEK m0 m4 -CACH m0 memcache -EMIT m1 R -FUNC m1 rbinom -CACH m1 memcache -FARG m1 0 n 1 -FARG m1 1 size 100 -FARG m1 2 prob 0.1 -EMIT m2 R -FUNC m2 rnorm -CACH m2 memcache -FARG m2 0 n 1 -FARG m2 1 mean 0 -FARG m2 2 sd 10 -EMIT m3 R -FUNC m3 rnorm -CACH m3 memcache -FARG m3 0 n 1 -FARG m3 1 mean 2 -FARG m3 2 sd 1 -EMIT m4 R -FUNC m4 is.positive -INPM m4 0 m3 * -``` - -## Hooks and loops - -![hooks](docs/images/hooks.png) - -Morloc has no explicit syntax for any control structures. Instead it relies on -high-order functions defined in the source code. The above example demonstrates -the Morloc equivalent of a `for` loop. The `&(...)` phrase effectively takes -a composition and transforms it into a function that is passed as an argument -to `map`. Arguments passed into this composition are accessed with `$N` calls. -The `map` function is required to be defined in the source language (it is -imported here with `core/control`). - -This script converts the previous random number generator into a function that -is mapped across a sequence of numbers. Note that is uses two language: R and -Bash ('sh'). - -The rather cryptic `@5` and `@1` sections attach arbitrary code (hooks) to -a manifold. - -Below is a template R function with the locations of all 9 possible hooks. - -```R -m1 = function (){ - # @0 e.g. m7() - if(cache_chk("m1")){ - # @8 - b = cache_get("m1") - # @9 - } - else{ - # @2 - if( check() ){ - # @4 - b = fun([input], [arg]) - cache_put("m1", b) - # @5 - } else { - # @6 - b = fail() - cache_put("m1", b) - # @7 - } - # @3 - } - # @1 - return b -} -``` - -If a function is attached to the `@5` slot of a manifold, it will be executed -after the pure function is run but will not be called if a value is taken from -the cache. I use this above to 1) plot the output after the loop and 2) log the -results of each sampling. - -`@1` is always called on exit. In the example above, the line - -``` -@1 -null :: cleanup -``` - -calls the Bash `cleanup` function after the entire program is complete (`null` -is the terminal manifold). - -## Types and ontologies - -![types](docs/images/types.png) - -Morloc currently supports simple types. The syntax is nearly identical to -Haskell, with the addition of two keywords: `?` and `Void`. `?` matches any -number of inputs of any type. `Void` implies no output (if on the right) or -input (if on the left). - -Morloc does not yet support generic types, type constructors, algebraic types and -all that. But it will in the future. - -Types are important for several reasons. - -First, typechecking can catch incorrect connections at compile time. Indeed, -a fully typed workflow can be proven to be correct at a high level, assuming of -course the the user has correctly entered the type (unlike Haskell, Morloc -cannot typecheck "all the way down"). - -Also, the type signatures are a formal documentation succinctly describing the -behaviour of a function. - -In the context of Morloc, however, the greatest value of types is that -a well-desiged type system can transcend language barriers. Two functions with -the same signature can, in theory, be swapped without altering the correctness -of the pipeline (at the type level), regardless of their language. - -Morloc distinguishes between "universal" and "native" forms of data. Calls -between manifolds of the same language, can transfer data using native data -structures, as they would in a conventional program. However, foreign calls -require the data is first transformed to a "universal" form, passed to the -foreign language, and then transformed into the foreign "native" form. Types -direct these transforms. +This is a Haskell refactor of Morloc. The C branch of Morloc is much more +complete (though now unmaintained). Eventually Haskell Morloc will be fully +replace C Morloc, but for now I should redirect you to the `cmorloc` branch. +There you will find a nice README. diff --git a/TODO b/TODO index cce45794..9a66e3c4 100644 --- a/TODO +++ b/TODO @@ -1,81 +1,45 @@ -Immediate goals - [x] add generics - [ ] allow positional arrays in path - [ ] allow functions in arrays - [ ] replace `&` with `\` - [ ] repeal and replace multiple composition - [ ] add positional currying - [ ] disallow single quotes - -Coming goals - [ ] allow data structures for types - [ ] perform Curry implicit typing - [ ] generate linkers to resolve type incompatibilities - [ ] add linkers to backend - [ ] add `U x -> Bool` automatic checking - [ ] add proper `import` sections - - [ ] add typed parameters to function signature - [ ] add typedef - [ ] add algebraic types - [ ] rewrite syntax, no more sections - [ ] formal handling for incomplete compositions - -Distant goals - [ ] add type constructors - [ ] cross-reference existing types against an ontology of types - -Unsolved Problems - [ ] source code scope, each source section should have its own scope, but then - I need a way to link to a specific source. - [ ] import statements, needs to build self-contained Morloc packages - [ ] modularize Morloc - [ ] elevating parameters, adding generalized parameters to the type without - -# Principles - -Add strictness as needed - -Idiomatic code before purity - -# ML reimplementation notes - -I need to cleanly separate the code into modular pieces. First, the lexer -handles all the particulars of the syntax, any syntactic sugar, surface -details. Second, the parser integrates this information into the function graph -and associates the appropriate information with each node. Third, the type -checker navigates the graph, inserting nodes where they are needed, killing the -program if this fails. Fourth, the top level generator builds the manifold -nexus. Fifth, for each namespace create a set of generated scripts: manifold -pools. Sixth, parse the edge types, generating linking code as needed, dying at -compile time when not possible. - -Go back to my toy compilers. Reimplement each, in increasing order of -difficulty, in Haskell. Then implement Mouse in Haskell. Add full typechecking. -Add generics, parameterized types, everything. Formally express the type -checking and inference systems. Integrate the ontology. Add a way to add new -types. Add both import and include statements. Take care to separate the type -system from the grammar. The type system should operate at the function graph -level of abstraction; it should be independent of the particular method used to -build the function graph (e.g. whether I write Old Morloc or in Haskell). - -I should first compile Morloc programs into DOT. A program can be most -reasonably represented as a graph with attributes. This will simplify typing -and also allow me to use all the existing tools for working with and -visualizing graphs. DOT will not replace LIL. The latter is a set of atomic -instructions for building a program. DOT is higher level. I can derive a LIL -file from a DOT file (and vice versa). - -Next I can expand the function graph to include language transitions and -assertions. If a slot of type `M x` connects to an input of type `N x`, I need -to generate two linking functions: `N x -> U x` and `U x -> M x`. Additionally, -I may want to add a runtime type checker, `U x -> Bool`. I should also add an -option to explode every call into a faux foreign call, so every call is -converted to universal and checked at runtime. This might be useful for -debugging. Now, it is important that these generated types be specified and -interwoven in the frontend, prior to generating LIL. This should not be the -backend's problem. - -After all the typing is done, I can generate the manifold nexus and manifold -pools. The backend needs to know how to make `M x -> U x`, `U x -> M x` and -`U x -> Bool`. +This is a staged TODO list. I will work on specifying the language (S) and then +implementing it (I). + +Frontend + S I + [ ] [ ] composition + [ ] [ ] functions + [ ] [ ] primitives + [ ] [ ] data + [ ] [ ] labels + [ ] [ ] parameter setting + [ ] [ ] layer interaction + [ ] [ ] invisible listeners + [ ] [ ] output filters (type a -> a) (e.g. cache) + [ ] [ ] input filters (type a -> a) (e.g. input specific validators) + [ ] [ ] early validators + [ ] [ ] late validators + [ ] [ ] higher order functions + [ ] [ ] edge functions + [ ] [ ] modules + [ ] [ ] include + [ ] [ ] imports + [ ] [ ] documentation + [ ] [ ] node signatures + [ ] [ ] parameter typing + [ ] [ ] specialization + +Backend + S I + [ ] [ ] type checking + [ ] [ ] type inference + [ ] [ ] nexus generation + [ ] [ ] code generation + [ ] [ ] data IO conversion generation + [ ] [ ] command line argument passing + [ ] [ ] help messages + +Environment + S I + [ ] [ ] literate programming support + [ ] [ ] syntax error reporting + [ ] [ ] type error reporting + [ ] [ ] runtime error reporting + [ ] [ ] automatic progress logging + [ ] [ ] graph visualization diff --git a/VERSION b/VERSION deleted file mode 100644 index c91125db..00000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -v0.10.1 diff --git a/backend/core/R/common.loc b/backend/core/R/common.loc deleted file mode 100644 index c188bef2..00000000 --- a/backend/core/R/common.loc +++ /dev/null @@ -1,14 +0,0 @@ -@type -# dunif(x, min = 0, max = 1, log = FALSE) -dunif :: [Num] -> Num -> Num -> [Num] - -# punif(q, min = 0, max = 1, lower.tail = TRUE, log.p = FALSE) -punif :: [Num] -> Num -> Num -> [Num] - -# qunif(p, min = 0, max = 1, lower.tail = TRUE, log.p = FALSE) -qunif :: [Num] -> Num -> Num -> [Num] - -# runif(n, min = 0, max = 1) -runif :: Int -> Num -> Num -> [Num] - -c :: ? -> * diff --git a/backend/core/README.md b/backend/core/README.md deleted file mode 100644 index 56580d01..00000000 --- a/backend/core/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Core Libraries - -This folder contains the source code for the core functions that all supported -languages should define. When Morloc is installed, these libraries will be copied -to the `~/.loc/lib/core` directory. They will usually be included under the -"include" section in Morloc scripts. The frontend will load these files and the -source will be included in the resultant LIL. Therefore, the backends do not -need to interact with these libraries (or know where they are). - -The libraries are all written in Morloc, with native code in the `source` -sections. This allows all typing, documentation, and default argument setting -to be done in the background. diff --git a/backend/core/atomic.loc b/backend/core/atomic.loc deleted file mode 100644 index adc82b39..00000000 --- a/backend/core/atomic.loc +++ /dev/null @@ -1,142 +0,0 @@ -@type -null :: ? -> Void -id :: a -> a -true :: ? -> Bool -false :: ? -> Bool -and :: Bool -> Bool -> Bool -or :: Bool -> Bool -> Bool -not :: Bool -> Bool -any :: ? -> Bool -all :: ? -> Bool -nothing :: Void -> Void - -@alias -null :: morloc_null -id :: morloc_id -true :: morloc_true -false :: morloc_false -and :: morloc_and -or :: morloc_or -not :: morloc_not -any :: morloc_any -all :: morloc_all -nothing :: morloc_nothing - - -@source R - -morloc_null <- function(...) { - list(...) # to force evaluation of inputs - NULL # but return nothing -} - -morloc_id <- function(x) { x } - -morloc_true <- function(...) { TRUE } - -morloc_false <- function(...) { FALSE } - -morloc_and <- function(a, b) { a && b } - -morloc_or <- function(a, b) { a || b } - -morloc_not <- function(a) { ! a } - -morloc_any <- any - -morloc_all <- all - -morloc_nothing <- function() { NULL } - - -@source sh - -morloc_null() { - cat "$1" &> /dev/null || echo "$1" > /dev/null -} - -morloc_id() { - cat "$1" 2> /dev/null || echo "$1" -} - -morloc_true() { - echo true -} - -morloc_false() { - echo false -} - -morloc_and() { - [[ $1 == "true" && $2 == "true" ]] && echo true || echo false -} - -morloc_or() { - [[ $1 == "true" || $2 == "true" ]] && echo true || echo false -} - -morloc_not() { - [[ $1 == "true" ]] && echo false || echo true -} - -morloc_any() { - is_true=0 - for j in "$@" - do - if [[ $j == "true" ]] - then - is_true=1 - break - fi - done - [[ $is_true -eq 1 ]] && echo true || echo false -} - -morloc_all() { - is_true=1 - for j in $@ - do - if [[ $j == "false" ]] - then - is_true=0 - break - fi - done - [[ $is_true -eq 1 ]] && echo true || echo false -} - -morloc_nothing() { - echo -n -} - -@source py - -def morloc_null(*args, **kwargs): - pass - -def morloc_id(x): - return x - -def morloc_true(*args, **kwargs): - return True - -def morloc_false(*args, **kwargs): - return False - -def morloc_and(a, b): - return( bool(a) and bool(b) ) - -def morloc_or(a, b): - return( bool(a) or bool(b) ) - -def morloc_not(a): - return (not a) - -def morloc_all(*args): - return all(args) - -def morloc_any(*args): - return any(args) - -def morloc_nothing(): - pass diff --git a/backend/core/control.loc b/backend/core/control.loc deleted file mode 100644 index 0e79ea39..00000000 --- a/backend/core/control.loc +++ /dev/null @@ -1,93 +0,0 @@ -@type -# The type signature of map SHOULD be: -# map :: (a -> b) -> [a] -> [b] -# However, I don't yet support generics -map :: * -> * -> * -do :: ? -> * # should be: * -> ? -> * - # or better: (? -> a) -> ? -> a - -# if :: Bool -> (a -> b) -> (a -> b) -> a -> b -if :: Bool -> * -> * -> * -> * - -# filter :: (a -> Bool) -> [a] -> [a] -filter :: * -> * -> * - -@alias -map :: morloc_map -do :: morloc_do -if :: morloc_if -filter :: morloc_filter - - -@source R - -morloc_map <- function(f, x){ - lapply(x, f) -} - -morloc_do <- function(FUN, ...){ - FUN(...) -} - -morloc_if <- function(x, f, g, ...){ - if(x){ - f(...) - } else { - g(...) - } -} - -morloc_filter <- Filter - -@source sh - -morloc_map (){ - fun=$1 - file=$2 - while read x - do - $fun $x - done < $file -} - -morloc_do() { - $@ -} - -morloc_if() { - condition=$1 ; shift - a=$1 ; shift - b=$1 ; shift - if [[ $condition == "true" ]] - then - fun=$a - else - fun=$b - fi - shift - shift - shift - $fun $@ -} - -morloc_filter() { - # TODO: a line needn't always represent an element in a list - while read line - do - [[ $($1 $line) == 'true' ]] && echo $line - done < $2 -} - -@source py - -morloc_map = map - -def morloc_do(FUN, *args): - return FUN(*args) - -def morloc_if(x, f, g, *args, **kwargs): - fun = f if x else g - return fun(*args, **kwargs) - -def morloc_filter(f, xs): - return list(filter(f,xs)) diff --git a/backend/core/datcache.loc b/backend/core/datcache.loc deleted file mode 100644 index 63f3936c..00000000 --- a/backend/core/datcache.loc +++ /dev/null @@ -1,115 +0,0 @@ -@type -datcache_chk :: String -> Int -> Bool -datcache_get :: String -> Int -> * -datcache_put :: String -> Int -> * -> Void -datcache_del :: String -> Int -> Void - -@source R - -require(readr) - -datcache_path <- function(mid, uid=NULL, outdir="cache") { - if(is.null(uid)){ - file.path(outdir, paste0(mid, ".rdat")) - } else { - file.path(outdir, paste0(mid, "_", uid, ".rdat")) - } -} - -datcache_chk <- function(mid, uid=NULL, ...) { - file.exists(datcache_path(mid, uid, ...)) -} - -datcache_get <- function(mid, uid=NULL, ...) { - read_rds(datcache_path(mid, uid, ...)) -} - -datcache_put <- function(mid, dat, uid=NULL, ...) { - write_rds(dat, datcache_path(mid, uid, ...)) -} - -datcache_del <- function(mid, uid=NULL, ...) { - file.remove(datcache_path(mid, uid, ...)) -} - - -@source py - -import pickle - -def datcache_path(mid, uid=None, outdir=""): - if uid: - path = os.path.join(outdir, "%s_%s.pickle" % (mid, str(uid))) - else: - path = os.path.join(outdir, "%s.pickle" % mid) - return path - -def datcache_chk(*args, **kwargs): - path = datcache_path(*args, **kwargs) - return os.path.exists(path) - -def datcache_get(*args, **kwargs): - path = datcache_path(*args, **kwargs) - with open(path, 'rb') as f: - dat = pickle.load(f) - return dat - -def datcache_put(mid, dat, **kwargs): - path = datcache_path(mid, **kwargs) - with open(path, 'wb') as f: - pickle.dump(dat, f, pickle.HIGHEST_PROTOCOL) - -def datcache_del(*args, **kwargs): - path = datcache_path(*args, **kwargs) - os.remove(path) - - -@source sh - -cachedir=$outdir/cache -if [[ ! -d $cachedir ]] -then - mkdir $cachedir || echo "Cannot make cache directory" &> /dev/null -fi - -# $1: mid | $2: uid -datcache_chk() { - if [[ -z $2 ]] - then - test -d $cachedir && test -f $cachedir/$1.dat - else - test -d $cachedir && test -f $cachedir/$1_$2.dat - fi -} - -# $1: mid | $2: uid -datcache_get() { - if [[ -z $2 ]] - then - cat $cachedir/$1.dat | more - else - cat $cachedir/$1_$2.dat | more - fi -} - -# $1: mid | $2: tempfile | $3: uid -datcache_put() { - if [[ -z $3 ]] - then - ln $2 $cachedir/$1.dat - else - ln $2 $cachedir/$1_$3.dat - fi -} - -# $1: mid | $2: uid -datcache_del() { - if [[ -z $2 ]] - then - rm $cachedir/$1.dat - else - rm $cachedir/$1_$2.dat - fi -} - - diff --git a/backend/core/io.loc b/backend/core/io.loc deleted file mode 100644 index aef743c7..00000000 --- a/backend/core/io.loc +++ /dev/null @@ -1,75 +0,0 @@ -@type -readable :: File -> Bool -writable :: File -> Bool -executable :: File -> Bool -check_url :: File -> Bool -record :: File -> String -> Void - -@alias -readable :: morloc_readable -writable :: morloc_writable -executable :: morloc_executable -check_url :: morloc_check_url -record :: morloc_record - -@source R -morloc_readable <- function(f){ - file.access(f, mode=4) == 0 -} - -morloc_writable <- function(f){ - file.access(f, mode=2) == 0 -} - -morloc_executable <- function(f){ - file.access(f, mode=1) == 0 -} - -morloc_record <- function(f, x){ - cat(sprintf("%s\n", x), file=f, append=TRUE) -} - -morloc_check_url <- function(f){ - warning("check_url is not implemented in R, use Bash") - NULL -} - -@source sh -morloc_readable (){ - [[ -r $1 ]] && echo "true" || echo "false" -} - -morloc_writable (){ - [[ -w $1 ]] && echo "true" || echo "false" -} - -morloc_executable (){ - [[ -x $1 ]] && echo "true" || echo "false" -} - -morloc_record (){ - echo $2 >> $1 -} - -morloc_check_url (){ - wget --spider -q $1 && echo "true" || echo "false" -} - -@source py -import os - -def morloc_readable(f): - os.access(f, mode=4) - -def morloc_writablefunction(f): - os.access(f, mode=2) - -def morloc_executable(f): - os.access(f, mode=1) - -def morloc_record(f, x): - with open(f, 'a') as fh: - fh.write("%s\n" % x) - -def morloc_check_url(): - raise NotImplemented diff --git a/backend/core/memcache.loc b/backend/core/memcache.loc deleted file mode 100644 index 834c86eb..00000000 --- a/backend/core/memcache.loc +++ /dev/null @@ -1,91 +0,0 @@ -@type -memcache_chk :: String -> Int -> Bool -memcache_get :: String -> Int -> * -memcache_put :: String -> Int -> * -> Void -memcache_del :: String -> Int -> Void - -@alias -memcache_chk :: memcache_chk -memcache_get :: memcache_get -memcache_put :: memcache_put -memcache_del :: memcache_del - -@source R - -.memcache_data <- new.env() - -memcache_chk <- function(mid, uid=NULL) { - if(is.null(uid)){ - exists(mid, .memcache_data, inherits=FALSE) - } else { - exists(mid, .memcache_data, inherits=FALSE) && - exists(as.character(uid), .memcache_data[[mid]], inherits=FALSE) - } -} - -memcache_get <- function(mid, uid=NULL) { - if(is.null(uid)){ - .memcache_data[[mid]] - } else { - .memcache_data[[mid]][[as.character(uid)]] - } -} - -memcache_put <- function(mid, dat, uid=NULL) { - if(is.null(uid)){ - .memcache_data[[mid]] = dat - } else { - if(!exists(mid, .memcache_data, inherits=FALSE)){ - .memcache_data[[mid]] = new.env() - } - .memcache_data[[mid]][[as.character(uid)]] = dat - } -} - -memcache_del <- function(mid, uid=NULL) { - if(is.null(uid)){ - rm(mid, envir=.memcache_data) - } else { - rm(list=as.character(uid), envir=.memcache_data[[mid]]) - } -} - - -@source py - -memcache_data = {} - -# datcache_chk :: String -> Int -> Bool -def memcache_chk(mid, uid=None): - if uid: - try: - memcache_data[mid][uid] - except: - return False - else: - try: - memcache_data[mid] - except: - return False - return True - -# datcache_get :: String -> Int -> * -def memcache_get(mid, uid=None): - if uid: - return memcache_data[mid][uid] - else: - return memcache_data[mid] - -# datcache_put :: String -> Int -> * -> NULL -def memcache_put(mid, dat, uid=None): - if uid: - memcache_data[mid][uid] = dat - else: - memcache_data[mid] = dat - -# datcache_del :: String -> Int -> NULL -def memcache_del (mid, uid=None): - if uid: - memcache_data[mid][uid] = None - else: - memcache_data[mid] = None diff --git a/backend/core/sh/common.loc b/backend/core/sh/common.loc deleted file mode 100644 index b3464b43..00000000 --- a/backend/core/sh/common.loc +++ /dev/null @@ -1,22 +0,0 @@ -@type - -echo :: MULTI -> String - -cp :: File -> File -> Void - -mkdir :: File -> Void - -# === problematic types === - -# I am forcing ls to take a single argument -# However, GNU is can take many and can be recursive -# This implies the type -# ls :: [File] -> [[File]] -# But the output is non-standard, it would require some parsing. -ls :: File -> [File] - -cat :: File -> Text -# cat :: [File] -> Text - -@arg -ls :: -1 # this forces 1 file per line diff --git a/backend/core/table.loc b/backend/core/table.loc deleted file mode 100644 index f8a90edd..00000000 --- a/backend/core/table.loc +++ /dev/null @@ -1,71 +0,0 @@ -@type -nthcol :: Int -> Table -> * -read_table :: File -> Table -write_table :: Table -> File -> Void -merge :: Int -> Int -> Table -> Table -> Table - -@alias -nthcol :: morloc_nthcol -read_table :: morloc_read_table -merge :: morloc_merge - -@source sh -morloc_nthcol (){ - cut -f $1 $2 -} - -morloc_read_table (){ - cat $1 -} - -morloc_write_table (){ - cat $1 -} - -morloc_merge () { - join -1 $1 -2 $2 -t $'\t' <( sort $3 ) <( sort $4 ) -} - -@source R -morloc_nthcol <- function(i, x){ - x[[i]] -} - -morloc_read_table <- function(f){ - read.table( - f, - header=FALSE, - sep="\t", - quote="", - stringsAsFactors=FALSE - ) -} - -morloc_write_table <- function( - x, f, - sep="\t", - quote="", - col.names=TRUE, - row.names=FALSE, - stringsAsFactors=FALSE, - ... -){ - write.table(x, file=f, ...) -} - -# morloc_merge <- function(x, y, by.x, by.y) { -# merge(x, y, by.x=names(x)[by.x], by.y=names(y)[by.y]) -# } - -@source py -def morloc_nthcol(i, x): - return [r[i-1] for r in x] - -def morloc_read_table(filename): - raise NotImplemented - -def morloc_write_table(filename): - raise NotImplemented - -def morloc_merge(x, y, x_ind, y_ind): - raise NotImplemented diff --git a/backend/src/README.md b/backend/src/README.md deleted file mode 100644 index 8c1b9347..00000000 --- a/backend/src/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Backend - -Herein lies the Python LIL interpreter that generates exectuble code from LIL. diff --git a/backend/src/docs/README.md b/backend/src/docs/README.md deleted file mode 100644 index 619e240a..00000000 --- a/backend/src/docs/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# A collection of notes - -The code in this folder is only for illustrative purposes. Examples of -manifolds in different languages can be written here and serve as guides in -writing new grammars. diff --git a/backend/src/docs/bash-principles.md b/backend/src/docs/bash-principles.md deleted file mode 100644 index 8d1fd91f..00000000 --- a/backend/src/docs/bash-principles.md +++ /dev/null @@ -1,61 +0,0 @@ -# Grammar - -A bit out of date, see bash-grammar.m4 - -``` - - -PROLOGUE ---> `' - -MANIFOLD_$1 ------> MANIFOLD($1) - `. - `---> FOREIGN_MANIFOLD($1) - -MANIFOLD(id) ---> $1() { CACHE_$1 RETURN } - -FOREIGN_MANIFOLD(ID) ---> $1(){ CACHE_$1 RETURN } - -RETURN ---> `' - -CACHE_$1 ------> DO_CACHE($1) - `. - `---> NO_CACHE($1) - -DO_CACHE(id) ---> if CACHE_CHK_$1 $1 - then - CACHE_GET_$1 $1 - else - VALIDATE_$1 - fi - -VALIDATE_$1 ------> DO_VALIDATE($1) - `. - `---> NO_VALIDATE($1) - -DO_VALIDATE(id) ---> if CHECK_$1 - then - CORE($1) - else - FAIL_$1$2 - fi - -NO_VALIDATE(id) ---> CORE($1) - -NO_CACHE(id) ---> VALIDATE_$1 - HOOK_$1 - -CORE(id) ---> PASS_$1 FUNC_$1 ARG_$1 INPUT_$1 - EFFECT_$1 - PACK_$1 CACHE_PUT_$1 - -INPUT(id) ---> <($1 OPEN_$1) -----> <($1 | o1) - `. - `--> <($1) - -EPILOGUE ---> if manifold_exists $1 - then - $1 - else - exit 1 - fi -``` diff --git a/backend/src/docs/language-templates/R-manifold.R b/backend/src/docs/language-templates/R-manifold.R deleted file mode 100644 index 644e0262..00000000 --- a/backend/src/docs/language-templates/R-manifold.R +++ /dev/null @@ -1,25 +0,0 @@ -m1 = function (){ - # @0 e.g. m7() - if(cache_chk("m1")){ - # @8 - b = cache_get("m1") - # @9 - } - else{ - # @2 - if( [check] ){ - # @4 - b = fun([input], [arg]) - cache_put("m1", b) - # @5 - } else { - # @6 - b = fail() - cache_put("m1", b) - # @7 - } - # @3 - } - # @1 - return b -} diff --git a/backend/src/docs/language-templates/bash-manifold.sh b/backend/src/docs/language-templates/bash-manifold.sh deleted file mode 100644 index 5e2828b9..00000000 --- a/backend/src/docs/language-templates/bash-manifold.sh +++ /dev/null @@ -1,30 +0,0 @@ -m1_tmp=$(gentmp) -m1 (){ - # @0 - if cache_chk "m1" - then - # @8 - cat $(cache_get "m1") - # @9 - else - # @2 - if check1 && check2 - then - # @4 - fun args <(m4) <(m5) > $m1_tmp - # @5 - else - # @6 - fail_output2 > $m1_tmp - # @7 - fi - cache_put "m1" <(cat $m1_tmp) - # @3 - cat $m1_tmp - rm $m1_tmp - fi - # @1 -} - - -# stderr hook diff --git a/backend/src/docs/language-templates/py-manifold.py b/backend/src/docs/language-templates/py-manifold.py deleted file mode 100644 index 8fe35c69..00000000 --- a/backend/src/docs/language-templates/py-manifold.py +++ /dev/null @@ -1,21 +0,0 @@ -def m1(): - # @0 - if(cache_chk("m1")): - # @8 - b = cache_get("m1") - # @9 - else: - # @2 - if( [check] ): - # @4 - b = fun([input], [arg]) - cache_put("m1", b) - # @5 - else: - # @6 - b = fail() - cache_put("m1", b) - # @7 - # @3 - # @1 - return b diff --git a/backend/src/morloc/__init__.py b/backend/src/morloc/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/backend/src/morloc/grammar/R.py b/backend/src/morloc/grammar/R.py deleted file mode 100644 index 4f3ac340..00000000 --- a/backend/src/morloc/grammar/R.py +++ /dev/null @@ -1,202 +0,0 @@ -from grammar.base_grammar import Grammar - -class RGrammar(Grammar): - def __init__( - self, - source, - manifolds, - outdir, - home - ): - self.source = source - self.manifolds = manifolds - self.outdir = outdir - self.home = home - self.TRUE = "TRUE" - self.FALSE = "FALSE" - self.lang = "R" - self.INDENT = 2 - self.SEP = ', ' - self.BIND = '=' - self.AND = ' && ' - self.LIST = 'list({values})' - self.POOL = '''\ -#!/usr/bin/Rscript --vanilla -library(readr) - -outdir <- "{outdir}" - -{type_map} - -{source} - -{manifolds} - -{nat2uni} - -{uni2nat} - -args <- commandArgs(TRUE) -m <- args[1] - -if(exists(m)){{ - cmd = paste0("show_", m) - f <- get(cmd) - d <- do.call(f, as.list(args[-1])) - if(!is.null(d)){{ - result <- tryCatch({{ - write(d, file="") - }}, warning = function(w) {{ - write("null", file="") - }}, error = function(e) {{ - write("null", file="") - }}, finally = {{ - - }} - ) - }} -}} else {{ - quit(status=1) -}}''' - self.TYPE_MAP = '''# skipping type map''' - self.TYPE_MAP_PAIR = " {key}='{type}'" - self.TYPE_ACCESS = '''types["{key}"]''' -# self.CAST_NAT2UNI = '''natural_to_universal({key}, {type})''' -# self.CAST_UNI2NAT = '''universal_to_natural({key}, {type})''' - self.CAST_NAT2UNI = '''{key}''' - self.CAST_UNI2NAT = '''{key}''' - self.NATIVE_MANIFOLD = '''\ -{mid} = function ({marg_uid}){{ -# {comment} -{blk} -}} -''' - self.NATIVE_MANIFOLD_BLK = '''\ -{hook0} -{cache} -{hook1} -return(b)\ -''' - self.SIMPLE_MANIFOLD = '''\ -{mid} = function ({marg_uid}){{ -# {comment} -{blk} -}} -''' - self.SIMPLE_MANIFOLD_BLK = '''\ -{function}({arguments})\ -''' - self.UID_WRAPPER = '''\ -{mid}_uid = 0 -wrap_{mid} <- function(...){{ -{blk} -}} -''' - self.UID_WRAPPER_BLK = '''\ -{mid}_uid <<- {mid}_uid + 1 -{mid} (..., uid={mid}_uid )\ -''' - self.UID = 'uid' - self.MARG_UID = '{marg}, {uid}' - self.WRAPPER_NAME = 'wrap_{mid}' - self.FOREIGN_MANIFOLD = '''\ -{mid} <- function({marg_uid}){{ -# {comment} -{blk} -}} -''' - self.FOREIGN_MANIFOLD_BLK = '''\ -foreign_pool <- file.path(outdir, "call.{foreign_lang}") -fo <- "null" -fo <- tryCatch({{ - system2( - foreign_pool, - args=c({args}), - stdout=TRUE, # capture STDOUT - stderr="" # let STDERR pass - ) - }}, warning = function(w) {{ - "null" - }}, error = function(e) {{ - "null" - }}, finally = {{ - - }} -) - -read_{mid}(fo)\ -''' - self.CACHE = '''\ -if({cache}_chk("{mid}"{uid}{cache_args})){{ -{if_blk} -}} -else{{ -{else_blk} -}} -''' - self.CACHE_IF = '''\ -{hook8} -b <- {cache}_get("{mid}"{uid}{cache_args}) -{hook9} -''' - self.CACHE_ELSE = '''\ -{hook2} -{validate} -{hook3}\ -''' - self.DATCACHE_ARGS = '''outdir=outdir''' - self.DO_VALIDATE = '''\ -if( {checks} ){{ -{if_blk} -}} else {{ -{else_blk} -}} -''' - self.RUN_BLK = '''\ -{hook4} -b <- {function}({arguments}) -{cache_put} -{hook5} -''' - self.RUN_BLK_VOID = '''\ -{hook4} -# force evaluation -b <- {function}({arguments}) -# throw away the result -b <- NULL -{cache_put} -{hook5} -''' - self.FAIL_BLK = '''\ -{hook6} -cat("{msg}\\n", file=stderr()) -b <- {fail} -{cache_put} -{hook7} -''' - self.FAIL_BLK_VOID = '''\ -{hook6} -{fail} -b <- NULL -{cache_put} -{hook7} -''' - self.FAIL = '{fail}({marg_uid})' - self.DEFAULT_FAIL = 'NULL' - self.NO_VALIDATE = '''\ -{hook4} -b = {function}({arguments}) -{cache_put} -{hook5} -''' - self.CACHE_PUT = '''\ -{cache}_put("{mid}", b{other_args}) -''' - self.MARG = 'x{i}' - self.ARGUMENTS = '{inputs}{sep}{fargs}' - self.MANIFOLD_CALL = '{hmid}({marg_uid})' - self.CHECK_CALL = '{hmid}({marg_uid})' - self.HOOK = '''\ -# {comment} -{hmid}({marg_uid})\ -''' diff --git a/backend/src/morloc/grammar/__init__.py b/backend/src/morloc/grammar/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/backend/src/morloc/grammar/base_grammar.py b/backend/src/morloc/grammar/base_grammar.py deleted file mode 100644 index e242cf06..00000000 --- a/backend/src/morloc/grammar/base_grammar.py +++ /dev/null @@ -1,462 +0,0 @@ -from util import err,indent,clean -import sys - -class Grammar: - def __init__( - self, - source, - manifolds, - outdir, - home - ): - self.source = source - self.manifolds = manifolds - self.outdir = outdir - self.home = home - self.lang = None - self.SEP = "" - self.BIND = "" - self.AND = "" - self.POOL = "" - self.TYPE_MAP = "" - self.TYPE_ACCESS = "" - self.CAST_NAT2UNI = "" - self.CAST_UNI2NAT = "" - self.SIMPLE_MANIFOLD = "" - self.SIMPLE_MANIFOLD_BLK = "" - self.NATIVE_MANIFOLD = "" - self.NATIVE_MANIFOLD_BLK = "" - self.FOREIGN_MANIFOLD = "" - self.FOREIGN_MANIFOLD_BLK = "" - self.CACHE = "" - self.CACHE_IF = "" - self.CACHE_ELSE = "" - self.DATCACHE_ARGS = "" - self.DO_VALIDATE = "" - self.NO_VALIDATE = "" - self.RUN_BLK = "" - self.RUN_BLK_VOID = self.RUN_BLK - self.FAIL_BLK = "" - self.FAIL_BLK_VOID = self.FAIL_BLK - self.RETURN = "" - self.ARGUMENTS = "" - self.MANIFOLD_CALL = "" - self.CHECK_CALL = "" - self.HOOK = "" - self.INDENT = None - self.CACHE_PUT = "" - self.MARG = "" - self.LIST = "" - self.FAIL = "" - self.DEFAULT_FAIL = "" - self.UID_WRAPPER = "" - self.UID = "" - self.MARG_UID = "" - self.WRAPPER_NAME = "" - - - def make(self, uni2nat, nat2uni): - - p = self.make_pool() - - # Find the manifolds that require wrappers for adding - # manifold arguments and ids - wrappers = set() - for mid,man in self.manifolds.items(): - for k,n,m,t in man.input: - if k == "f": - wrappers.add(m) - - mtext = [] - for k,v in self.manifolds.items(): - if k in wrappers: - w = self.make_uid_wrapper(v) - mtext.append(w) - if v.lang == self.lang: - if v.cache or v.check or v.hook: - s = self.make_native_manifold(v) - else: - s = self.make_simple_manifold(v) - else: - s = self.make_foreign_manifold(v) - s = clean(s) - mtext.append(s) - - p = p.format( - source = self.source, - type_map = self.make_type_map(), - outdir = self.outdir, - manifolds = '\n\n'.join(mtext), - uni2nat = uni2nat, - nat2uni = nat2uni, - ) - - return p - - def make_pool(self): - return self.POOL - - def make_type_map(self): - types = [] - for k,v in self.manifolds.items(): - pair = self.TYPE_MAP_PAIR.format(key=k, type=v.type) - types.append(pair) - for k,n,m,t in v.input: - if k == "a": - pair = self.TYPE_MAP_PAIR.format(key=("x" + m), type=t) - types.append(pair) - sep = self.SEP + "\n" - return self.TYPE_MAP.format(pairs=sep.join(types)) - - def make_foreign_manifold(self, m): - s = self.FOREIGN_MANIFOLD.format( - mid = m.mid, - comment = self.make_foreign_manifold_comment(m), - marg_uid = self.make_marg_uid(m), - blk = indent(self.make_foreign_manifold_blk(m), n=self.INDENT) - ) - return s - - def make_foreign_manifold_comment(self, m): - return "foreign manifold - type=%s" % m.type - - - def make_foreign_manifold_blk(self, m): - arg_rep = ["'%s'" % m.mid] - for i in range(int(m.narg)): - a = self.MARG.format(i=str(i+1)) - # s = 'native_to_universal({mid}, {temp}, outdir)' - # s = s.format(mid=a, temp=self.TYPE_ACCESS) - # s = s.format(key=a) - # # TODO: can I do this? - s = a - arg_rep.append(s) - if m.narg: - arg_rep.append("uid") - arg_rep = self.SEP.join(arg_rep) - s = self.FOREIGN_MANIFOLD_BLK.format( - mid = m.mid, - args = arg_rep, - marg_uid = self.make_marg_uid(m), - outdir = self.outdir, - foreign_lang = m.lang, - ) - return s - - def make_simple_manifold(self, m): - return self.SIMPLE_MANIFOLD.format( - mid = m.mid, - comment = self.make_simple_manifold_comment(m), - marg_uid = self.make_marg_uid(m), - blk = indent(self.make_simple_manifold_blk(m), n=self.INDENT) - ) - - def make_simple_manifold_comment(self, m): - return "simple manifold - type=%s" % m.type - - def make_simple_manifold_blk(self, m): - return self.SIMPLE_MANIFOLD_BLK.format( - function = m.func, - arguments = self.make_arguments(m) - ) - - def make_native_manifold(self, m): - return self.NATIVE_MANIFOLD.format( - comment = self.make_native_manifold_comment(m), - mid = m.mid, - marg_uid = self.make_marg_uid(m), - blk = indent(self.make_native_manifold_blk(m), n=self.INDENT) - ) - - def make_native_manifold_comment(self, m): - return "native manifold - type=%s" % m.type - - def make_native_manifold_blk(self, m): - return self.NATIVE_MANIFOLD_BLK.format( - hook0 = self.make_hook(m, 0), - cache = self.make_cache(m), - hook1 = self.make_hook(m, 1) - ) - - def make_cache(self, m): - uid = self.make_uid(m) - cargs = self.make_cache_args(m) - if(m.cache): - s = self.CACHE.format( - cache = m.cache, - mid = m.mid, - uid = self.SEP + uid if uid else "", - cache_args = self.SEP + cargs if cargs else "" , - if_blk = indent(self.make_cache_if(m), n=self.INDENT), - else_blk = indent(self.make_cache_else(m), n=self.INDENT) - ) - else: - s = self.make_cache_else(m) - return s - - def make_cache_if(self, m): - uid = self.make_uid(m) - cargs = self.make_cache_args(m) - return self.CACHE_IF.format( - cache = m.cache, - mid = m.mid, - hook8 = self.make_hook(m, 8), - hook9 = self.make_hook(m, 9), - uid = self.SEP + uid if uid else "", - cache_args = self.SEP + cargs if cargs else "" , - ) - - def make_cache_else(self, m): - s = self.CACHE_ELSE.format( - hook2 = self.make_hook(m, 2), - validate = self.make_validate(m), - mid = m.mid, - hook3 = self.make_hook(m, 3) - ) - return s - - def make_cache_put(self, m): - if(m.cache): - uid = self.make_uid(m) - cache_args = self.make_cache_args(m) - other_args = "" - if uid and cache_args: - other_args = self.SEP.join((uid, cache_args)) - else: - other_args = uid + cache_args - if other_args: - other_args = self.SEP + other_args - cache_put = self.CACHE_PUT.format( - cache = m.cache, - mid = m.mid, - other_args = other_args - ) - else: - cache_put = "" - return cache_put - - def make_cache_args(self, m): - if(m.cache == "datcache"): - args = self.make_datcache_args() - else: - args = "" - return args - - def make_datcache_args(self): - return self.DATCACHE_ARGS.format(outdir=self.outdir) - - def make_validate(self, m): - if(m.check): - s = self.make_do_validate(m) - else: - s = self.make_no_validate(m) - return s - - def make_do_validate(self, m): - return self.DO_VALIDATE.format( - checks = self.make_check(m), - if_blk = indent(self.make_do_validate_if(m), n=self.INDENT), - else_blk = indent(self.make_do_validate_else(m), n=self.INDENT) - ) - - def make_do_validate_if(self, m): - if m.type == "Void": - template = self.RUN_BLK_VOID - else: - template = self.RUN_BLK - - return template.format( - mid = m.mid, - hook4 = self.make_hook(m, 4), - hook5 = self.make_hook(m, 5), - function = m.func, - arguments = self.make_arguments(m), - cache_put = self.make_cache_put(m) - ) - - def make_do_validate_else(self, m): - template = self.FAIL_BLK - try: - if m.fail.type == "Void": - template = self.FAIL_BLK_VOID - except AttributeError: - pass - - msg = "WARNING: Check failed on manifold %s (function '%s' in %s)" \ - % (m.mid, m.func, m.lang) - - return template.format( - mid = m.mid, - msg = msg, - hook6 = self.make_hook(m, 6), - hook7 = self.make_hook(m, 7), - fail = self.make_fail(m), - cache_put = self.make_cache_put(m), - ) - - def make_no_validate(self, m): - return self.make_do_validate_if(m) - - def make_return(self, m): - pass - - def make_return_void(self,m): - pass - - def make_check(self, m): - ss = [] - for c in m.check: - ss.append(self.make_check_call(m, c)) - s = self.AND.join(ss) - return s - - def make_check_call(self, m, c): - return self.CHECK_CALL.format( - hmid=c, - marg_uid=self.make_marg_uid(m) - ) - - def make_arguments(self, m): - inputs = self.make_input(m) - fargs = self.make_function_arguments(m) - return self.ARGUMENTS.format( - inputs = inputs, - sep = self.SEP if (inputs and fargs) else "", - fargs = fargs - ) - - def make_input(self, m): - inputs = [] - for k,n,v,t in m.input: - if k == "m": - inputs.append(self.make_input_manifold(m, n, v, t)) - elif k == "f": - inputs.append(self.make_input_function(m, n, v, t)) - elif k == "a": - inputs.append(self.make_input_argument(m, n, v, t)) - elif k == "p": - inputs.append(self.make_input_positional(m, n, v, t)) - else: - err("Unexpected argument type '%s'" % k) - inputs = self.SEP.join(inputs) - return inputs - - def make_input_manifold(self, m, pos, val, typ): - return self.MANIFOLD_CALL.format( - hmid=val, - marg_uid = self.make_marg_uid(m) - ) - - def make_input_function(self, m, pos, val, typ): - return self.WRAPPER_NAME.format(mid=val) - - def make_input_argument(self, m, pos, val, typ): - return self.MARG.format(i=val) - - def make_input_positional(self, m, pos, val, typ): - if typ == "Bool": - if val == "true": - val = self.TRUE - elif val == "false": - val = self.FALSE - else: - msg = "Error: Expected Bool to be either 'true' or 'false' (found '%s')" - err(msg % val) - val = None - return val - - def make_function_arguments(self, m): - fargs = [] - for n,k,vs in m.farg: - if len(vs) > 1: - v = self.make_list(vs) - elif vs: - v = vs[0] - else: - continue - if k: - fargs.append(self.BIND.join((k,v))) - else: - fargs.append(v) - fargs = self.SEP.join(fargs) - return fargs - - def make_hook(self, m, kind): - hooks = [h for h in m.hook if h.kind == kind] - ss = [] - for h in hooks: - ss.append( self.HOOK.format( - comment=self.make_hook_comment(h), - hmid=h.mid, - marg_uid=self.make_marg_uid(m) - ) ) - return '\n'.join(ss) - - def make_hook_comment(self, h): - return "hook, position %s" % str(h.kind) - - def make_marg(self, m, universal=False): - ss = [] - try: - n = int(m.narg) - except TypeError: - err("nargs must be integrel") - for i in range(n): - arg = self.MARG.format(i=str(i+1)) - if universal: - arg = self.make_cast_nat2uni(arg) - ss.append(arg) - margs = self.SEP.join(ss) - return margs - - def make_cast_nat2uni(self, arg): - return self.CAST_NAT2UNI.format( - key=arg, - type=self.make_type_access(arg) - ) - - def make_type_access(self, arg): - return self.TYPE_ACCESS.format(key=arg) - - def make_list(self, xs): - x = self.SEP.join(xs) - x = self.LIST.format(values=x) - return x - - def make_fail(self, m): - if m.fail: - fail = self.FAIL.format( - fail=m.fail, - marg_uid=self.make_marg_uid(m) - ) - else: - fail = self.make_default_fail() - return fail - - def make_default_fail(self): - return self.DEFAULT_FAIL - - def make_uid_wrapper(self, m): - return self.UID_WRAPPER.format( - mid = m.mid, - blk = indent(self.make_uid_wrapper_blk(m), n=self.INDENT) - ) - - def make_uid_wrapper_blk(self, m): - return self.UID_WRAPPER_BLK.format( mid = m.mid ) - - def make_uid(self, m): - if m.narg: - uid = self.UID.format(nth=str(int(m.narg)+1)) - else: - uid = "" - return uid - - def make_marg_uid(self, m, universal=False): - margs = self.make_marg(m, universal) - uid = self.make_uid(m) - if uid: - s = self.MARG_UID.format(marg=margs, uid=uid) - else: - s = margs - return s diff --git a/backend/src/morloc/grammar/py.py b/backend/src/morloc/grammar/py.py deleted file mode 100644 index 086d7975..00000000 --- a/backend/src/morloc/grammar/py.py +++ /dev/null @@ -1,198 +0,0 @@ -from grammar.base_grammar import Grammar - -class PyGrammar(Grammar): - def __init__( - self, - source, - manifolds, - outdir, - home - ): - self.source = source - self.manifolds = manifolds - self.outdir = outdir - self.home = home - self.TRUE = "True" - self.FALSE = "False" - self.lang = "py" - self.INDENT = 4 - self.SEP = ', ' - self.BIND = '=' - self.AND = ' and ' - self.LIST = '[{values}]' - self.POOL = '''\ -#!/usr/bin/env python3 - -import sys -import os -import subprocess -import signal - -outdir = "{outdir}" - -{type_map} - -{source} - -{manifolds} - -{nat2uni} - -{uni2nat} - -if __name__ == '__main__': - signal.signal(signal.SIGPIPE, signal.SIG_DFL) - args = sys.argv - cmd_str = "{{function}}({{args}})" - arg_str = ', '.join(args[2:]) - cmd = cmd_str.format(function="show_" + args[1], args=arg_str) - try: - print(eval(cmd)) - except SyntaxError as e: - print("Syntax error in:\\n%s\\n%s" % (cmd, e), file=sys.stderr) -''' - self.TYPE_MAP = '''# skipping type map''' - self.TYPE_MAP_PAIR = " '{key}' : '{type}'" - self.TYPE_ACCESS = '''output_type[{key}]''' -# self.CAST_NAT2UNI = '''natural_to_universal({key}, {type})''' -# self.CAST_UNI2NAT = '''universal_to_natural({key}, {type})''' - self.CAST_NAT2UNI = '''{key}''' - self.CAST_UNI2NAT = '''{key}''' - self.NATIVE_MANIFOLD = '''\ -def {mid}({marg_uid}): -# {comment} -{blk} -''' - self.NATIVE_MANIFOLD_BLK = '''\ -{hook0} -{cache} -{hook1} -return b\ -''' - self.SIMPLE_MANIFOLD = '''\ -def {mid}({marg_uid}): -# {comment} -{blk} -''' - self.SIMPLE_MANIFOLD_BLK = '''\ -return {function}({arguments})\ -''' - self.UID_WRAPPER = '''\ -{mid}_uid = 0 -def wrap_{mid}(*args, **kwargs): -{blk} -''' - self.UID_WRAPPER_BLK = '''\ -global {mid}_uid -{mid}_uid += 1 -return {mid} (*args, **kwargs, uid={mid}_uid )\ -''' - self.UID = 'uid' - self.MARG_UID = '{marg}, {uid}' - self.WRAPPER_NAME = 'wrap_{mid}' - self.FOREIGN_MANIFOLD = '''\ -def {mid}({marg_uid}): -# {comment} -{blk} -''' - self.FOREIGN_MANIFOLD_BLK = '''\ -foreign_pool = os.path.join(outdir, "call.{foreign_lang}") -out,result = None, None -try: - cmd = [foreign_pool] + [{args}] - cmd = [str(s) for s in cmd] - cmd_str = " ".join(cmd) - result = subprocess.run( - cmd, - stderr=subprocess.PIPE, - stdout=subprocess.PIPE, - encoding='utf-8', - check=True - ) -except subprocess.CalledProcessError as e: - msg = "ERROR: non-zero exist status from call.py::{mid}, cmd='%s'" - print(msg % cmd_str, file=sys.stderr) - print(" %s" % e, file=sys.stderr) -except Exception as e: - msg = "ERROR: unknown error in call.py::{mid}, cmd='%s'" - print(msg % cmd_str, file=sys.stderr) - print(" %s" % e, file=sys.stderr) -try: - out = read_{mid}(result.stdout) -except Exception as e: - msg = "ERROR: read_{mid} failed in call.py::{mid}, cmd='%s'" - print(msg % cmd_str, file=sys.stderr) - print(" %s" % e, file=sys.stderr) -if result: - print(result.stderr, file=sys.stderr, end="") -return out -''' - self.CACHE = '''\ -if {cache}_chk("{mid}"{uid}{cache_args}): -{if_blk} -else: -{else_blk} -''' - self.CACHE_IF = '''\ -{hook8} -b = {cache}_get("{mid}"{uid}{cache_args}) -{hook9}\ -''' - self.CACHE_ELSE = '''\ -{hook2} -{validate} -{hook3}\ -''' - self.DATCACHE_ARGS = '''outdir="{outdir}"''' - self.DO_VALIDATE = '''\ -if {checks}: -{if_blk} -else: -{else_blk} -''' - self.RUN_BLK = '''\ -{hook4} -b = {function}({arguments}) -{cache_put} -{hook5} -''' - self.RUN_BLK_VOID = '''\ -{hook4} -{function}({arguments}) -b = None -{cache_put} -{hook5} -''' - self.FAIL_BLK = '''\ -{hook6} -b = {fail} -{cache_put} -{hook7}\ -''' - self.FAIL_BLK_VOID = '''\ -{hook6} -{fail} -print("{msg}", file=sys.stderr, end="") -b = None -{cache_put} -{hook7}\ -''' - self.FAIL = '{fail}({marg_uid})' - self.DEFAULT_FAIL = 'None' - self.NO_VALIDATE = '''\ -{hook4} -b = {function}({arguments}) -{cache_put} -{hook5} -''' - self.CACHE_PUT = '''\ -{cache}_put("{mid}", b{other_args}) -''' - self.MARG = 'x{i}' - self.ARGUMENTS = '{inputs}{sep}{fargs}' - self.MANIFOLD_CALL = '{hmid}({marg_uid})' - self.CHECK_CALL = '{hmid}({marg_uid})' - self.HOOK = '''\ -# {comment} -{hmid}({marg_uid})\ -''' diff --git a/backend/src/morloc/grammar/sh.py b/backend/src/morloc/grammar/sh.py deleted file mode 100644 index 16f2cdcf..00000000 --- a/backend/src/morloc/grammar/sh.py +++ /dev/null @@ -1,223 +0,0 @@ -from grammar.base_grammar import Grammar - -class ShGrammar(Grammar): - def __init__( - self, - source, - manifolds, - outdir, - home - ): - self.source = source - self.manifolds = manifolds - self.outdir = outdir - self.home = home - self.TRUE = "true" - self.FALSE = "false" - self.lang = "sh" - self.INDENT = 4 - self.SEP = ' ' - self.BIND = ' ' - self.AND = ' && ' - self.LIST = ' {value} ' - self.POOL = '''\ -#!/usr/bin/env bash - -outdir={outdir} - -{type_map} - -{source} - -{manifolds} - -{nat2uni} - -{uni2nat} - -manifold_exists() {{ - type $1 | grep -q function -}} -if manifold_exists $1 -then - fun=show_$1 - shift - $fun $@ -else - exit 1 -fi''' - self.TYPE_MAP = '''# typemap no longer needed''' - self.TYPE_MAP_PAIR = " [{key}]='{type}'" - self.TYPE_ACCESS = '${{typemap[{mid}]}}' - self.CAST_NAT2UNI = 'show_{key} {key}' - self.CAST_UNI2NAT = 'read_{key} {key}' - self.NATIVE_MANIFOLD = '''\ -{mid} () {{ -# {comment} -{blk} -}} -''' - self.NATIVE_MANIFOLD_BLK = '''\ -{hook0} -{cache} -{hook1}\ -''' - self.SIMPLE_MANIFOLD = ''' -{mid} () {{ -# {comment} -{blk} -}} -''' - self.SIMPLE_MANIFOLD_BLK = '''\ -{function} {arguments}\ -''' - self.UID_WRAPPER = '''\ -{mid}_uid=0 -wrap_{mid} () {{ -{blk} -}} -''' - self.UID_WRAPPER_BLK = '''\ -{mid}_uid=$(( {mid}_uid + 1 )) -{mid} $@ ${mid}_uid\ -''' - self.UID = '${nth}' - self.MARG_UID = '{marg} {uid}' - self.WRAPPER_NAME = 'wrap_{mid}' - self.FOREIGN_MANIFOLD = '''\ -{mid} () {{ -# {comment} -{blk} -}} -''' - self.FOREIGN_MANIFOLD_BLK = '''\ -{comment}\ -read_{mid} <($outdir/call.{foreign_lang} {mid}{arg_rep})\ -''' - self.CACHE = '''\ -if {cache}_chk {mid}{uid} -then -{if_blk} -else -{else_blk} -fi -''' - self.CACHE_IF = '''\ -{hook8} -{cache}_get {mid}{uid} -{hook9} -''' - self.CACHE_ELSE = '''\ -{hook2} -{validate} -{hook3} -( cat "$outdir/{mid}_tmp" ; rm "$outdir/{mid}_tmp" )\ -''' - self.DATCACHE_ARGS = "" - self.DO_VALIDATE = '''\ -if [[ {checks} ]] -then -{if_blk} -else -{else_blk} -fi -''' - self.RUN_BLK = '''\ -{hook4} -{function} {arguments} > "$outdir/{mid}_tmp" -{cache_put} -{hook5}\ -''' - self.RUN_BLK_VOID = '''\ -{hook4} -{function} {arguments} > /dev/null -> "$outdir/{mid}_tmp" -{cache_put} -{hook5}\ -''' - self.FAIL_BLK = '''\ -{hook6} -{fail}> "$outdir/{mid}_tmp" -{cache_put} -{hook7}\ -''' - self.FAIL_BLK_VOID = '''\ -{hook6} -{fail} > /dev/null -echo "{msg}" >&2 -> "$outdir/{mid}_tmp" -{cache_put} -{hook7}\ -''' - self.FAIL = '''{fail} {marg_uid} ''' - self.DEFAULT_FAIL = "" - self.NO_VALIDATE = '''\ -{hook4} -{function} {arguments}{wrapper} > "$outdir/{mid}_tmp" -{cache_put} -{hook5}''' - self.CACHE_PUT = '''\ -{cache}_put {mid} "$outdir/{mid}_tmp"{other_args} -''' - self.MARG = '${i}' - self.ARGUMENTS = '{fargs} {inputs}' - self.MANIFOLD_CALL = '{operator}({hmid} {marg_uid})' - self.CHECK_CALL = '$({hmid} {marg_uid}) == "true"' - self.HOOK = '''\ -# {comment} -{hmid} {marg_uid} 1>&2\ -''' - - def make_simple_manifold_blk(self, m): - return self.SIMPLE_MANIFOLD_BLK.format( - function = m.func, - arguments = self.make_arguments(m) - ) - - def make_input_manifold(self, m, pos, val, typ): - if(typ in ("Int", "Num", "String", "File", "Bool")): - op = '$' - else: - op = '<' - return self.MANIFOLD_CALL.format( - hmid=val, - operator=op, - marg_uid = self.make_marg_uid(m) - ) - - def make_do_validate_if(self, m): - if m.type == "Void": - template = self.RUN_BLK_VOID - else: - template = self.RUN_BLK - - return template.format( - mid = m.mid, - hook4 = self.make_hook(m, 4), - hook5 = self.make_hook(m, 5), - function = m.func, - arguments = self.make_arguments(m), - cache_put = self.make_cache_put(m) - ) - - def make_foreign_manifold_blk(self, m): - arg_rep = "" - comment = [] - for i in range(int(m.narg)): - comment.append('# $%s : arg' % str(i+1)) - i_str = str(i+1) - arg_rep += ' "$%s"' % i_str - if m.narg: - i = str(int(m.narg)+1) - comment.append('# $%s : uid' % i) - arg_rep += ' $%s' % i - comment = '\n'.join(comment) - if comment: - comment += '\n' - - return self.FOREIGN_MANIFOLD_BLK.format( - comment=comment, - foreign_lang=m.lang, - mid=m.mid, - arg_rep=arg_rep - ) diff --git a/backend/src/morloc/lil.py b/backend/src/morloc/lil.py deleted file mode 100644 index 0f86bacf..00000000 --- a/backend/src/morloc/lil.py +++ /dev/null @@ -1,121 +0,0 @@ -import os -import re -import subprocess - -import manifold -from util import err - -def add_manifold_line(manifold, row): - cmd = row[0] - try: - if(cmd == "FUNC"): - manifold.func = row[2] - elif(cmd == "FAIL"): - manifold.fail = row[2] - elif(cmd == "CACH"): - manifold.cache = row[2] - elif(cmd == "MDOC"): - manifold.mdoc = row[2] - elif(cmd == "TYPE"): - manifold.type = row[2] - elif(cmd == "NARG"): - manifold.narg = row[2] - # platonic functions of four kinds - elif(cmd == "INPM"): - manifold.add_input('m', row[2], row[3], row[4]) - elif(cmd == "INPP"): - manifold.add_input('p', row[2], row[3], row[4]) - elif(cmd == "INPF"): - manifold.add_input('f', row[2], row[3], row[4]) - elif(cmd == "INPA"): - manifold.add_input('a', row[2], row[3], row[4]) - # other list attributes - elif(cmd == "CHEK"): - manifold.add_check(row[2]) - elif(cmd == "HOOK"): - manifold.add_hook(row[2], row[3]) - elif(cmd == "FARG"): - manifold.add_farg(npos=row[2], key=row[3], value=row[4:]) - except IndexError: - err("Malformed LIL, unexpected number of fields") - -def compile_morloc( - morloc_src, - morloc_path = "~/.morloc/bin/morloc", - flags = [], - valgrind = False, - memtest = False -): - lpath = os.path.expanduser(morloc_path) - - cmds = [] - if valgrind or memtest: - cmds = ['valgrind'] - if memtest: - cmds.append('--leak-check=full') - cmds.append(lpath) - cmds += flags - cmds.append(morloc_src) - - result = subprocess.run( - cmds, - stderr=subprocess.PIPE, - stdout=subprocess.PIPE, - encoding='utf-8' - ) - result.stdout = [s + "\n" for s in result.stdout.strip().split('\n')] - return result - -def typecheck(morloc_src, morloc_path="~/.morloc/bin/morloc"): - return compile_morloc(morloc_src, morloc_path, flags=['-c']) - -def get_src(lil): - src = {} - lang = "" - for l in lil: - if(l[0:4] == "NSRC"): - row = l.rstrip().split('\t') - if len(row) != 2: - err("Misformed LIL: source requires a language") - lang = row[1] - if not lang in src: - src[lang] = [] - elif(len(l) == 0 or l[0] == " "): - try: - src[lang].append(l[4:]) # remove first 4 spaces - except IndexError: - pass # skip whitespace lines preceding source sections - src = {k:''.join(v) for k,v in src.items()} - return src - -def get_exports(lil): - exports = {} - for l in lil: - r = l.strip().split('\t') - if(r[0] == "EXPT"): - try: - exports[r[1]] = r[2] - except IndexError: - exports[r[1]] = r[1] - return exports - - -def get_manifolds(lil): - manifolds = {} - for l in lil: - row = l.strip().split('\t') - if(row[0] == "EMIT"): - manifolds[row[1]] = manifold.Manifold(row[1], row[2]) - - for l in lil: - row = l.strip().split('\t') - try: - mid = row[1] - try: - add_manifold_line(manifolds[mid], row) - except KeyError: - continue # everything is probably fine - except IndexError: - continue # no problem, this is just a source line - - return manifolds diff --git a/backend/src/morloc/manifold.py b/backend/src/morloc/manifold.py deleted file mode 100644 index f961c539..00000000 --- a/backend/src/morloc/manifold.py +++ /dev/null @@ -1,64 +0,0 @@ -from collections import namedtuple - -from util import err - -Input = namedtuple("Input", ["kind", "npos", "value", "type"]) -Farg = namedtuple("Marg", ["npos", "key", "value"]) -Hook = namedtuple("Hook", ["kind", "mid"]) - -class Manifold: - def __init__(self, mid, lang): - self.mid = mid - self.lang = lang - self.func = "" - self.input = [] # [mpfa]:value - self.check = [] - self.hook = [] # pos:mid - self.farg = [] - self.fail = "" - self.cache = "" - self.mdoc = "" - self.type = "*" - self.narg = 0 - - def add_input(self, kind, npos, value, vtype): - try: - self.input.append(Input(kind, int(npos), value, vtype)) - except ValueError: - err("Position must be an integer") - - def add_check(self, value): - try: - self.check.append(value) - except ValueError: - err("Position must be an integer") - - def add_farg(self, npos, key, value): - try: - self.farg.append(Farg(int(npos), key, value)) - except ValueError: - err("Position must be an integer") - - def add_hook(self, kind, mid): - try: - self.hook.append(Hook(int(kind), mid)) - except ValueError: - err("Hook kind must be integer") - - def print(self): - print("{}".format(self.mid)) - print(" {}<{}>:{}".format(self.func, self.type, self.lang)) - if self.cache: - print(" cache:{}".format(self.cache)) - if self.mdoc: - print(" mdoc:{}".format(self.mdoc)) - for r in self.check: - print(" check:{}".format(self.check)) - if self.fail: - print(" fail:{}".format(self.fail)) - for r in self.hook: - print(" hook:{}".format(self.hook)) - for r in sorted(self.input, key=lambda x: x[1]): - print(" input:{}:{}".format(r[0],r[2])) - for r in sorted(self.farg, key=lambda x: x[0]): - print(" arg:{}:[{}]".format(r[1],','.join(r[2]))) diff --git a/backend/src/morloc/mogrifier/R.py b/backend/src/morloc/mogrifier/R.py deleted file mode 100644 index be0c6587..00000000 --- a/backend/src/morloc/mogrifier/R.py +++ /dev/null @@ -1,110 +0,0 @@ -from mogrifier.base_mogrifier import Mogrifier - -uni2nat_top = ''' -require(readr) -''' - -universal_to_atom = { - "Int" : "as.integer({x})", - "Num" : "as.numeric({x})", - "String" : "as.character({x})", - "File" : "as.character({x})", - "Bool" : "switch(x, true=TRUE, false=FALSE, NA)", - "Text" : "read_lines({x})", - "Void" : "NULL" -} - -nat2uni_top = ''' -suppressPackageStartupMessages(library("jsonlite")) - -get_tmpfile <- function(){ - tempfile(pattern="R_", tmpdir=outdir, fileext=".out") -} - -as_file <- function(x){ - f <- get_tmp_file() - write_lines(x, file=f) - f -} -''' - -atom_to_universal = { - "Int" : "{x}", - "Num" : "{x}", - "String" : "{x}", - "File" : "{x}", - "Bool" : "if({x}){{ 'true' }} else {{ 'false' }}", - "Text" : "as_file({x})", - "Void" : "NULL" -} - -universal_to_natural = ''' -read_{{mid}} <- function(x){{{{ - # {comment} - {cast} -}}}} -''' - -natural_to_universal = ''' -show_{{mid}} <- function(...){{{{ - # {comment} - {cast} -}}}} -''' - -class RMogrifier(Mogrifier): - def __init__(self, manifolds): - - super().__init__(manifolds) - - self.manifolds = manifolds - - # key: name of atomic type - # val: a function that maps between universal and native - self.universal_to_atom = universal_to_atom - self.atom_to_universal = atom_to_universal - - self.uni2nat_top = uni2nat_top - self.nat2uni_top = nat2uni_top - - # templates for conversion functions - self.universal_to_natural = universal_to_natural - self.natural_to_universal = natural_to_universal - - def _universal_to_primitive(self, typ): - if typ == "Table": - s = 'read.delim(x, sep="\\t", stringsAsFactors=FALSE)' - else: - s = 'if(length(x) == 0){{ "null" }} else {{ fromJSON(x, simplifyVector=TRUE) }}' - return s - - def _universal_to_tuple(self, typ): - s = 'if(length(x) == 0){{ "null" }} else {{ fromJSON(x, simplifyVector=FALSE) }}' - return s - - def _universal_to_array(self, typ): - s = 'if(length(x) == 0){{ "null" }} else {{ fromJSON(x, simplifyVector=TRUE) }}' - return s - - def _universal_to_wtf(self, typ): - s = 'if(length(x) == 0){{ "null" }} else {{ fromJSON(x, simplifyVector=TRUE) }}' - return s - - def _wtf_to_universal(self, typ): - s = 'toJSON({mid}(...), auto_unbox=TRUE, null="null", na="null")' - return s - - def _primitive_to_universal(self, typ): - if typ == "Table": - s = 'write.table({mid}(...), quote=FALSE, sep="\\t", col.names=FALSE, row.names=FALSE); NULL' - else: - s = 'toJSON({mid}(...), auto_unbox=TRUE, null="null", na="null")' - return s - - def _tuple_to_universal(self, typ): - s = 'toJSON({mid}(...), auto_unbox=TRUE, null="null", na="null")' - return s - - def _array_to_universal(self, typ): - s = 'toJSON({mid}(...), auto_unbox=TRUE, null="null", na="null")' - return s diff --git a/backend/src/morloc/mogrifier/__init__.py b/backend/src/morloc/mogrifier/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/backend/src/morloc/mogrifier/base_mogrifier.py b/backend/src/morloc/mogrifier/base_mogrifier.py deleted file mode 100644 index a8c104d1..00000000 --- a/backend/src/morloc/mogrifier/base_mogrifier.py +++ /dev/null @@ -1,172 +0,0 @@ -from util import err,indent,clean -import sys - -# The PEG grammar parser for parsing types -from arpeggio import * -from arpeggio import RegExMatch as _ - - -# ============================================================================ # -# --- Type parser # -# Reads a Haskell style type definition. It reads a single type, not a type # -# signature. The result is a tuple of form '(, )'. The # -# constructor can currently be any of the following: "atomic", "tuple", # -# "array", or "function". The value can be nested. For example, # -# ("tuple", (("atomic", "Int"), ("array", ("tuple", ("String", "String"))))) # -# which would correspond to # -# (Int, [(String, String)]) # -# This tuple is used to determine which conversion functions should be used in # -# the output code. # -# ============================================================================ # - -def typeIdent(): return _('\*|[A-Za-z0-9_]+|Void') -def typeTuple(): return '(', typeExpr, OneOrMore(',', typeExpr), ')' -def typeArray(): return '[', typeExpr, ']' -def typeFunc(): return '(', typeExpr, OneOrMore('->', typeExpr), ')' -def typeExpr(): return [typeIdent, typeTuple, typeArray, typeFunc] -def typeType(): return typeExpr, EOF - -class typeTypeVisitor(PTNodeVisitor): - - def visit_typeIdent(self, node, children): - return(("atomic", node.value)) - - def visit_typeTuple(self, node, children): - return(("tuple", children)) - - def visit_typeArray(self, node, children): - return(("array", children[0])) - - def visit_typeFunc(self, node, children): - return(("function", children)) - - def visit_typeExpr(self, node, children): - return(children[0]) - - def visit_typeType(self, node, children): - return(children[0]) - - - -class Mogrifier: - def __init__(self, manifolds): - self.manifolds = manifolds - - # key: name of atomic type - # val: a function that maps between universal and native - self.universal_to_atom = dict() - self.atom_to_universal = dict() - - # any code that required for the mogrifier - self.uni2nat_top = "" - self.nat2uni_top = "" - - # templates for conversion functions - self.universal_to_natural = None - self.natural_to_universal = None - - self.parser = ParserPython(typeType) - - def _parse_type(self, otype): - parse_tree = self.parser.parse(otype) - type_tree = visit_parse_tree(parse_tree, typeTypeVisitor()) - return(type_tree) - - def nat2uni(self, tree): - ''' - Generate a JSON file from a native data structure - ''' - - function = None - - if tree[0] == "atomic": - function = self._primitive_to_universal(tree[1]) - elif tree[0] == "tuple": - function = self._tuple_to_universal(tree[1]) - elif tree[0] == "array": - function = self._array_to_universal(tree[1]) - else: - # TODO This implementation is trash - function = self._wtf_to_universal(tree[1]) - print("WARNING: kludge handling of functions (type:%s)" % str(tree[1]), file=sys.stderr) - - return function - - def uni2nat(self, tree): - ''' - Generate a native datastructure from a JSON file - ''' - - function = None - - if tree[0] == "atomic": - function = self._universal_to_primitive(tree[1]) - elif tree[0] == "tuple": - function = self._universal_to_tuple(tree[1]) - elif tree[0] == "array": - function = self._universal_to_array(tree[1]) - else: - print("Constructor '%s' is not supported" % str(tree), file=sys.stderr) - - return function - - def build_uni2nat(self): - ''' - Build a read_* function - ''' - out = [self.uni2nat_top] - for m in self.manifolds.values(): - tree = self._parse_type(m.type) - function = self.uni2nat(tree) - # unpeal first level - comment = "type: %s" % str(tree) - s = self.universal_to_natural.format( - cast=function, - comment=comment - ) - # unpeal second - this allows {mid} to be expanded inside - # the casting function - s = s.format(mid=m.mid) - out.append(s) - return '\n'.join(out) - - def build_nat2uni(self): - ''' - Build a show_* function - ''' - out = [self.nat2uni_top] - for k,m in self.manifolds.items(): - tree = self._parse_type(m.type) - function = self.nat2uni(tree) - comment = "type: %s" % str(tree) - s = self.natural_to_universal.format( - cast=function, - comment=comment - ) - s = s.format(mid=k) - out.append(s) - return '\n'.join(out) - - def _universal_to_primitive(self, typ): - raise NotImplemented - - def _primitive_to_universal(self, typ): - raise NotImplemented - - def _tuple_to_universal(self, typ): - raise NotImplemented - - def _universal_to_tuple(self, typ): - raise NotImplemented - - def _wtf_to_universal(self, typ): - raise NotImplemented - - def _universal_to_wtf(self, typ): - raise NotImplemented - - def _universal_to_array(self, typ): - raise NotImplemented - - def _array_to_universal(self, typ): - raise NotImplemented diff --git a/backend/src/morloc/mogrifier/py.py b/backend/src/morloc/mogrifier/py.py deleted file mode 100644 index ec3f3361..00000000 --- a/backend/src/morloc/mogrifier/py.py +++ /dev/null @@ -1,126 +0,0 @@ -from mogrifier.base_mogrifier import Mogrifier -import sys - -universal_to_atom = { - "String" : "str({x})", - "File" : "str({x})", - "Int" : "int({x})", - "Num" : "float({x})", - "Bool" : "True if x == 'true' else False", - "*" : "str({x})", - "Text" : "read_text({x})", - "Table" : "read_table({x})", - "Void" : "None" -} - -atom_to_universal = { - "String" : "str({x})", - "File" : "str({x})", - "Int" : "str({x})", - "Num" : "str({x})", - "Bool" : "('true' if {x} else 'false')", - "*" : "str({x})", - "Text" : "write_text({x})", - "Table" : "write_table({x})", - "Void" : "None" -} - -uni2nat_top = ''' -import json - -def read_table(xs): - table = [] - for row in xs.rstrip().split("\\n"): - table.append(row.split()) - - n = len(table[0]) - if not all([len(r) for r in table]): - print("Unequal row lengths in table, dying", file=sys.stderr) - - for i in range(n): - trans = int - for r in table: - try: - if float(r[i]) % 1 != 0: - trans = float - except ValueError: - break - else: - for r in table: - r[i] = trans(r[i]) - - return table - -def write_table(x): - return '\\n'.join(['\\t'.join([str(s) for s in line]) for line in x]) -''' - -nat2uni_top = '' - -universal_to_natural = ''' -def read_{{mid}}(x): - # {comment} - {cast} -''' - -natural_to_universal = ''' -def show_{{mid}}(*args): - # {comment} - try: - {cast} - except Exception as e: - print("failure in call.py::show_{{mid}}", file=sys.stderr) - print(" %s" % e, file=sys.stderr) - return None -''' - -class PyMogrifier(Mogrifier): - def __init__(self, manifolds): - - super().__init__(manifolds) - - self.manifolds = manifolds - - # key: name of atomic type - # val: a function that maps between universal and native - self.universal_to_atom = universal_to_atom - self.atom_to_universal = atom_to_universal - - self.uni2nat_top = uni2nat_top - self.nat2uni_top = nat2uni_top - - # templates for conversion functions - self.universal_to_natural = universal_to_natural - self.natural_to_universal = natural_to_universal - - def _universal_to_primitive(self, typ): - if typ == 'Table': - s = 'return read_table(x)' - else: - s = 'return json.loads(x) if x else "null"' - return s - - def _universal_to_tuple(self, typ): - return 'return json.loads(x) if x else "null"' - - def _universal_to_array(self, typ): - return 'return json.loads(x) if x else "null"' - - def _universal_to_wtf(self, typ): - return 'return json.loads(x) if x else "null"' - - def _wtf_to_universal(self, typ): - return 'return json.dumps({mid}(*args))' - - def _primitive_to_universal(self, typ): - if typ == 'Table': - s = 'return write_table({mid}(*args))' - else: - s = 'return json.dumps({mid}(*args))' - return s - - def _tuple_to_universal(self, typ): - return 'return json.dumps(tuple({mid}(*args)))' - - def _array_to_universal(self, typ): - return 'return json.dumps(list({mid}(*args)))' diff --git a/backend/src/morloc/mogrifier/sh.py b/backend/src/morloc/mogrifier/sh.py deleted file mode 100644 index 6bb9bb56..00000000 --- a/backend/src/morloc/mogrifier/sh.py +++ /dev/null @@ -1,111 +0,0 @@ -from mogrifier.base_mogrifier import Mogrifier -import sys - -universal_to_atom = { - "Int" : 'echo "$({x})"', - "Num" : 'echo "$({x})"', - "String" : """{x} | sed 's/^"\|"$//g'""", - "File" : """{x} | sed 's/^"\|"$//g'""", - "Bool" : 'echo "$({x})"', - "Text" : 'cat <({x})', - "Table" : 'cat <({x})', - "Void" : 'cat <({x}) || echo "$({x})"', - "*" : 'cat <({x}) || echo "$({x})"' -} - -atom_to_universal = { - "Int" : 'echo "$({x})"', - "Num" : 'echo "$({x})"', - "String" : '''printf '"%s"' "$({x})"''', - "File" : '''printf '"%s"' "$({x})"''', - "Bool" : 'echo "$({x})"', - "Text" : 'cat <({x})', - "Table" : 'cat <({x})', - "Void" : 'cat <({x}) || echo "$({x})" > /dev/null', - "*" : 'cat <({x}) || echo "$({x})"' -} - -uni2nat_top = '' -nat2uni_top = '' - -universal_to_natural = ''' -read_{{mid}} (){{{{ - # {comment} - {cast} -}}}} -''' - -natural_to_universal = ''' -show_{{mid}} (){{{{ - # {comment} - {cast} -}}}} -''' - -class ShMogrifier(Mogrifier): - def __init__(self, manifolds): - - super().__init__(manifolds) - - # key: name of atomic type - # val: a function that maps between universal and native - self.universal_to_atom = universal_to_atom - self.atom_to_universal = atom_to_universal - - self.uni2nat_top = uni2nat_top - self.nat2uni_top = nat2uni_top - - # templates for conversion functions - self.universal_to_natural = universal_to_natural - self.natural_to_universal = natural_to_universal - - def _universal_to_primitive(self, typ): - if typ == "Void": - return "echo -n" - else: - return self.universal_to_atom[typ].format(x="cat $1") - - def _universal_to_tuple(self, typ): - return "jq -r '@tsv' $1" - - def _wtf_to_universal(self, typ): - return "# WTF, I can't do this" - - def _universal_to_wtf(self, typ): - return "# WTF, I can't do this" - - def _universal_to_array(self, typ): - if typ[0] == "atomic": - s = """jq -r 'map(tostring) | join("\\n")' $1""" - elif typ[0] == "array": - s = """jq -r 'map(@tsv) | join("\\n")' $1""" - else: - s = "echo $1" - return s - - def _primitive_to_universal(self, typ): - s = self.atom_to_universal[typ].format(x="{mid} $@") - return s - - def _tuple_to_universal(self, typ): - return '''{mid} $@ | jq -R -s -c 'split("\\t")' ''' - - def _array_to_universal(self, typ): - if(typ[0] == "atomic"): - return ''' - while read line - do - %s - echo -n ',' - done < <({mid} $@) | sed 's/,$//; 1s/^/[/; $s/$/]/' | jq -c '.' -''' % atom_to_universal[typ[1]].format(x='echo $line') - elif(typ[0] == "array"): - cast = "" - if (typ[1][0] == "atomic") and (typ[1][1] in ("String", "File", "Text")): - cast = 'for(i=1; i<=NF; i++){{$i = "\\""$i"\\""}};' - return ''' - awk ' - BEGIN{{FS="\\t"; OFS="\\t"; ORS=","}} - {{%s print "[" $0 "]" }} - ' <({mid} $@) | sed 's/\\t/,/g; s/\(.*\),/[\\1]/' -''' % cast diff --git a/backend/src/morloc/morloc.py b/backend/src/morloc/morloc.py deleted file mode 100755 index 1adde93a..00000000 --- a/backend/src/morloc/morloc.py +++ /dev/null @@ -1,263 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import sys -import os -import subprocess -import shutil - -import lil -import nexus -from util import err - -from grammar.R import RGrammar -from grammar.sh import ShGrammar -from grammar.py import PyGrammar - -from mogrifier.R import RMogrifier -from mogrifier.sh import ShMogrifier -from mogrifier.py import PyMogrifier - -__version__ = '0.0.0' -__prog__ = 'morloc' - -def parser(): - - if len(sys.argv) > 1: - argv = sys.argv[1:] - else: - argv = ['-h'] - - parser = argparse.ArgumentParser( - description="Compile a Morloc program", - usage="morloc [options] MORLOC_SCRIPT" - ) - parser.add_argument( - '-o', '--nexus-name', - default="manifold-nexus.py", - help="Set the name of the manifold nexus" - ) - parser.add_argument( - '-v', '--version', - help='Display version', - action='version', - version='%(prog)s {}'.format(__version__) - ) - parser.add_argument( - '-r', '--run', - help='Compile and call CMD in one step, delete temporary files' - ) - parser.add_argument( - 'f', - help="Morloc source file" - ) - parser.add_argument( - '-t', '--typecheck', - help="Typecheck the Morloc script (do not build)", - action='store_true', - default=False - ) - parser.add_argument( - '-l', '--lil-only', - help="Only run frontend, print Morloc Intermediate Language", - action='store_true', - default=False - ) - parser.add_argument( - '-m', '--print-manifolds', - help="Print summaries of all manifolds", - action='store_true', - default=False - ) - parser.add_argument( - '-x', '--execution-path', - help="Folder for caches and scripts" - ) - parser.add_argument( - '-k', '--clobber', - help="Overwrite execution path directory", - action='store_true', - default=False - ) - parser.add_argument( - '--valgrind', - help="Compile with valgrind", - action='store_true', - default=False - ) - parser.add_argument( - '--memtest', - help="Compile with valgrind and --leak-check=full", - action='store_true', - default=False - ) - parser.add_argument( - '--token-dump', - help="Print the lexer tokens", - action='store_true', - default=False - ) - parser.add_argument( - '--table-dump', - help="Dump the parser symbol table", - action='store_true', - default=False - ) - args = parser.parse_args(argv) - return(args) - - -def get_outdir(home, exe_path=None): - morloc_tmp = "%s/tmp" % home - try: - os.mkdir(morloc_tmp) - except FileExistsError: - pass - outdir = None - if exe_path: - outdir=os.path.expanduser(exe_path) - try: - os.mkdir(outdir) - except PermissionError: - err("PermissionError: cannot mkdir '%s'" % outdir) - except FileNotFoundError: - err("Cannot create directory '%s'" % outdir) - except FileExistsError: - if not args.clobber: - err("Directory '%s' already exists" % outdir) - else: - for i in range(500): - try: - outdir=os.path.join(morloc_tmp, "morloc_%s" % i) - os.mkdir(outdir) - break - except FileExistsError: - pass - else: - err("Too many temporary directories (see ~/.morloc/tmp)") - return os.path.abspath(outdir) - -def build_project(raw_lil, outdir, home): - - exports = lil.get_exports(raw_lil) - source = lil.get_src(raw_lil) - manifolds = lil.get_manifolds(raw_lil) - languages = set([l.lang for m,l in manifolds.items()]) - - # This allows simple programs to be run without an explicit - # export clause. "m0" will be the first manifold that appears - # in the script. - if not exports and manifolds: - exports["m0"] = "main" - - manifold_nexus = nexus.build_manifold_nexus( - languages = languages, - exports = exports, - manifolds = manifolds, - outdir = outdir, - home = home, - version = __version__, - prog = __prog__ - ) - - for lang in languages: - try: - src = source[lang] - except KeyError: - src = "" - - if lang == "sh": - grm = ShGrammar(src, manifolds, outdir, home) - mog = ShMogrifier(manifolds) - elif lang == "R": - grm = RGrammar(src, manifolds, outdir, home) - mog = RMogrifier(manifolds) - elif lang == "py": - grm = PyGrammar(src, manifolds, outdir, home) - mog = PyMogrifier(manifolds) - else: - err("'%s' is not a supported language" % lang) - - pool = grm.make( - uni2nat=mog.build_uni2nat(), - nat2uni=mog.build_nat2uni() - ) - - pool_filename = os.path.join(outdir, "call.%s" % lang) - with open(pool_filename, 'w') as f: - print(pool, file=f) - os.chmod(pool_filename, 0o755) - - if any([m.cache for m in manifolds.values()]): - try: - os.mkdir(os.path.join(outdir, "cache")) - except FileExistsError: - # Only make the cache if it doesn't already exist - pass - - with open(args.nexus_name, 'w') as f: - print(manifold_nexus, file=f, end="") - - os.chmod(args.nexus_name, 0o755) - -def get_lil(args): - flags = [] - if args.typecheck: - flags.append('-c') - if args.token_dump: - flags.append('-t') - if args.table_dump: - flags.append('-d') - - compilant = lil.compile_morloc( - args.f, - flags = flags, - valgrind = args.valgrind, - memtest = args.memtest - ) - - return (compilant.stdout, compilant.stderr, compilant.returncode) - - -if __name__ == '__main__': - - args = parser() - - raw_lil, err_lil, exitcode = get_lil(args) - - if err_lil: - print(err_lil, file=sys.stderr, end="") - if args.typecheck: - sys.exit(1) - - if exitcode != 0: - err("Failed to compile Morloc", code=exitcode) - - if args.lil_only: - for line in raw_lil: - print(line, end="") - sys.exit(0) - - morloc_home = os.path.expanduser("~/.morloc") - - outdir = get_outdir(morloc_home, args.execution_path) - - build_project(raw_lil=raw_lil, outdir=outdir, home=morloc_home) - - if args.print_manifolds: - for k,m in manifolds.items(): - m.print() - sys.exit(0) - - if args.run: - result = subprocess.run( - ["./manifold-nexus.py", args.run], - stderr=subprocess.PIPE, - stdout=subprocess.PIPE, - encoding='utf-8' - ) - print(result.stdout, end="") - print(result.stderr, end="") - shutil.rmtree(outdir) - os.remove("manifold-nexus.py") - sys.exit(result.returncode) diff --git a/backend/src/morloc/nexus.py b/backend/src/morloc/nexus.py deleted file mode 100644 index 28beed44..00000000 --- a/backend/src/morloc/nexus.py +++ /dev/null @@ -1,149 +0,0 @@ -import re -import manifold -from util import err,indent - -nexus_template = '''\ -#!/usr/bin/env python3 - -import argparse -import subprocess -import sys -import os -import shutil - -outdir = "{outdir}" - -def parser(): - parser = argparse.ArgumentParser( - description="A program generated from a Morloc script", - usage='manifold-nexus ', - prog="manifold-nexus" - ) - parser.add_argument( - '--version', - help='Display version', - action='version', - version='{prog} {version}' - ) - parser.add_argument( - '-d', '--delete', - help="Remove this manifold nexus and temporary directory", - action='store_true', - default=False - ) - parser.add_argument( - '-s', '--silent', - help="Do not print the output of the final manifold", - action='store_true', - default=False - ) - sub = parser.add_subparsers( - help='.', - metavar='[ for more help: manifold-nexus -h ]', - title='manifolds' - ) - -{manifold_parsers} - - args = parser.parse_args() - - return(args) - -{manifold_calls} - -if __name__ == '__main__': - args = parser() - if args.delete: - shutil.rmtree(outdir) - os.remove("manifold-nexus.py") - else: - result, vtype = args.func() - if result == None: - returncode = 1 - else: - returncode = result.returncode - if not args.silent: - print(result.stdout, end="") - print(result.stderr, file=sys.stderr, end="") - sys.exit(returncode) -''' - -parser_template = '''\ - -{mid}_parser = sub.add_parser( - '{alias}', - usage="manifold-nexus {alias}", - description="{doc}", - help="({lang}) {doc}" -) -{mid}_parser.set_defaults(func={mid}) -''' - -call_template = '''\ -def {mid}(): - path = os.path.join(outdir, "call.{lang}") - try: - cmd = ' '.join([path, "{mid}"]) - result = subprocess.run( - [path, "{mid}"], - stderr=subprocess.PIPE, - stdout=subprocess.PIPE, - encoding='utf-8' - ) - return (result, "{vtype}") - except OSError as e: - print("OSError in '%s': %s" % (cmd, e), file=sys.stderr) - print("Check the hashbang", file=sys.stderr) - return (None, "{vtype}") -''' - -def build_manifold_nexus( - languages, - exports, - manifolds, - outdir, - home, - version, - prog -): - mparsers = [] - mcalls = [] - - for k,v in manifolds.items(): - - try: - alias = exports[k] - except KeyError: - continue - - if v.mdoc: - doc = v.mdoc[1:-1] - else: - doc = "" - - parser_string = indent( - parser_template.format( - mid = k, - alias=alias, - func = v.func, - lang = v.lang, - doc = doc - ), - n=4 - ) - - call_string = call_template.format( - mid=k, - lang=v.lang, - vtype=v.type - ) - mcalls.append(call_string) - mparsers.append(parser_string) - - return nexus_template.format( - prog=prog, - version=version, - outdir=outdir, - manifold_parsers='\n'.join(mparsers), - manifold_calls='\n'.join(mcalls) - ) diff --git a/backend/src/morloc/util.py b/backend/src/morloc/util.py deleted file mode 100644 index bbc1cb64..00000000 --- a/backend/src/morloc/util.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import re - -def err(msg, code=1): - print(msg, file=sys.stderr) - sys.exit(code) - -def indent(text, n=4): - if text: - lines = text.split('\n') - s = "\n".join([(' ' * n) + l for l in lines]) - else: - s = text - return s - -def clean(text): - s = [] - for line in text.split('\n'): - line = line.rstrip() - if(len(line) != 0): - s.append(line) - return '\n'.join(s) diff --git a/backend/src/setup.py b/backend/src/setup.py deleted file mode 100644 index f423db9f..00000000 --- a/backend/src/setup.py +++ /dev/null @@ -1,6 +0,0 @@ -from distutils.core import setup -setup( - name='loc_backend', - version='0.0.0', - py_modules=['loc_backend'], -) diff --git a/case-studies/cluster/Makefile b/case-studies/cluster/Makefile deleted file mode 100644 index 6cb5d2c7..00000000 --- a/case-studies/cluster/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=cluster - -all: - morloc -kx locout ${TARGET}.loc - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py *.pdf - rm -rf locout diff --git a/case-studies/cluster/README.md b/case-studies/cluster/README.md deleted file mode 100644 index 6ef5f040..00000000 --- a/case-studies/cluster/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# Clustering in R and Python - -The machine learning and statistics communities heavily overlap, but the former -mostly uses Python and the latter R. Many bleeding-edge machine learning -algorithms are available in Python libraries such as `scikit-learn`. R has -a ridiculously comprehensive statistical and data-analytic library, much of -which is missing in Python. - -There is a well-earned aversion to multi-lingual programming. There are good -reasons for this. Learning new languages is a huge investment. Every new -language you add a new layer of interfaces between it and each existing -language. - -Here are a few approaches to linking R and Python - - 1. Embed both languages in a scripting language, e.g. Bash - Pros - * no extra dependencies - * low learning curve (assuming you know Bash, R, and Python). No new - libraries to learn and code can be idiomatic in each script. - Cons - * adds a third language - * requires writing both Bash and Python languages as independent - executables and handling their arguments, inputs and outputs - * slow, since this requires repeatedly loading the interpreter - - 2. Invoke the foreign language using a system call. - Pros - * uses just two languages - Cons - * systems calls a ugly (and very different) in both languages - * can get tricky problems with cross-calls - * slow, since this requires repeatedly loading the interpreter - - 3. For Python to R, use a special library `rpy2`. - Pros - * very fast, since Python sends data to a embeded instance of the - R interpreter - Cons - * verbose and non-idiomatic, since every R function needs to be wrapped - in Python code - * only works one way, there isn't a similar program that allows Python to - be run from inside R. - - 4. Morloc - Pros - * no boilerplate - * no extra IO code - * completely idiomatic - Cons - * third language problem - * Foreign calls to interpreted languages are slow currently. But this is - a compiler problem, future Morlock implementations could use existing - libraries for linking languages in its generated code. diff --git a/case-studies/cluster/cluster.loc b/case-studies/cluster/cluster.loc deleted file mode 100644 index 60dfbc4f..00000000 --- a/case-studies/cluster/cluster.loc +++ /dev/null @@ -1,73 +0,0 @@ -@type -load_data :: Void -> Table -select_features , -scale , -dist :: Table -> Table -cluster :: Table -> [String] - -@path R -null . - cluster:kmeans cluster:spectral . - ( as.matrix . dist ) . - scale . - select_features . - `iris` - -@lang -cluster:spectral :: py - -@alias -cluster:kmeans :: kmeans_cluster -cluster:spectral :: spectral_cluster - -@arg -cluster:kmeans :: centers=3 -cluster:spectral :: n_clusters=3 -dist :: method="euclidean" -select_features :: cols=[1,2,3,4] - -@assert R -scale :: columns_are_numeric . - -@fail R -scale :: warning . "Invalid input to _normalize_" - -@after R -null :+ plot_pdf . `iris` "kmeans.pdf" -null :+ plot_pdf . `iris` "spectral.pdf" - -@include -core/atomic -core/datcache - -@cache -as.matrix,cluster :: datcache - -@source R - -select_features <- function(x, cols=1:4) { - x[, unlist(cols)] -} - -columns_are_numeric <- function(x) { - all(sapply(x, is.numeric)) -} - -kmeans_cluster <- function(mat, ...) { - kmeans(mat, ...)$cluster -} - -plot_pdf <- function(x, cl, path, ...){ - pdf(path) - plot(x, col=cl, ...) - dev.off() -} - -@source py -from sklearn import cluster -def spectral_cluster(X, *args, **kwargs): - classifier = cluster.SpectralClustering(*args, **kwargs) - classifier.fit(X) - pred = classifier.fit_predict(X) - pred = [int(x)+1 for x in pred] - return pred diff --git a/case-studies/extract-fasta/Makefile b/case-studies/extract-fasta/Makefile deleted file mode 100644 index 649b8e32..00000000 --- a/case-studies/extract-fasta/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=extract_fasta.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py *fai - rm -rf locout result z.fna diff --git a/case-studies/extract-fasta/README.md b/case-studies/extract-fasta/README.md deleted file mode 100644 index 861d8b3d..00000000 --- a/case-studies/extract-fasta/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Extracting CDS from a genome given a GFF - -Core pipeline: - 1. read in a GFF file - 2. for each gene model - a. order ; diff --git a/case-studies/extract-fasta/extract_fasta.loc b/case-studies/extract-fasta/extract_fasta.loc deleted file mode 100644 index f972a53a..00000000 --- a/case-studies/extract-fasta/extract_fasta.loc +++ /dev/null @@ -1,38 +0,0 @@ -@type -readG :: File -> Table -extract :: Table -> File -> Text - -@path -null . extract . - ( subset . readG . 'foo.gff' ) - 'foo.fna' - -@lang -* :: R -extract,null :: sh - -@include -core/atomic - -@after -null :: cp . 'z.fna' - -@lang -cp :: sh - -@arg -subset :: subset=`name == "gene" & stop - start < 1200` - -@source R -library(magrittr) -readG <- function(x){ - require(readr) - gff_cols <- c('seqid', 'source', 'name', 'start', - 'stop', 'score', 'strand', 'phase', 'attr') - read_tsv(x, col_names=gff_cols, na='.', col_types='ccciinccc') -} - -@source sh -extract () { - bedtools getfasta -fi $2 -bed $1 -fo /dev/stdout -s -name -} diff --git a/case-studies/extract-fasta/foo.fna b/case-studies/extract-fasta/foo.fna deleted file mode 100644 index d2ba52c2..00000000 --- a/case-studies/extract-fasta/foo.fna +++ /dev/null @@ -1,882 +0,0 @@ ->Chr1 -ccctaaaccctaaaccctaaaccctaaacctctGAATCCTTAATCCCTAAATCCCTAAATCTTTAAATCCTACATCCATG -AATCCCTAAATACCTAAttccctaaacccgaaaccggTTTCTCTGGTTGAAAATCATTGTGtatataatgataattttat -CGTTTTTATGTAATTGCTTATTGTTGTGtgtagattttttaaaaatatcatttgagGTCAATACAAATCCTATTTCTTGT -GGTTTTCTTTCCTTCACTTAGCTATGGATGGTTTATCTTCATTTGTTATATTGGATACAAGCTTTGCTACGATCTACATT -TGGGAATGTGAGTCTCTTATTGTAACCTTAGGGTTGGTTTATCTCAAGAATCTTATTAATTGTTTGGACTGTTTATGTTT -GGACATTTATTGTCATTCTTACTCCTTTGTGGAAATGTTTGTTCTATCAATTTATCTTTTGTGGgaaaattatttagttg -taGGGATGAAGTCTTTCTTCGTTGTTGTTACGCTTGTCATCTCATCTCTCAATGATATGGGATGGTCCTTTAGCATTTAT -TCTGAAGTTCTTCTGCTTGATGATTTTATCCTTAGCCAAAAGGATTGGTGGTTTGAAGACACATCATATCAAAAAAGCTA -TCGCCTCGACGATGCTCTATTTCTATCCTTGTAGCACACATTTTGGCACtcaaaaaagtatttttagatgtttgttttgc -ttctttgaagTAGTTTCTCTTTGCAAAATTCCTCTTTTTTTAGAGTGATTTGGATGATTCAAGACTTCTCGGTACTGCAA -AGTTCTTCCGCCTGATTAATTATCCATTTTACCTTTGTCGTAGATATTAGGTAATCTGTAAGTCAACTCATATACAActc -ataatttaaaataaaattatgatcGACACACGTTTACACATAAAATCTGTAAATCAACTCATATACCCGTTATTCCCACA -ATCATATGCTTTCTAAAAGCAAAAGTATATGTCAACAATTGGTTATAAATTATTAGAAGTTTTCCACTTATGACTTAAGA -ACTTGTGAAGCAGAAAGTGGCAACACCCCCCAcctcccccccccccccccacccCCCAAATTGAGAAgtcaattttatat -aatttaatcaaataaataagtttatgGTTAAGAGTTTTTtactctctttatttttctttttctttttgagacATACTGAA -AAAAGTTGTAATTATTAATGATAGTTCTGTGATTCCTCCATGAATCACATCtgcttgatttttctttcataaatttataa -gtaATACATTCTTATAAAATGGTCAGAGAAACACCAAAGATCCCGAGATTTCTTCTCacttactttttttctatctatCT -AGATTATATAAATGAGATGTTGAATTAGAGGAACCTTTGATTCAATGATCATAGAAAAATTAGGTAAAGAGTCAGTGTCG -TTATGTTATGGAAGATGTGAATGAAGTTTGACTTCTCATTGTATATGAGTAAAATCTTTTCTTACAAGGGAAGTCCCCAA -TTGGTCAACATGTGAAAGCACGTGTCATGTTCTTACTTTTGTTTGGGTAATCTTCTAATTACTGTATATGGAAGATGTGA -ATGAAGTTTTGGTCCTGAATGTGGCCAAGGTTCCGTCATTTGGAGATACGAAATCAAATCTcctttaagattttgttttt -ataatgtGTTCTTCCATCCACATCTATCTCCATATGATATGGACCATATCATACATCATCATTTGTCCAAATGCATGAAT -GAATTTGGAAATAGGTACGAGAATGCCAACAATGACAAGAAGGGATCAAAGAcagtttttaaaacaatattttacaGGGT -TTTAATCTAATTCTAAGTTTTGGTCACTCACTTTGTTAAAAGAATAATTCAGTGTCTGGACACTAAAATCTTCCAAAAAC -CccatatacatatatgctATTTCGatacttatatttatttactcagcataaaaaatattaaccaTGTATTCATAGTAAAA -TGTTTCATGTGATATCAAACCAGCGACAACAAAAGTATTATTCCCCTCATTATGTTTGACTcctattatatttttatttt -aatttttttcactATCATCTTTCTTGCAATGAAAGTCCCATATATTGGTCAACATTTCAAACCACTTGttctcttttatg -ttttggtaaGAGCTATcttctaaatttataatacgcataaattcaaaagtaaaagaaaattttggtcATGAATGTTGTTT -AAGTCATTTGGAGATACGAAATCAAATCTCcttgtagattttgtttttagaatgTCGttcctttttcatcatcttagCTA -TATCTACAGCTATATATCCTATCTTTAAacctatattattttttcctctcttcacCAAAGCCATGTTTTTTAGTTGTGGc -gaaaaataagaaatccaTACATCAACATATCGCTTTCGTTACCTTAAATTTTGGCTTGTTATGAAGGCATGTCATAACGT -TTCTAGTCACAACTCACAAGCATACCAACGACCATGATAAATCCAAAAAGTAGAAACAATCTATTATCTAAACCcccaaa -agacaaaagaaaaaagtagaaagaaaagGTAGGCAGAGATATAATGCtggttttatttgtttgttaaaagataTTGCTAT -TTCTGCCAATATTAAAACTTCACTTAGGAAGACTTGAACCTACCACACGTTAGTGACTAATGAGAGCCACTAGATAATTG -CATGCATCCCACACTAGTACTAATTTTCTAGGGATATTAGAGTTTTCTAATCACCTACTTCCTACTATGTGTATGTTATC -TACTGGCGTGGATGCTTTTAAAGATGTTACGTTATTATTTTGTTCGGTTTGGAAAACGGCTCAATCGTTATGAGTTCGTA -AGACACATACATTGTTCCATGATAAAATGCAACCCCACGAACCATTTGCGACAAGCAAAACAACATGGTCAAAATTAAAA -GCTAACAATTAGCCAGCGATTCAAAAAGTCAACCTTCTAGATGGATTTAACAACATATCGATAGGATTCAAGATTAAAAA -TAAGCACACTCttattaatgttaaaaaaCGAATGAGATGAAAATATTTGGCGTGTTCACACACATAATCTAGAAGACAGA -TTCGAGTTGCTCtcctttgttttgctttgggAGGGACCCATTATTACCGCCCAGCAGCTTCCCAGCCTTCCTTTATAAGg -cttaatttatatttatttaaattttatatgttcTTCTATTATAATACTAAAAGGGGAATACAAATTTCTACAGAGGATGA -TATTCAATCCACGGTTCACCCAAACcgattttataaaatttattattaaatcttttttaattgttaaattggtttaaaTC -TGAACTCTGTTTACTTACATTGATTAAAATTCTAAACCATcataagtaaaaaataatatgattaaGACTAATAAATCTTA -ATAGTTAATACTACTCGGTTTACTACATGAAATTTCATACCATCAAttgttttaataatctttaaaattGTTAGGACCGG -TAAAACCATACCAATTAAACCGGAGATccatattaatttaattaagaaaataaaaataaaaggaataAATTGTCTTATTT -AAACGCTGACTTCACTGTCTTCCTCCCTCCAAATTATTAGATATACCAAaccagagaaaacaaatacataatCGGAGAAA -TACAGATTAcagagagcgagagagatcGACGGCGAAGCTCTTTACCCGGAAACCATTGAAATCGGACGGTTTAGTGAAAA -TGGAGGATCAAGTTGGGTTTGGGTTCCGTCCGAACGACGAGGAGCTCGTTGGTCACTATCTCCGTAACAAAATCGAAGGA -AACACTAGCCGCGACGTTGAAGTAGCCATCAGCGAGGTCAACATCTGTAGCTACGATCCTTGGAACTTGCGCTGTAAGTT -CCGAATTTTCTGAATTTCATTTGCAAGTAATCGAtttaggtttttgattttagggtttttttttgttttgaacagtCCAG -TCAAAGTACAAATCGAGAGATGCTATGTGGTACTTCTTCTCTCgtagagaaaacaacaaaggGAATCGACAGAGCAGGAC -AACGGTTTCTGGTAAATGGAAGCTTACCGGAGAATCTGTTGAGGTCAAGGACCAGTGGGGATTTTGTAGTGAGGGCTTTC -GTGGTAAGATTGGTCATAAAAGGGTTTTGGTGTTCCTCGATGGAAGATACCCtgacaaaaccaaatctgATTGGGTTATC -CACGAGTTCCACTACGACCTCTTACCAGAACATCAGGTTTTCttctattcatatatatatatatatatatatgtggatat -atatatatgtggttTCTGCTGATTCATAGTTAGAATTTGAGTTATGCAAATTAGAAACTATGTAATGTAACTCTATTTAG -GTTCAGCAGCTATTTTAGGCTTAGCTTACTCTCACCAATGTTTTATACTGATGAACTTATGTGCTTACCTCCGGAAATTT -TACAGAGGACATATGTCATCTGCAGACTTGAGTACAAGGGTGATGATGCGGACATTCTATCTGCTTATGCAATAGATCCC -ACTCCCGCTTTTGTCCCCAATATGACTAGTAGTGCAGGTTCTGTGGTGAGTCTTTCTCCATATACACTTAGCTTTGAGTA -GGCAGATCAAAAAAGAGCTTGTGTCTACTGATTTGATGTTTTCCTAAACTGTTGATTCGTTTCAGGTCAACCAATCACGT -CAACGAAATTCAGGATCTTACAACACTTACTCTGAGTATGATTCAGCAAATCATGGCCAGCAGTTTAATGAAAACTCTAA -CATTATGCAGCAGCAACCACTTCAAGGATCATTCAACCCTCTCCTTGAGTATGATTTTGCAAATCACGGCGGTCAGTGGC -TGAGTGACTATATCGACCTGCAACAGCAAGTTCCTTACTTGGCACCTTATGAAAATGAGTCGGAGATGATTTGGAAGCAT -GTgattgaagaaaattttgagtttttggtaGATGAAAGGACATCTATGCAACAGCATTACAGTGATCACCGGCCCAAAAA -ACCTGTGTCTGGGGTTTTGCCTGATGATAGCAGTGATACTGAAACTGGATCAATGGTAAGCTTTTTTTACTCATATATAA -TCACAACCTATATCGCTTCTATATCTCACACGCTGAATTTTGGCTTTTAACAGATTTTCGAAGACACTTCGAGCTCCACT -GATAGTGTTGGTAGTTCAGATGAACCGGGCCATACTCGTATAGATGATATTCCATCATTGAACATTATTGAGCCTTTGCA -CAATTATAAGGCACAAGAGCAACCAAAGCAGCAGAGCAAAGAAAAGGTTTAACACTCTCACTGAGAAACATGACTTTGAT -ACGAAATCTGAATcaacatttcatcaaaaagaTTTAGTCAAATGACCTCTAAATTATGAGCTATGGGTCTGCTTTCAGGT -GATAAGTTCGCAGAAAAGCGAATGCGAGTGGAAAATGGCTGAAGACTCGATCAAGATACCTCCATCCACCAACACGGTGA -AGCAGAGCTGGATTGTTTTGGAGAATGCACAGTGGAACTATCTCAAGAACATGATCATTGGTGTCTTGTTGTTCATCTCC -GTCATTAGTTGGATCATTCTTGTTGGTTAAGAGGTCAAATCGGATTCTTGCtcaaaatttgtatttcttagaatgtgtgt -ttttttttgtttttttttctttgctctgttttctcgCTCCGGAAAAGTTTgaagttatattttattagtatgtaaagaag -agaaaaagggggaaagaagagagaagaaaaatgcagaaaatcatatatatgaattggaaaaaagtatatgtaataataat -tagtGCATCGTTTTGTGGTGtagtttatataaataaagtgATATATAGTCTTGTATAAGAAAGGGATTTTACATGAGACC -CAAATATGAGTAAAGGGTGTTGGCTCAAAGATTCATTTAGCAACCAAAGTTGCATTTGCAAGGAAATGAAAAGGTGTTAA -CAATGTCACTGCGTAACATGACTTCGAtacaaaatctcaaacaatACATCTTCAACTGTGGATTATGATGGACTTGGGGT -TGCAGGTGATATGTCTATAGAAAAACGGGTGGGAATGGAAAAtggctgaagaagaaagctccaACTAAGCATCATAACTG -GATTGTTTTAGAGGAGATGAGTCAAAGGAATTCACAGTGGAACTATCTCAAGAACATGATCATTGGCTTCTTATTGTTCA -TCTCCATCATTGGCTGGATCATTCTGGTTCAAGAggtcaaattatatatacataacgGATCTAAGAAGTATAGTGTAgtc -aattaaaacaaaacgaGACTTGAAAATAAGCATAAGTATTATTAAGTTAACCCAATATTCGTTTCAATGCTTTAGTTATC -ATCAGAATTCTCAACATTTTCAGATATTTAACTTGCCTTTGGTTGCTTTCTCGCCATGGTAGTAGCATTCTCCGGATAAG -AATCAAGGGGAGCCTCAACTTCGGCTTCAACCGTCTCCTCGTCTTTCCTATGACATTCACTTGGTGTTGCAACAATGTGT -TGATGCCCCACATTCATAGGAGAGTCCCACATATCTCCAACATTCATAGGAGGGTTCCACATATGCCCACCATTCCAAGG -AGGGTACCACCACATATGCCCAGCATTCCAAGAAAGATGGAGCGACGATATCGTGAGGAACAAGGTTTTTGTAGGGCAAA -TAATTGTAGGTGGTTGAGTTATATCCGCCCGCACAGAGTAACAGACCAACAAttaacttttgatattttagtaAGGTCTA -ATTCAATTTTTGGTGGCGATAATATTTGGCTTAGTCATAAAATACAGTATGGTATAATAATGTAAAGGTTTCTCTTATCT -TCAAACCAAAAGACTATACTGGAAGCTGATGGGATCATACGATTCTGAAAAAATAAGACATATATTGCAACAGAGATCCA -ATTTGTATCAAAAATATTGTCGGCTCAAAAATCTGACCCACCAAGAATCTAATCAAGTGCGCGATTAAGCATACGGCTAT -GCATCTGGTCATTGTTGATTCAGTCATCACTGGTTTAAAGACAAACTTGCATTGTGAGATTCcaaaataacaacaacaaa -aaacaatttgcatTGAGAACATTTTGAAGGTCTGACCTTTAAGAGCCATGGAGTTTGATGTTAAGAGAAGTAtatcgaca -aaaaaaatcactgaCATTGGGAATTCCCATACCTGTAATAACAAAGATTCTCTATTTTTGAGCAAAGAGACATAACACCA -TGTTTAATCAATACAAGAAACTTTAGTGCATGATTTATGGAATGCTTAAGAAGTTTGGAACTTCAATATTAGGAATTAAG -TGAGAGGTAAAGCTACAACATACCAACATCGCAAGCAGAAATATCTTGAAGTAACTAGAGATGAATATCCCCAAcataat -ctctcttcttctgcaaagtttttaaaaaaaattatacataaaCAATCTTCAGGTGACAGAAGTCTGAGATCTTTGATGAA -AAACTCATAATAAgaactaagaagaagaagaatcagtaATCACCTGGAAACTTCATTTAGCAAACCCTTAGTCGCAATGG -CAAAAGAGATGATAAATGCAGCGTTTGCAGATAAGACACCAATCAGAACCTGTTTCAAATGCGAAATTATTACCCTTTCT -AAACAATCTCAATGACTTAAATCATTTAAAccttaaaggaaaaaaaatctaattaagtCCATTAAAAAGAAACGATCTAA -CCTTTATAGATAGAAGAACAGGGCTATCAGAAAAGCTCGATTCTTCATCACTTTTTCTCAGTAGCAAGCTTCTATCTATG -ATGAGTTCAGGGCTTTTCAAATAAGTTTGCCGATGAATCTCACCAACTACACATCTGCTAGCTACACTTTGATAGTAAAa -gattataaaacaaaaggataCAACAGTCTAGAAGAAGATAGGCGAAGACCAACTTCCACAACAGATGctgcacacacaca -cacaaaaaaaaaaaaagaacccaACAATTCTTATTGGATCAGAGACTACTCAATATCCCCAAACTTGGAAATTAGTTTGT -TGCTTGAGGTCTAAGATACTTCTATATATGgaaaaagattttcaaagCCAGATATTTCCACAAGTTTGTAATATCAATTC -AAGATAAGAGAGCTAGAATCAGACAGGAACTAGCAATGCTTGAAATCAAGAACTTGAATTGAAATAGTTTTTTACCTGAA -TATTGACAGTTGCTGGATTAATTGCATTGTAGAGGACGTGTCTATATACCTTTGGTCTGTGAAGGATTAAATCGATGAAA -ATAATCTgccaaagaaaacaattaaagaaccaaaaaccaaaattggaAAGAAATAGGGAAACACccaaaaagggaaagaa -agtGATTAAAACAGACCATGCGTTCACACTCGATGTACTCATCTGCTACTTCCTTGCAATTTCCCTAAATATAACAATAT -GATCAAAGATGGAAACTTTGAAGAAATTTAATAGAGAATcttataaaccctaattggGTCAAAGAAGATCcattaataca -aaaatcttACGCATTTCATGAGACGAATGTTACCCGGAGAGTATTGAATGAACAATGACTTTACCCTAAAACCACATCCC -ACGCATCTGTGTTCACTCGCCGCcattgctctctctctctctctctctctctctctctcaagagaagaagaatacgGAGC -AATTAGAGTCCGGGTCTGGGCTACTGTTTTAACCCTAAATGGGCTTATTCATGGGCCAAGTTTTTGAAGTCTtaacttta -aatttgttaGGCCCACTTTTGCTCTAAGCCGGGGTATTTGTAccccaaaatttaaaaatcatatacacgttgtaatttat -aaatagttCAATTTGGATCAAAATCTTGTCCATATGACATAGCATTTTAAAATGCGTAGGTTCATGAATGAAACATATTA -TAGGCCTCAGATAAAGATATACATATTAAGTCTAAATTATTTAGTCTTCAGAATTTACCACACTTACTGAAAAGTCTAGT -GGTTCACTAATATTATTACTGTCGTGTTACTTTCTATATATAGTTCATGACTTGTGAGTTGTGATGGATaagtttataag -aaaataaattatttattacaattCAACAGTgaagaaatttatttagtttgatTAAATAAGAAAGGTAAATAAATCTTCGT -TTGCcacaccaaacaaaaaaaactccttTTGTTGCATGTAATTAGCATATGGCtacaaaatgaaagatttgacAATGAGG -TTTAGATAAAATAGTTTCCTTTCAATATAAGTAAACTCAACATAAAAATGAAACGGTAAgttaaaagtttaatatttgat -tattactttatttagAAATGTATTAGAAAGGGAAAGAACCCATTAACCCCCAATACGAAGTTTCCTTATCATCATTAATC -ATGCCTATGAAAACCCTAACCGGCCTACATATTTGCAGTCTCTTTTAGGTCAGGAATCTAATGAGaatgaattattttat -tttatttaacaatAATTGGAGCATGTCATTAATTCTCTTTATTCTTCTTACACAACTAATCATTTAGATGTGTTACAATA -TTATTTCCTTTAgtcattttcataattttaatacCTCCGTACTTTTCACTAATACCTCCccttttaattttcattatttc -ttcttttctatcaGTCTATGCATGCattcttttgaatattaaaatgcattttatattcttttgacAACTATGCACAAGCC -TTTTGAGACACATCTACACAATATAATAGCACAAGCCTTTATGAGACATATCTACACAATATCATTGCTACTTGTAGACT -ATTTGGAATACGTATTTACATATTCCATTGTATCATCCCTTTGCAAATGttttatacatataactaACATATACATTATT -CGTAACTTTGTTCCCCTATATCGAAAAATGTGGGCTACACATATaactaacatatatatatatatgtatgtttatATGAT ->Chr2 -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNGAATTCGTCGACCAGGACGGCGGAATGCTCGACCAGGACG -ATGAATGGGCGATGAAAATCTATCGGGTTAGAGGAATGGTCGACCGGGTCCGAGAATTCGTCGACCAGGACGAGGAGTGG -TCGAGGATTTGTCGACCAGGAGTTGAAATCGTCGACCGGGTCCGAGAATTCGTCGACCAGGACGGCGGAACCCTCGACCA -GGACGATGAATGGGCGATGAAAATCTATCGGGTTCGAGGAATGGTCGACCAGAAGTTGGAATCGTCGACCGGGTCCGAGA -ATTCGTCGACCAGGCCGAGGAGTGGTCGAGGATTTGTCGACCAGGAGTTGAAATCGTCGACCGGGACCGAGAATTCGTCG -ACCAGGACGGCGGAACCCTCGACCAGGACGATGAATGGGCGATGAAAATCTATCGGGTTCGAGGAATGGTCGACCAGGGG -TTGAAATCGTCGACCAGGTCCGAGACTTCATCGACCGGGTCCGAGGATTCGTCGACCAGGACGGCCGGATGtccgagaaa -aaaaaatgttgccGAATAACTTTCGAAAATCATTGGATATGATGCAATGTTTTGTGATCGAATCTCTTAAAATACATCAA -TAAAGAGTTTAGGATGTCAAGTTTGCATCAAATATGCCCACGGAGCCCCAACTAGACCATGAAAATCCGTTGTTGTATCA -GGTCAAATGACCTAGCTAGAGGTGTCagaaaattatgtaaatttacCAGAAAATAGGATTTAGTATCCTTATGATGCATG -CTAAaaagaattttcaaattccaagtatttctttttttttggcaccGGTGTCTCCTCAGACATTTCAATGTCTGTTGGTG -CCAAGAGGGAAAAGGGCTATTAAGCTATATAGGGGGGTGGGTGTTGAGGGAGTCTGGGCAGTCCGTGGGAACCCCCTTTT -TCGGTTCGGACTTGGGTAGCGATCGAGGGATGGTATCGGATATCGACACGAGGAATGACCGACCGTCCGGCCGCCGGGAT -TTTCGCCGGAAAACTTTTTCGGCGACTTTTCCGGCGATCGGTTTTGTTGCCTTTTTCCGAGTTTTCTCAGCAGTTCTCGG -ACAAAAACTGATGAATCGTCGAGGAGAATGAGCTTGCCTTGCGTGGGCTGCCATTAGTTCTTCGAGGCGTTAGGGTGGCG -GCGGTATAAAAGTGTCGGAGTTTTTTCAGCAGTTCTCGGACAAAAATTGCTGAGTGGCCGAGAAGAATGGGCGTGTCATG -CGTGGGCTGACATGGATTCTTCGAGGCCTAGGGGTGGCGGTATATAACTTGTTCGCATGATATTACCGAGATGTCCCCAC -GGGCATCTTTTCACCTCGTCGCCGAAGAGAATGGGCGTGTCATGCATGGGCTGACATGGATTCTCCTAGGCCGTTTGGGT -GGCGGTATAGTCGTCCTGCGCACGAAATACCGAGATGTCCCCATGGGCATCGATTCCACCCGCCTAGGTTGGATGGGCGT -GCTTCGTTGGAAAGCATGGATCCGCCTAGGCTGTCCCGAGTGTGAGCGAGGTGTGAGTGTCGCCCATGGGCATCGACACC -TTGCGGCTAGGAACTGGAACGAGATGGGTGGCGAAGATTTCGAGTAGCACTTCATACTACCGTCGGTTTTTTAAACCTTC -cgagttttgttgatgttatTCCGAGAATTAGCAAACCGTAACGAAGATGTTCTTGGCAACCATCTTTTGATGGGAGTCCG -GCTGTTCGATAGCCGGCCAAGGGTGATGAACGAAATGTGAACCCTTGTCTCGCCTAGGTTGGATGGGCGTGCTTCGTTGG -AAAGCATGGATCCGCCTAGGCTGTCCCGAGTGTGAGCGAGGTGTGAGTGTCGCCCATGGGCATCGACACCTTGCGGCTAG -GAACTGGAACGAGACGGGTAGCAAAGATTTCGAGTAGCACTTCATACTACCGTGGGTTTTTTAAACCTTCCGAGTTTTGT -TGATGTGTTTCCGAGAATTAGCAAACCGTAACGAAGATGTTCTTGGCAACCATCTTTTGATGGGAGTCCGGCTGTTCGAA -AGCCGGCCAAGGGTGATGAACGAAATGTGAACCCTTGTCTCGCCTAGGTTGGATGGGCGTGCTTCGTTGGAAAGCATGGA -TCCGCCTAGGCTGTCCCGAAGGTATCTCGCGCTTGTACGGCTTTGGCTTGGATTCGTccgtcttctttcttcttagcCGA -GTACTTCGGTAGAGTAGTTGGAACgattgatgattttgagttaATTGAACGTTCGGCGTATGAGTGGTGATCGGATAGCT -AGTGTTCGTAGGCTCCATGCTCGCGCATCGAACTACCTACCACCTATCCTTCTCAGTTAATTCACGGGCGATGTTACGCT -CGATGATGAGTTCCGGGGCCTGTGTTTCGTACCTAATTTGAAGGAATTGTTGAGTTTGGTTTACACCTTTGCCCGCGGCT -TCTCCTTCGTGGGGAAGTCGTGGGCACAAACATCGGCGCTTGTTCACCTCTCGTCATCGCATTTGTTGCCTTGCTCGCAT -TGGTGAATGAGTTGCGGGTTGAAATCTCGGATGCGGAAAAGTTGTCGACGGTGACTCGAAGTGATTCAGTCCCGCCAAAG -CTCATCCGTCCTTCGGGCAAAAGATGACGGTCAAGACCTCgtcctttctctctttccattGCGTTTGAGAGGATGTGGCG -GGGAATTGCCGTGATCGATGAATGCTACCTGGTTGATCCTGCCAGTAGTCATATGCTTGTCTCAAAGATTAAGCCATGCA -TGTGTAAGTATGAACGAATTCAGACTGTGAAACTGCGAATGGCTCATTAAATCAGTTATAGTTTGTTTGATGGTAACTAC -TACTCGGATAACCGTAGTAATTCTAGAGCTAATACGTGCAACAAACCCCGACTTATGGAAGGGACGCATTTATTAGATAA -AAGGTCGACGCGGGCTCTGCCCGTTGCTCTGATGATTCATGATAACTCGACGGATCGCATGGCCTCTGTGCTGGCGACGC -ATCATTCAAATTTCTGCCCTATCAACTTTCGATGGTAGGATAGTGGCCTACCATGGTGGTAACGGGTGACGGAGAATTAG -GGTTCGATTCCGGAGAGGGAGCCTGAGAAACGGCTACCACATCCAAGGAAGGCAGCAGGCGCGCAAATTACCCAATCCTG -ACACGGGGAGGTAGTGACAATAAATAACAATACTGGGCTCTTTCGAGTCTGGTAATTGGAATGAGTACAATCTAAATCCC -TTAACGAGGATCCATTGGAGGGCAAGTCTGGTGCCAGCAGCCGCGGTAATTCCAGCTCCAATAGCGTATATTTAAGTTGT -TGCAGTTAAAAAGCTCGTAGTTGAACCTTGGGATGGGTCGGCCGGTCCGCCTTTGGTGTGCATTGGTCGGCTTGTCCCTT -CGGTCGGCGATACGCTCCTGGTCTTAATTGGCCGGGTCGTGCCTCCGGCGCTGTTACTTTGAAGAAATTAGAGTGCTCAA -AGCAAGCCTACGCTCTGGATACATTAGCATGGGATAACATCATAGGATTTCGATCCTATTGTGTTGGCCTTCGGGATCGG -AGTAATGATTAACAGGGACAGTCGGGGGCATTCGTATTTCATAGTCAGAGGTGAAATTCTTGGATTTATGAAAGACGAAC -AACTGCGAAAGCATTTGCCAAGGATGTTTTCATTAATCAAGAACGAAAGTTGGGGGCTCGAAGACGATCAGATACCGTCC -TAGTCTCAACCATAAACGATGCCGACCAGGGATCAGCGGATGTTGCTTATAGGACTCCGCTGGCACCTTATGagaaatca -aagtttttgGGTTCCGGGGGGAGTATGGTCGCAAGGCTGAAACTTAAAGGAATTGACGGAAGGGCACCACCAGGAGTGGA -GCCTGCGGCTTAATTTGACTCAACACGGGGAAACTTACCAGGTCCAGACATAGTAAGGATTGACAGACTGAGAGCTCTTT -CTTGATTCTATGGGTGGTGGTGCATGGCCGTTCTTAGTTGGTGGAGCGATTTGTCTGGTTAATTCCGTTAATGAACGAGA -CCTCAGCCTGCTAACTAGCTACGTGGAGGCATCCCTTCACGGCCGGCTTCTTAGAGGGACTATGGCCGTTTAGGCCAAGG -AAGTTTGAGGCAATAACAGGTCTGTGATGCCCTTAGATGTTCTGGGCCGCACGCGCGCTACACTGATGTATTCAACGAGT -TCACACCTTGGCCGACAGGCCCGGGTAATCTTTGAAATTTCATCGTGATGGGGATAGATCATTGCAATTGTTGGTCTTCA -ACGAGGAATTCCTAGTAAGCGCGAGTCATCAGCTCGCGTTGACTACGTCCCTGCCCTTTGTACACACCGCCCGTCGCTCC -TACCGATTGAATGATCCGGTGAAGTGTTCGGATCGCGGCGACGTGGGTGGTTCGCCGCCCGCGACGTCGCGAGAAGTCCA -CTAAACCTTATCATTTAGAGGAAGGAGAAGTCGTAACAAGGTTTCCGTAGGTGAACCTGCGGAAGGATCATTGTCGATAC -CTGTCCAAAACAGAACGACCCGCGAACCAAAGATCACCACTCTCGGTGGGCCGGTTTCTTAGCCGATTCCTTGCCCGCCG -GATCCGTGGTTTCGCGTATCGGCATGCTCGGGAGCTTTTATCTCGGTCTTGTCGTGCGCGTTGCTTCCGGATATCACAAA -ACCCCAGCACGAAAAGTGTCAAGGAACATGCAAACGAACGGCTGGCATTCGCCTCCCCGGAGACGGAGTGTGGGCGGATG -CTGTGCTGCGAACTGAAGTCTAAAACGACTCTCGGCAACGGATATCTCGGCTCTCGCATCGATGAAGAACGTAGCGAAAT -GCGATACTTGGTGTGAATTGCAGAATCCCGTGAACCATCGAGTCTTTGAACGCAAGTTGCGCCCCAAGCCTTCTGGCCGA -GGGCACGTCTGCCTGGGTGTCACAAATCGTCGTCCCTCACCATCCTTTGCTGATGCGGGACGGAAGCTGGTCTCCCGTGT -GTTACCGCACGCGGTTGGCCTAAATCCGAGCCAAGGACGCCTGGAGCGTACCGACATGCGGTGGTGAACTTGATCCATTA -CATTTTATCGGTCGCTCTTGTCCGGAAGCAGTAGATGACCCAAAGTCCATATAGCGACCCCAGGTCAGGCGGGATTACCC -GCTGAGTTTAAGCATATCAATAAGCGGAGGAAAAGAAACTAACAAGGATTCCCTTAGTAACGGCGAGCGAACCGGGAAGA -GCCCAGCTTGAAAATCGGACGTCTTCGGCGTTCGAATTGTAGTCTGGAGAAGCGTCCTCAGCGACGGACCGGGCCTAAGT -TCCCTGGAAAGGGGCGCCAGAGAGGGTGAGAGCCCCGTCGTGCCCGGACCCTGTCGCACCACGAGGCGCTGTCTACGAGT -CGGGTTGTTTGGGAATGCAGCCCCAATCGGGCGGTAAATTCCGTCCAAGGCTAAATACGGGCGAGAGACCGATAGCGAAC -AAGTACCGCGAGGTAAAGATGAAAAGGACTTTGAAAAGAGAGTCAAAGAGTGCTTGAAATTGTCGGGAGGGAAGCGGATG -GGGGCCGGCGATGCGTCCTGGTCGGATGCGGAACGGAGCAATCCGGTCCGCCGATCGATTCGGGGCGTGGACCGACGCGG -ATTACGGTGGCGGCCTAAGCCCGGGCTTTTGATACGCTTGTGGAGACGTCGCTGCCGTGATCGTGGTCTGCAGCACGCGC -CTAACGGCGTGCCTCGGCATCAGCGTGCTCCGGGCGTCGGCCTGTGGGCTCCCCATTCGACCCGTCTTGAAACACGGACC -AAGGAGTCTGACATGTGTGCGAGTCAACGGGTGAGTAAACCCGTAAGGCGCAAGGAAGCTGATTGGCGGGATCCCTCGCG -GGTGCACCGCCGACCGACCTTGATCTTCTGAGAAGGGTTCGAGTGTGAGCATGCCTGTCGGGACCCGAAAGATGGTGAAC -TATGCCTGAGCGGGGTAAAGCCAGAGGAAACTCTGGTGGAAGCCCGCAGCGATACTGACGTGCAAATCGTTCGTCTGACT -TGGGTATAGGGGCGAAAGACTAATCGAACCATCTAGTAGCTGGTTCCCCCCGAAGTTTCCCTCAGGATAGCTGGAGCTCG -GACGCGAGTTCTATCGGGTAAAGCCAATGATTAGAGGCATTGGGGGCGCAACGCCCTCGACCTATTCTCAAACTTTAAAT -AGGTAGGACGTGTCGGCTGCTTTGTTGAGCCGTCACACGGAATCGAGAGCTCCAAGTGGGCCATTTTTGGTAAGCAGAAC -TGGCGATGCGGGATGAACCGGAAGCCGGGTTACGGTGCCCAACTGCGCGCTAACCTAGAACCCACAAAGGGTGTTGGTCG -ATTAAGACAGCAGGACGGTGGTCATGGAAGTCGAAATCCGCTAAGGAGTGTGTAACAACTCACCTGCCGAATCAACTAGC -CCCGAAAATGGATGGCGCTTAAGCGCGCGACCTATACCCGGCCGTCGGGGCAAGAGCCAGGCCTCGATGAGTAGGAGGGC -GCGGCAGTCGCTGCAAAACCTAGGGCGCGAGCCCGGGCAGAGCGGCCGTCGGTGCAGATCTTGGTGGTAGTAGCAAATAT -TCAAATGAGAACTTTGAAGGCCGAAGAGGGGAAAGGTTCCATGTGAACGGCACTTGCACATGGGTTATTCGATCCTAAGA -GTCGGGGGAAACCCGTCTGATAGCGCTTAAGCGCGAACTTCGAAAGGGGATTTGGTTAAAATTCCGGAACCGGGACGTGG -CGGTTGACGGCAACGTTAGGGAGTCCGGAGACGTCGGCGGGGGCCTCGGGAAGAGTTATCTTTTCTGTTTAACAGCCTGC -CCACCCTGGAAACGGCTCAGCCGGAGGTAGGGTCCAGCGGCTGGAAGAGCACCGCACGTCGCGTGGTGTCCGGTGCGCCC -CCGGCGGCCCTTGAAAATCCGGAGGACCGAGTGCCGCTCACGCCCGGTCGTACTCATAACCGCATCAGGTCTCCAAGGTG -AACAGCCTCTGGTCGATGGAACAATGTAGGCAAGGGAAGTCGGCAAAATGGATCCGTAACTTCGGGAAAAGGATTGGCTC -TGAGGGCTGGGCTCGGGGGTCCCAGTTCCGAACCCGTCGGCTGTCAGCGGACTGCTCGAGCTGCTTTCGCGGCGAGAGCG -GGTCGCCGCGTGCCGGCCGGGGGACGGACTGGGAACGGCTCTCTCGGGAGCTTTACCCGGGCGTCGAACAGTCAGCTCAG -AACTGGTACGGACAAGGGGAATCCGActgtttaattaaaacaaagcaTTGCGATGGTCCCTGCGGATGCTAACGCAATGT -GATTTCTGCCCAGTGCTCTGAATGTCAAAGTGAAGAAATTCAACCAAGCGCGGGTAAACGGTGGGAGTAACTATGACTCT -CTTAAGGTAGCCAAATGCCTCGTCATCTAATTAGTGACGCGCATGAATGGATTAACGAGATTCCCACTGTCCCTGTCTAC -TATCCAGCGAAACCACAGCCAAGGGAACGGGCTTGGCAGAATCAGCGGGGAAAGAAGACCCTGTTGAGCTTGACTCTAGT -CCGACTTTGTGAAATGACTTGAGAGGTGTAGGATAAGTGGGAGCTTCGGCGCAAGTGAAATACCACTACTTTTAACGTTA -TTTTACTTACTCCGTGAATCGGAGGCGGGGTACAACCCCTGTTTTTGGTCCCAAGGCTCGCTTCGGCGGGTCGATCCGGG -CGGAGGACATTGTCAGGTGGGGAGTTTGGCTGGGGCGGCACATCTGTTAAAAGATAACGCAGGTGTCCTAAGATGAGCTC -AACGAGAACAGAAATCTCGTGTGGAACAAAAGGGTAAAAGCTTGTTTGATTCTGATTTTCAGTACGAATACGAACCGTGA -AAGCGTGGCCTATCGATCCTTTAGACCTTCGGAATTTGAAGCTAGAGGTGTCAGAAAAGTTACCACAGGGATAACTGGCT -TGTGGCAGCCAAGCGTTCATAGCGACGTTGCTTTTTGATCCTTCGATGTCGGCTCTTCCTATCATTGTGAAGCAGAATTC -ACCAAGTGTTGGATTGTTCACCCACCAATAGGGAACGTGAGCTGGGTTTAGACCGTCGTGAGACAGGTTAGTTTTACCCT -ACTGATGCCCGCGTCGCGATAGTAATTCAACCTAGTACGAGAGGAACCGTTGATTCGCACAATTGGTCATCGCGCTTGGT -TGAAAAGCCAGTGGCGCGAAGCTACCGTGCGCTGGATTATGACTGAACGCCTCTAAGTCAGAATCCGGGCTAGAAGCGAC -GCATGCGCCCGCCGCCCGATTGCCGACCCTCAGTAGGAGCTTAGGCTCCCAAAGGCACGTGTCGTTGGCTAAGTCCGTTC -GGCGGAAGCGTCGTTTGGACCGCCTTGAATTATAATTACCACCGAGCGGCGGGTAGAATCCTTTGCAGACGACTTAAATA -CGCGACGGGGTATTGTAAGTGGCAGAGTGGCCTTGCTGCCACGATCCACTGAGATTCAGCCCTTTGTCGCTAAGATTCGA -CCCTCCCCTAAATcactccaaaaaaaacaatcccCAATTCTACACAAGTGTTTCTACACTAACAAAGCAACAGCTCCTTA -ACGAATTCCCAACTTTACACGAGCTCGTCTCTCGAGGTTAAATGTTATTACTTGGTAAGATTCCGGACCTCGCCAAGTGT -TTTGAAAACCCGCAACGCTCGCAAAGGTGCATAGTGAGAAGAATAAGTGAAGAGACAGACTTGTCCAAAACGCTCACGAA -GGTGCATAGTGAAAAGAGTAAGTCAAGAGACAGACTtgttcaaaaagaaacaaaagagaatgcTTGGGGTTACACTCACG -AAGGTGCATAGTGAGAAGAGTAAGTCAAGAGCAGACTTGTTCAAAAAGAACCAGAAGAGAATGCTTGGGGAGATAGAAGT -GTGAGATAGTTCTCAAGCTAAGAAAGTTGTAAAAGCTAAGAACTAGCATCAAATGATGGATGAAACACAAGGTAGTTGTT ->Chr3 -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNccctaaaccctaaaccctaaaccctaaaccctaaaccctaaaccctaaaccctaaatcca -tAAATCCCTAAAACCATAATCCTAAATCCCTTAATTCCTAAATCCCTAATACTTAGACCCTAATCTTTAGTTCCTAGACC -CTAATCTTTAGTTCCTAGACCCTAAATCCATAATCCTTAATTCCTAAATTCCTAAATCCCTAATACTAAATCTCTAAATC -CCTAGCAATTTTCAAGTTTTGCTTGATTGTTGTAGGATGGtcctttctcttgtttcttctctgtgtTGTTGAGATTAGTT -TGTTTAGGTTTGATAGCGTTGATTTTGGCCTGCGTTTGGTGACTCATATGGTTTGATTGGAGTTTGTTTCTGggttttat -ggttttggttgAAGCGACATTTTTTTGTGGAATATGgtttttgcaaaatattttgttccGGATGAGTAATATCTACGGTG -CTGCTGTGAGAATTATGCTATTGTTTTGCAGGTCCTGTTCTTAATCTTTCATCGCTTTTGTGCTTATTGTCTCCTTGTCG -TTTATGTTGAGTGGTGTTTGGGCTTTAGTCAGGTTCAGTCCAACCGTTGCTCTTCCTCCCGTTCCTAGTCTCCTCGTCTC -AACCTTTGATTCATATTGGGTTTGTTTCCTTGCTAAGAAGAAGtttcgttttatttgtttggatCGATCGACCTCTAAGT -TTACAAGGCTTTCTTCTCCctaatgttgttgtttgttgtggTTGTTAGCTGTCTCGGTTCTTCATCATTCTTGGTCTTGA -GATTGGTGATTTTTTAGAGGTTAGACTTTTCTCCTTGTCTTTGGCCTTCCTGATCTATTTTGATAGGATCGCGTTTTGAA -GGTTTCTAGTTTGACGCAATTGGACGCAGCAGTCGTCAGTCGTCGTATTCGGAAGTTTGCTCGAGGTTTCCTTAACTCAT -TTGTCTTGCGTGCCGAGTTGTGAAGCCTTGGTTCTTGGTTTCTGAGAGATCAGCTCTCATCGTGATAGGAGGAGGTAGAT -GTTATTTTTGGGTTGGCCACGGACATCCTTAGTAAATCTCAATCGCGGGTGCTTCAGAAGATTTGGTTTACTTGTGCTTT -tggtcttttgtttcttttaagatTTAAGTATGTTGCTTCTATCTCAGTTTTGGGTTTCGACCTCTTGTGTTGGTGGTTtg -aaagcttttgttttgtattactACTGTTTTTAGATTCCCTTCTATAGGGCTTAGCTTCCGGGAAAATTTCGTCTTCTGCC -GACTTTGACTCCGGAGACTTTCTTGTCGTCCGCCGActttagtttctctttttgagGATTTATATTTCACTTCGGTTCCA -ATCCAAGatcaataatataattttaaatgataaaaaaaaatcaaaaataatttcgGGTTTGTCTTGTAATCTCTCATGTT -TAAACCGGGAAACCAAATATTGGAAATAATATCCGGTTTGTCTTGTAATCTCATGTTTAAACTGGGTAACCGAATACTGG -AAATAATCATCAGAATATATAccttgctttcttctttgttttatctttgatGATTCATGATTACAAAGATGGAACAAGTA -CGAGGAAACCCAAATCTTGCAAGTTCCAACTAATTGGTTGCTtcaaagaaaatgtaagatGTTGTTTATAAAGAGATGAT -ATGGACAAGGAACAAGATTATTGAATGCAAAGCTTGTTTAGAGGTCTTGTTGGTATAAGAGGTCGCTCATGTAAGATCCA -GTGTCACTCCAAGACGATGTACTGCAGCATCTTATCTTCTTGTGTTGCGGTATATTAAACTTGGGATCTCGAGGTACCGT -CGGGTGCTTGTTCGACCTTTAAGCAACAAtggaaaacaacaacacttaGAATAGTCGATCTGATAGTCTTCGAAATGGTT -CATCAATCTATCAACAAGAAACCAGAAATTCAGGAGTTTCTATTTACCTTTTGGGAATGAATGGTCGATCAAAGTATGGC -ATTGGTTGTGCCTTAGGGACCAACTCTTTCCTCAGCCTTcgtatctcttcttcttctgctagCTGAAGAATCCATACAAG -TCTGTCATTTATTCCTACTAGTTTAcataagaagcaaaaagagtTCCCTCTAATCTATTTACCTTTTGTTGGCGttctct -ttctgttttgtatTGCTCGACTAGGTTTATTTTCTCAGTAACCTGATACAATGAGACAATGCTGGATTTTATCATACAAG -ATCCACAAAAAAGACTCTGCTTGTGTAGATTCAAAGTTGAGGTCATAACGAGAAACTGAAACATACATAAATCTCAATTA -TGTGCAAGATTTGTCTCAAATTCTGACCTGGTAATCAAATTCTGCACGTTCTACTGCTCGAATGTCGGAATGGAGCTTTA -AGTCTACTGGTATCGTGATATCTTTCACATGAGGCTTAACCAGATtctgaaaacagagagaaacattaaaatcatCTGCT -TATGTTCCATTctatattctatatttttgaAGTGAATTTCTCCGAGAGtcatatatcaaaatcaaacagtTATATAAATG -ATCTGGTATGATAGTATGTTAATGAAGAGGAAAGGGTTCTTCAGCTCACCTCAGGTTCATCAGTTGTCCAGGGAAGACCT -TGAGCTATGGGGATTctcttttttgctttctccAACGTCATCTCGTGTAGCTTCTTtgcaaactcttcttctttcattcg -TCCCCGTTCCTACGTAGACATTAGACCAACAATCATAAATCTATTCTACAACATCTGAAAAATGTTTTCCTGTAAAGTTT -ATACCTCAGTTCTGAGTTTAAATGGCTTCAGAGAAGTGACTTTGATCTGCTTCTTCGTTGATCTTCTACTTCCCATTGAA -GCAGAGGATTCGAAGCTCTGTTACAAAAAAGAATGTCAAACTACATCAACCAGGAGAGATTGCGCAAAATCAGATTCTGC -ATATATCAATCCAATACACATACATTTCTTCTGCCCCTCCGGCCACCATTTGAGTTGAGACTTGAAACACTGTAACCCAC -CAAATCAGACATTAGAACTGAGTCTACGAAAGATCAACGGCTAATAATTGAGTaccgaaaacaaaaactcttttttggCT -ACCTATTGTCCCATGATGAAGAAACTGAGGCATGAGGTTGTTCTAGTCCTAGATTCGTAGCTGTTAAGATCAAACCAGAT -GATGGATAGAATGAAGAACTCCAAGTGAATTGATCTGTCTCAGATTCTGAACACTTAGGCTGGCTCATTCCAGGCAATTC -CCATTTCAAAGGTTGCTTAatctgatcttcttcttccttagaaGTTACCTTCGAAAGTGGGAAGCAAGTAAGCTTCTCAA -AAGCTTTAACTAGATGCATCACTTTACCAAATTCAGGTATACTCATTCTCGCTTCTTCCAatactttttctcttctcctc -ttcatCAAAGAAACCCTAGTTTCATCAGAATCTCCAAATTCGACTTGTTCATTTCCATCCTCCAAATTCTGGCTGGATTC -TCCAATTTCTGATACGGATTCTCTTCGATTGTTGAAGAACTCTTCCTGTGACGCCCGTAGAGTTTCGTATGCTATACAGA -CACATTTCTTCATATTGGAAATGGTCTTAGCTCCACATTTGCAATCCACAGACGCGGAAtcattcttctccttccttgaa -ttcttcttcaccaccacGAACCTCCTCTCTCTGATCCGATTCCGTGGTGAGAAAACCGCCGGAACAGGATTAGGCTTCCA -TTTCGGATTCTTCTGCGCAGAAGATTTACTCGATTTCTCGAGTGGAGTCGAGTGTGAGACGAAGTTAGGGTTAGAATTCT -CGGAGAATCGTGAAACCTCTTGAGCCTTGGATTGAAAACTGATCGGATCCATCACCAGAGTCTCGTGTTTAGCATTCTTC -AAATTCGTCGACTCCATCGAAAGATGAGAGCAGAAAAATGtgagaaattagggttttgtcttTTCGAGTGAGtgaaggga -agaagaagaagagagagggagaggaGGGAATTGTCTGACCGTTGCGACTTGTGAGGAAGCTCTCGACTTTGTATGTAACG -GCTCGCTCAGTCATTTACTGGATTTTCGTAATTACTACGATTAATTgcttaatttcaaaaaaaattagtttaatgCTGGA -ATCTAATATGTTTGTTTGGGCTGGCCCAAACCCAATTGTTAAACTGATCTGAAATGATTGTTATACAAAAAAACCGGTTC -GTGAACCGCATTGTCTCATCGATGTTCAATACTGTTTCCAACAAAAAGATTGTTGTCCTCGAGTTCGCCTTCAAGAAAGA -CACGAGAGAGACTCCAGCCATTGACGTCTGCAAAGGTTTGTTAGGAGACAAGGCCCGAATCAGCATCTATGATCCACAAG -TCACGGAAGAACAAATCCAAAGAGACTTAACCATGAACACATTCGACTGGGACCATCCACTTCACCTCCAACCCATGAGT -CCAACCACTGTGAAACAAGTCTCAGTTGCTTGGGACGCTTACGCTGCCACCAAAGACGCCCACGGAATCTGCTTGTTAAC -CGAGTGGGACGAGTATAAGACGCTTGACTATGAGCGGATTTTTGAAAACATGCAGAAACCAGCGTTTGTCTTCGATGGCA -GAAATGTTTTTGATGCAGAGAAGCTGAGGAAGATAGggtttattgtttactctattgGTAAGCCGTTGGACCAGTGGCAC -ATGCCTGCTCTTGCTTAGCTCAGACTCTTTGCCCTTTCTCAAGATTTGgattgtttttctctctgttgcttatatcaaat -aatttgttctgtttcttcttgaCGAGATATTTTCCTATACTTATTATGTTGGTTAGAACAAGAGACTAGGTTTGGTTATT -ATTGCTAActacattttcatatataaagcTTTTAGTGATTCTGATTACTGATTATCgtggaaaataaaagagatgaTTAA -TTTCCAATATTTGTTATAATTCTCACCGTTCACGTGTCCCCTCGACATCgcatatataacaaaactgCCCTTGATTCCgg -caaagagaaagagagaatatgATGATGCTAAGGCAAACGTCGAGAAAGGCTTACCTAGGGTTACAGGCGTCTCCTCTAGG -GTTAGGTCGTCGATTATACCACGAGAATGTAATCGACCActttgaaaaccctagaaacgTTGGCTCCTTCAACAGGAATG -ACCCTAACGTTGGCACGGGATTGGTAGGAGCTCCTGCCTGCGGAGACCTCATGAGCCTCCAGATTAAGGTCGATGATTCA -GGTCAGATCATTGATACTCGATTCAAGACCTTTGGCTGTGGCTCCGCTATCGCCTCATCTTCCGTTGGTATGCCTTCGAA -TCagggttttcaattttgatcGATTCGTTAAGAGGCTCATGATCAGAGTCAGGTAGATGTAGACAGgttataatttgtat -atttgtttggttcaGCTTCTGAATGGATCAAGGGCAAAACCTTAGACGAAGTTATGACCATCAAGAACGCGTAAGTGCCT -TTTAACCATCAAAATCATGTCTCTTAGATATATCGTCAGGATTGTTATCTCTAACTCTGTTCTAGTGCTTGGAATATCCC -AAATCTAGTGATATGGTTAACATTTTGATGAATGAGTCATTGTTTTGGGATTCTTAAATTTGCAGGGAAATCGCTAAGCA -TCTTAGGTTGCCACCGGTAAAGCTACATTGCAGTATGCTTGCAGAGGACGCTATCAAGTCCGCGGTCAGAGACTACAAGG -AGaagcaagcaaagactaaTGCTGCTGCTGCAGAAGAAACCGTCAAGGCCTGATGATTCCACTTATACCGCATTGTGCTG -CTGCTGATGATGAATTACACAAACTTACAAAGAGAGGTgtgtttggttgttttagtttttctcttcttttcaaatgTTTA -TTTAAGTGCTTTGAATAAAAATAGCTGAGCATGTGACCCAGATCCCAAGTTTTTTCTGCATTGTGATGATTCCTCTTCAA -TGTCTTATGGAATAATTTGTTGCTGTGATATTGataattttgatcatttgATGTTAGACATAGCTGTGAGATTATAATGA -CACAAGCTTCAGCCTGAACATTCACAAAATAAGATCAAGTCACCAAATAAGGGCCTTAACAAATGAAAAGCCCAAAGCCT -TGCCACAGCAGTCACCATTTGTCACGTCGAACCTTCTAACTGAAACAAAAGTTCTCCTCCACTTCTTATAGGCAAAGCAA -TTTACGAAAGTGCCCCTTTCTTCTTCCGTAGCTGCTCTCACTTCTCTCAGTGCTTATTGATCTCTCTGTTTCCACTTTCT -CTCTTGCTCGCTCTCACTCTCTACCTCTCTTCTCATTTTCCCAGAGAACTacgaaaaaccaaaaatttcctttgttttct -tcttaatccGATTGATTCAGAGCATTACGTATCACTCTTGCTCAACAGTTATTGCTCAGTCTCCGGCGATTTCTTTTGCG -TTTTCTCGAGAAAAGTAACGGAAGATCGATTCTTTCAACTATTTCTACCCTCATACTCTTCGCCAATCATCTCGTCTTCC -AACAAGCTTCGTTTTAATGGAAGAACAACAAGAATTTGAGAAACCCATCTTCGAATTCCGTCCTAAGAAGCTCAGAACCT -CTCGAGTTTCGAGAAATCTCATGAAGAAGACTGGCTTCAGAGAATCTATGAATCATTACGAAGAGCTCTCTTGCAACTAC -GGATTGAGGGAAAACCCGAAGAAAACCCAGAAATCTTTACTCGATCATCGATTCTGtacgaggaggaggagaaataAAAA -GATCCTGATTCGATGCAAAGAATGCGGGAAAGGGTTTCTTTACGAGAAATGTCTGTTTAATCATCTCCAAGTGACGCATT -CTGAAGAATCTACAAGAAGAAGCCTGTTTTGTAGGTTTAGTATTGTGCAGAGGAGAAAAAGATCGAAGAGAGTTTCCAGG -TACAAGAAGATTCTTCCtcgattctctgtttcttcttcttcgtgtaCTATGTTTCCTGTTTCTGTGGATGATGGAGGATT -ATTAGAAGTCGCTGAGTCTCTGATTCTCTTGTCCATGAGTGGTGGAAAGTTCGTGAATGGTTTGGAACATTTTGGTAAAG -CTCTGGGTTCGACTCAGAGAAAATTTGAAGACGGGTTATTGAGAAATGAGCAGAGACTTGTTGGTGAAGCTCTGGATTCG -AATCCAGAGGTGAATTTGAGAAAAGATGGAGACTTTGAATATGGGCTTTTGAGTAATGAGCAGAAGAAACTTGTGGGGAT -AAGCAGAGCATCTGTTGGAACATCGAAAGAGCTTTCGGGTTACTTGGCAAACAAGAAGGgcagagaagatgatgaattgg -GTCAGCAGAAACAGGCTGGAGCAAGAATACTTAGAGAAGAAACTGATAACGAACAGAAACTTGTTCGTCAAGAAACTGCA -TTTGAAGATTCAGTATCAGGATTTGAGATGAATATAGAGCATCGGTGTGGGCTCTGTCACAAGGTTTTCTCGACTTATCA -AACTCTTGGTGGTCATCAGACGTTCCATAGAATgagaaacaaatccaaaagtCAAACCAAGAGATGCAGAGAAGAATCGA -TAGAAGCTGAAGCTGGGATTAATAATGGTTCAGTGACGTTGACAATAAGTGCAGAGTTTGCTGAAGGCTGTTTAGGTCAG -TACATGCTTTAAGAGGTTACAAGAAGTGTCACCACACGAGAGCAAATGATGGAGAGACCTTTAGATTCCATGTGGATGTT -TCTATGGTTACTAGTGGAATATTTGAGCAGGAgtactgaagaagaagatccccTCTAATGAATAATGaagttttggaatt -tttgttgttgttgttgtctaaTGGAGTTGTGACTTGTTGTATTTTCATACGTAGAGAGGTTTCGTCTTTGGTTTTCTCAA -ATGGTTTGGTATTCAAAGTTGTACAGCAACTTGTAGCTGTGTTATGGTTTTAGCATTAATCGttctttcaaatctttttc -ccTTAAGTTTGTGCATTTTGAATGTGTTACTAATATTTTGaattacaacaaaatcttgaggaGCCGAATACAATCATAAA -CAAATCAGATGATAAAAACTCGTAAATCGTTTCTAAATTGTATTCAACTATACAATATATTGGTAATGATATTGCAACTT -TAAGTTGAGAGATCATACTGGAAAAAGTAcagtatctttttttttttttttttttttgaccgTATCATATCGTGTCGGTT -GGTCTTCgcattaaaattaaaacttttcaaaattagTATGACGAATATTCATTATAAATGAAACTAAATACACATTCCTT -TCTTGCGTATATTAAATGACTACGACAGAAAGATAATCGTACGATAGTTTTCAGAAATATTTGTGAGGTGTTGAAATAAT -ATTAGAGTTTCCTAATTGtatacttttcttcttctttttgcagCCACTTATTTCTATTTATGTAAAGAAAACAGctgtta -agaaaatattttacgtcgataagaaacaaaacaaaaacacttatTTCAAGTTTAATTATAGGAATATCAGATCCATCAGA -ATTCTGAAAAATTTGCACGTTATTAGTCTATCTATATTTTCTCAAACTTTCTATCAAAATTagataattgtttttggaaa -gaaaaagagcaaaaCTATTCGATTGGGCATGAAAGTCGGAAAGAATCTATAATTAGCAATatacaaaaaccctaaactca -aGGTCAAGACACCAATCTCAAACACGGTTTTATCAttagaattaaaattttgattcccATTTATAATTGAGATCTTTTAT -taattacgttttttttttcttttcttttttcggcTGTGCGTGCATTAGTTGTTTAGATCCACCGGCGAAATCacttaagg -aaaaaaaaggcttgatttttcttcttctcctctcatcttttttgtcttcttcttcttctttgacaaGCTCATTGCTTTGT -CTTTGATCCTGCTTGTATCACGAATTCGGAGGACAACCCATTTCGATTCTCGTATCGAATTTCTTGAATCAAAGAGACGG -CGGGAATCTCAAATTCAGAATTTTGCTGGGTTGTCGTAAATCCAAATGCGGTCTGAGAGAAGACTACAAATTATAAGAAG -AGCGAATCGGAGTCTAACATCATCGGATTTGGGAGCTACGACTAGATCGAGAATCGAAAAGCAATCATcgagatcggaga -agaagaggaatcgCGTAGGGAGGTGATGTTGTTTGGTTGGGGATTGGgtggaattagggttttattggATTCGATTGATC -TGAATACAACAGCGGGGCTGCACGAACAAGGATGCAGCTTCACATATCGCCTAGCATGAGAAGCATTACGATATCGAGCA -GCAATGAGTTTATTGATTTGATGAAGATCAAAGTCGCAGCTCGTCACATCTCTTACCGAACTCTCTTCCACACTATCTTA -ATCCTCGCTTTCTTGttaccttttgttttcatccTAACCGCTGTTGTTACCCTTGAAGGTGTCAACAAGTGCTCCTCTTT -TGGTAACccctcttttcttctccttcaatcATTCTAGTTTCATTCTAGTTTTGTTGATGTGCACTTGTTTCCGTCGGATC -TACCACCTAAATGTTGTTTGCTCAGCTACGTATTTTGCATCTTGTTAAGTTGTTTGGATCCAATGTTGAAGTCAACAAAG -TTTCGgcatttgaatttttcttatttggtaTCCATGAATATGTATCAGTTGAGTTACAATTGTATCATAGTATGAAGCTT -CGAGCTCAGATTTCATGGCAAAATGGCATTTTGTTCAACTATCAAGTTAAGGTTTTGAGAATTCCattgttgtgtttgtg -tgaACTAAAAATTACAGATTTGTATCAGTATTACTAGATCAGAACCAAATACTGATGAGATGAATCTTAGAGTTGttcct ->Chr4 -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNGGACAGCGGAATCCTCGACCCGGTTGAGGAATGGTCGACG -AAAATCTATCGGGTTCGAGGATTCGTCGACCAGGTGTTGGAATCGTCGACCGAGTCTGAGAATTCGTAGACCAGGACGGC -GGAATCCTCGACAATGACGAGGTATGGTCGAGGAAAATCTATCGGGTTCGAGGATTCGTCTACCAGGTGATGGAATCCTC -GACCAGGACAAAGAATTCGTCGACCAGGGGTGGAATTGTTGTTATTCCGATCATGAGAGCGGATATCAGTACAGATCCGA -CGCTGGTGAAAAAGATCACGGCGATCGTGGATAGTATCAAGCCACCGAGAGTCTCGTATTCGGAGAAAGATCGGCCGATG -AGGATAAGAGGTCGATCGGATGGACGGAAGAGGTAGAGGAAGAGCCATGAAGCGGCGAGGCATAGGAGGAGGATGAGCGA -GAATGGGTGGGCGGGAAGAGAGAAACTGATGATCAGAGCGATGATGCAGACGTAATTCACCCTGAAATAAGAGGAGTTCT -TCCAGAATCGCGTCATGGCCTCGAAGACAGAGTCAAGCTTGGTGAAAAGCAGATCGTTCGAGGAGCTCTGACCACGGCCG -GCTACGAGATAGACCACCACGAACCGTCTTGGTCACACTGTTGACAAATGCATGGACGGTTGGAGGTTGTGATTCCACCA -CATCAGTTACAATCGGAGGCTGATCCGGACTTGGCTGTTGCGGTGGTGGAAATCGGAAGCACAGGGGGATTTGTGGACAC -CATTCGATTTTGTTCTTTAGGGATTTCAAGATTGGAAAATTTTAGGAGACGATTGATTTGGAAGTCGGTGAAGTTTCGGT -AGTgttatgtatttattttttttgtcataagcGGTAGCGTTATGTATTTGTAAGATCACATTAAGCGTCTTTCAACTTTG -ATTATACGCATTGCTTCATCTGATATCTAATCCATATTTTGATCAAAGTGacatttgataaaataaaataaaactaacct -attaatattataactgaggttatttttttagaaaaaagatAGCTAGCTACACGAATTATACGAGAATACATGGTCACATG -CCAAGTATATTATTGTATCCTTAACTACACGAAATTTATGTATTGCATGGCCACATATATGAACTATACTACGTCATGTG -GCTAACATCATAGACATATAATTCCGGTATATCGACTGGTTGACTCTGGCTTTGACTAACATTGACCGGcgttgaccaac -aaaaaatttcagaaaaaaactttaaaatagtttttaatattaaaaaataagaaactgtttttaggttttgtataagaaaa -aaaattctattttcAGCATAGAtagatttgtatttttatccattaaattttataataattagtaaaaagtcattattaaa -ttttaaaatattaaaatggaaaaatattatttgaacaATTAAGTAGGAAATTGCTTAAATTTATATTGTCAATTAAAAAA -CCTTAATTTCtatactatttttattattattttgtatttctcaACCACAAAAATTATTAGAAGAAAACGTAATACGTAtg -aattctatttttataaaaaaatttgctgaaataaaaatgttagatcaaacaacaaaatttgtgCCTTTCTGGTTAATGTG -GAGAATATGGAAGAGTAGGAATGATCTTGTATTCAACCGGAAAAGGACTGATTTCTATACTACAGTAGAATCCGCTCTCA -CTGACACGAAAGAATGGCTGGGTAATATACCAAcgaaagaagatgatcaaggAAATGCATTGTCGCCTACGAAGAGACAC -ACTAAGTGGagccccccccccccccccccccaaaaGTGATTGGCTAAAGTGCAATTATGATGCTTCTCACCATACGGGGA -ATACAATGTCTGGACTAGGGTGGCTTATCCGCAACTCTCATGGCACGGTTTTGGAATGCGGTATGGGGTAGTTTCAAGGT -CGAATGACTCCAGAAGAAGTTGAATGCTCGACACTTATCTGGGCTATTCAAGCCGCTAGGGCCTATGGGTATACAAAGGT -GATCTTTGAAGGTGataacataaatattaatCGACTAATTAACCAGAAGTCTCCAAATCCCCGACTACAACACTATCTTG -ATATCATATACAGTTGGATCCCAACTTTTACATCAGTAAAGTTCACCTTCAAGCATCGGGAACAAAATGCACGTGCGGAT -CTTTTAGCTAAGAAAGCTATTTCAGCGGATACTCATTGGTCTCTGTTTCACTCATGTccatattttctttatcatcttGT -AAACAACGATATCTCTTAAAGTTCTAATAAAGTttttagaaggaaaaaaaaatgttagattttttttctttttataaaat -aaaaggaaaaattgcaagttttttgttttattatatttttaatttagttttgaaattgagaaaaatatatttatattgta -tataaaatatttttttattatacagcaggaaaaaataattcttattttttaataataaaaataatttttaagattttttt -gaattttttgttggtcaaagCCGGAATCAACTACTCAGTTTACCGAAATTGTATGTCTATGGTGTTAACCACATAACATC -GTATAGTTCATATATGTGGTCATGCAATACATCTACTTTGTGTAGCTGAAGATACAATAATATAGTTAGGCAAAGTGCAT -TTCACCATTACTGTTCCGGTCATAGGAAGTTTCcctgatagaaaaaaaaaataacacaatgTTGCTCTTTCATAAGGAGT -TGTAGACTTGACAATGTcaaatccttttttctttgataacaTTCATCTTCGAATTCTAAACATAATTATATCTAACGAGT -AGACAAAAACTACATAACCATTGTTTCCCCTGATAAGTTGTAGCATCATATATAGCATAAATGTTATTTCTTAATGCAAC -TTCATCAAACCTTTAGATATGTTTACAACACAAAATAATTCAAAGTTACTTGATCAATGAGAGTAGATCATACatttcaa -atttcagaaaTTGATGTAGCAAAATGGGCTTTAATAGATACAATCAGCAGAGGGTTAGATAActtataaacaaaacttaa -gaGAAGAGGTGGGGTATGATTTATCTTCAGCATGAAGGTGATTTACAAGCACCGATTATAGATAAGACTCTTTGCCGAAG -TTCATGAATGACCTGAAAATTGAGCAAACCAAGAAGGCTTAATACAAAAGACCAATCTTTTTGAACCGAATAATTATAGA -AAGAGGAAGTCGACGAGAACGAACGGATTTGGAAGAAGAGAGCTTAGCCCATGTTTGGATATGGGCACTGCTGGTTTTGA -GGTGAGAAGAGTAGGCAGCTTCTGCGTTTATGAAGTAGACTGAGTTCTCTGCTGCCTCAGCAACCCAAATTTCGTTTGTC -ACATCCTTTGCTCTTTTAATTAGATTGCAAAATCCGACCTGCCAAAAATTAAGACCCATAACAAgcatatatttttcaaa -atttaatctcTTGGTGCATATTCTCTCTGTGTAAAACTAGACAAAGATTAGAATTTGTACATACCACGGATCCAACCAAA -TTATGGCTGATGTGGGAAACAGAGCTATCATCCATGAATGAGGTGCTGAAGCTTATAGCAAGAAGACTGTTTGAGATTTC -CCCTGAATGTTGTGCGGATCCATCTGTCACAAACACCCACTGCTTCTTTTGTAGAACATCCGTGTATGCATTTCCAACAT -ATACAACGTACGCAGCGATATCAAATTCACTGAAGGACATAATTAGAGATGACAGGGTATAGATTAGCAAAGTGCGGTAA -AGAGTGTTTCATAAAAAGCTTGGACTACTGAGATTAACCTTGAAAGAGGAATTTCACCAAGATTTGACAAAGAGATTGGT -TTACGAGGGTTGAAAAAGGGCCTGAAAACATCATCAGGGAAATTGAACAAATTAATGAGATAGATTCCAGTGTGTCTACT -AAAGAAAACCACTTactgaaaattttcagaatcTTTAGGAGACAAAGGCTGCCATCTTGAGCTTGACCCTCTCGCATGTA -AGTAAAGTATTTCTGAATCTGAGTTTATTGGTACTAGCCCTTTCATCATGTATATTTTCCCCTCTGTCAGCTCGGTTCTC -TGTCACAGTAGTAGACAATGATAACTGTTTTAAGaatctacaagaaaaaagttgaacaAGCTAATCGATGATGCTCTTAA -TGCAACAGTACAGTGATGGTAACGATTCTTTGATATGCATTTCAGTCCATTCGAGGTCCACAGCAACTCTGAAAAGCTTA -TATTTGGAACTCCCCGTTCCATATAAGCTCATATGGATAAGGTCCGTGTAAACTTATTAGCCATTAGAAAAATGCCTTGT -TTTAAATTGTGCATGAAACATTCAGATTTAGGCATTTGAATGTACCTGTCTCTCCGTGGGATCCCAGATTGTTACAATGC -CTTCTTTTGGATTGTGCTCTCCTTCATAACTTAAGCTCGTCAGGCCAACAAGCCTAATCCTCATGAACGGGGTGACGTTC -CTTTCACCTAAACCAGCGTCTTCCAGAGTTTCTGCCACTGATTTTTCCTTCCGCATTTGCTGGGCTGCCTGAGGTTCAGA -TTGAAGCAGTTAATTACTGTAATCAATATatcaagaaaaggaaattactATTCTACCTCAAATTTTGCTTTATATGTAGT -GAAAGATCTCAACTGCTCTGGGCTCATTTCTGCCATAAGAAATTCAGGTTCAGCAGCCGTCTCTAACAGCTTAAAGATCT -TGGCTCCTTCTTCGCTGTCAGTGTCGTTCTGGCTGTGAACACCATTAATTCCTCTCTGGTACTCACACATAATACCCTCA -ACAAGAGCTGAGCGCCTACggaaaatagaaagaaaaaaaaaaggcaagtATGAATGAGAATAAACCATGACGAACTGCAA -TCTTTGGCTCTTTTGTTGGGAAAACCATCCATAATCAGAAGGCCAGAAGCTTTTCtaataaatacaaagattgtcttttc -taataaaaaattcGAGATTAGCACTCaacatttaattatatgttAGCAAATAGTATAACATTAGCTAGCAAACTTATAAA -CGATaaatttgaccaaaacaacATAAACCAAGGTCACTTTATCTACTTTTTGTTCTCTGAATTCTGAAAACGAATTTGAA -TATCGTATTCTAACAGTGAATATTGcatttatactaaaatttacGATCATAGCCATAAATAAGTAGTTATGTATAGTCAA -ACTATATGTAGTTATGCAGTACTTTAAGACGTTTGAACCGCTAAGATTCCCATAATCTGCATGATAATATAATGTATGTA -AACTGATACATGCACAATTGCACAtgataaatataactaaattgATACATGCCGATTTGCGcatgataattataattata -tgctCTATAACATGTTAGgatttaaaatgaaaagagcAAATGGTTCAAGGCTGCAACTTGGTGACGCCACCAAATTGTTG -TATGTAACAAAATGTCTCTAGCTTTGATGAGTTAATCTGACACTTCTTAGAAAGAGATGCATGTGCTAAATTGATCACAT -CAATGTTACTAAAAATTGCTCTCTACAGTTATAAGGAAACTTGCCTCTGATTATGCAGCTGTATAATTCTACTTTCTATT -CTCTCTGATCGAACTATTGACTTCTTTTCACCTAACCTGTATacatcaagaaaatataatgcTTTGCGAGAAGTATAAAG -AAGACCAAAATGCATTAACAGGCACACATTTATATTGACCTTTCCTTGTATAGGATGGGGTATATTCGTTTGATGCCAGC -TAGCGTTTTAGGCACTGGACCCCCATTGCACTTGATACAATTTAAAGCCAGAGGGACACCAATTTCTTTACCTTGAGGAA -GGAAGAGATTATAAACGATCAATGGAAAGATAACAATATGAAAGCAATAAGAACTCAGATGATGTAGTGAGGCCCACAGC -ATAAAGCTACTTACAGAAGCCTAGTCGGTCCGCCCAGTGAGCTCTGTATGTCCCATTAATattcaacaacaaacagaTTG -TACTTGAAATCACTGCCTGAAAGTTTGGTTGAATGAAACTCTTATGAACAAACCAACCTGAGAAGATATCagaaaatctt -ataaaatgcAAAGTCTAGGAAACCTCAAGTGGTGATGTTGGGGTAGCCCAGCCAGAAAGTCCTGCCCCGAGGATCTTCAG -ATAAGAGATAAGAACGTAAGCATGCTGCAAGTCAGTGATCTAACCAAAATCTGTGTTGCAAAACAAAGTATATCTTGCAT -GAAAATAACTTACTCGAAGCTTCTGCCCGACAAACAATTTGCCAGCATTCAGCTGCTTTGTTAGTACGACATCCAGAGCA -GCATTCATCGAGTACctgtgatttttttaaaaaaaatcatatggaAATGAGTCAAGAAAACAGGTAACAGAATAGCAGTA -GCAATTTCATACCACCCATCAGTGAGTTCTACTTTCACATTGCTGCAACTATCAGAACAATGTGCTTCCTGAGAATCATT -ATCGGTCTTTGGATTAATAGCTGATATGCAGAGCACCATCATTGAAGAAGCTGGAGCATCACCACTCAGAATCCTCTTGA -TTGCAGAGCAATGACCATGATTGACCTCTCTCTCATATCTATTAAGAAAGATTAACCATGTTAGACTTTGCATGAGTTTA -AGTAACGAGTTGTGTTGTGAGACTGGGAAACCTGTATTTTAGTTCCTCAAGAACATTGGTGATTGTCAGAAAGTTTCCTC -TGCATTTGGCTGGGTAGTATATGTCGTAGCATGCAAGTTTCCAGACTATCCACCTATAGTGATTAGTGACCCACCTAGTG -CATACGTAGTGATGGATAAGTTAATAGATATAGACATCAATACTCACTGTCTATCTAATAGAGTGACAATCACATGCAAG -CTTCAAAAGAACGGTCACACACTTTTTCtgatataataaacaaataacacGGTTAACATTTCAAGGGACAGAGAAAGTAC -TTTCTGGATGCATGTTGTAAGGAAGCACCAGACTCAGCCAACATTTGAAGAAAAGTTTCAGCTCCAACCTTGTTTGAAGA -AGACTCATCACAGAATACATATTTATCTGCATTACTTGATTTGATTCTTCTGACATGGTCTGGCACATAATCCATCTAAA -AACCACCTCGTAAGTGTGTTTGAgtgaatgaagaaaaaagctaTGTAACGCAGGAACAGTTGAAAGGGACAAAAAGAATT -TACCCTGGTCGTAGCTGTTGGATGCATTCCAAAAAAGTCCTTGATATATACTCTTGGAGACTTTTCTGGATACCTTGTAG -AAAGCACCTTTTTGGAAGTAAGTGTATCACACGATACAACAGACAAACCTGATAATAGACAGGACACCAAAACTATAAAC -CTGAGAACCAACCAATTAgattaacataaaaaattcttaaaaaaattaatcatatatattaccaCTTGAAGCTTGCAGAG -CATGTTTCTTTGAAGGAGTTTTAAAGGATGAAATCCTTGGCCTTTTGAAAGGAGAAACGGAGACTGTCTTTCCCAGCCTT -TTCTTTTGGGTACTGTCTTGTTTATTGTATGCATAAGCTGTATCTCTGCGATTTGTTATATCAACAAGTGGCTGATCAGC -AGGCCTTCCAGGTTGCCTACCTCTTGGAATGAAACCGTTTACCTTGGAATTATTCACTGCCATATCTGATGCCAAAGACC -TGTTATTTGATAGTCCATGTGTAGCATTCAGAGCACAATCGGTCTCATCAACAGCCGCATCAAATTTCTTGATCAAATTA -CCCCCTGAAGCTAGGTTCTCCAAGTTGACTGAACTAAATTGCTTTGAAGATGACCAAAGAGGAGATACAAAACTATTTGG -CGTATGTTTGTTGCTTGTCTTTTCTTCATGAGCAATATAACCTCTGTTGGCACTTCCATTGTTTATAGCAATATCACTTA -acctttcatctttctctggTGTAAAAAATTGATCACCTCCAGCTACATCATCAAAGAAAGACCCTAATTCAGGGTCACCA -AGAAGGTTTCTGGCACGTTTTAACGCCTCAGCTGACACTGACAATGATTTTCCACCAGCAGTCTGAAACTTTGTTGGAGG -CACCTTTAAAGATGGATTTAAGACTTCAGATCTCTTCCCAGATACATAATCCTCATATTGTCCTGGAGTTCCTGAATGAT -GCTTAACTACTGTAGCATCAAACTCCTCATGAGTTTTTAATCCGGACCACCCATGTTGCtgggaggaagaagacgactGG -TTCACATGGTTAAATCCAttcaaatcatcttcttctagtCCTAACAATGCCTTGGCCCTTGCTAAACCGGCAGAAGATAC -ATTAACCTTTTTGTTGGAAGCTGTCTGAAAAAGACTGTTGGAAACTCCAAATCCACTCTCCCTGGGAAGAACGTTGTCTA -CACAATCAAAAAGAATCTTATTAACAAATAAACTATGAAAAAATGTCACTTCTAATATTCATCCTCTAAACGAAGTAAGA -TGTGTGTTGATTAGTTCTTCACTATTCATCATTTCATCTGATAACAACCAAACTCAAGAACCTGGAAGTTGAACGGAGTA -GCAGCACAAAGAACAAGTTCATATGTAAACGCGCACACAGCTATACTGGAAATAAGACTTTAAAAAAGAGGAGATAAGAA -CACACCTGAGTCAATAATCTTATCACTTCCTAGAATAGACATAGCTTTGGCAATTGAAGACTCTTTCAAAGGGACAGATT -TCCCCGAGGCCGTCCTGAACATTGGCAAAGTTTCAGCTGTATCCACTTGTCTCATTTGGGGAATTGAGCAATTTGTGTTC -CGCAAATCTAAAGTGTAGCCAAGAACATGGAACATTCAAAAGATTTTCAGGAAACCATTTTCACCAACATTAAGTAACAA -TTCAAGGGAATTCAGAAACAAATGACTAGTCAAGGGAATTCAATACTGTCACATAAAGTACCTGAGTAAGTAACCTTCTC ->Chr5 -TATACCATGTACCCTCAAccttaaaaccctaaaacctatactataaatctttaaaacctaTACTCTAAACCATAGGGTTT -GTGAGTTTGCATAAAGTGTCACGTATAAGTGTTTCTAACATGTGAGTTTGCATAAGAGTCTCGACTATGTGTTTGTTCAA -AAGTGACGTAAGTGTTTAGACTAGAGCCGGCCGTGAGCACAAGCGGGCCAAGCCCATGCTTGCGGCAGATTATCctataa -ttatgttttgcggctttacaattttgaatttgttttgttgtttagtgGTCGAGTCAGGGATGAGTTTGTTCTCAAACATC -TCAAATTTCTAATCTTCCAAGTGTTAGGTTCACTCtaccttattttttttttttttttttattttaaatttctattagAA -AGAACTTGAACCTTATTTCAAGTGAACATTAAAAAGAATTGTAACCCTACCTTATTTCTATTATTATGAATATGTGtaaa -gtaaatttttttacaataaGCATGTATAAAgtaacatatttttgttcttttcttatagCCTTGTAAATCATAGGGACGGA -TCTAGTTTAGAATAAAGTGTTGCATAAGTTCTTCGACTAACATGTGAGTCCATTTTTGTGAGTTTTGCATAACTTTTGCG -CCTTCgacaatttgaattttatgcATAAGTGCTTtgactaatttatatgttttgtctaAGTGATTCGACATTTCGACTAA -GTGATGTGAATTGTGTCATTCGTCGTCGTTGTCGCATCCGGAAGCGTGTTTGTGGTTCTTGTGTCTTACTTGCCGGGTTA -TGAAGTCCTTTGTTTCGAGAGATCTGCTCTCATCATGATAGAAGATGGTAGATGTTATCTTTGGATTGCCGCGGGTTGAA -TTGTCGCGGGCATCCTTCTTAAATCTCATTCACATGTTCTTTTGaggaagagttttttttgttttttatttatttattgt -ttccCTTAAGATTTATACTTTATTCCTTCTATTTTTTGAGGACTTTTATTTTGTCTGTTGGCTTTAGTTTTCCTTGTTTG -gacatttgtatttttgcGTCTTGTAACAACTATCCTTGTGAAAATATCAATATAAGAACAACCCTCCTCATTTTAATTCC -TTCTTGTCTACttagtttaatattttccAGCCGCAATGGGCCCATTAGCATCAACACCGGCCTATTTAGACGGCCCGTTA -TCTCCTCTTTGCCAATTTTCACCTTCTGCAATGatattgaaattgaagtaaatgCAAACAAAATAGTATGTTCCTGGTAG -CAGATATTTAAGTTCCATTGATGTATTTCAAAGGGTTCAGAGTTTTATCGTTTTACAAAGAAATGATGAGTGTTCATGAC -TGTAAAATCCACCTTCATCTTCCACTTTCAGTTTAACGGCTCCGGCTCTGGATCCGGCTCCACTACTGGTGCTATGCAAT -CCACCTTATATCGAAGAGTCTTTCACAGAGGAAAAGAAACGGCCCAATGCAAAGATCCAAATTAATGAACGCAATGGAAA -AATGGGTTACTGATTTACTCCGTCTACCCCAAAATGTAAATATCGCCCTACCTTTTTGAAGAAAGTTGAATATGAATTAT -CCCAAACAAGTTTGTAGTTTCCAGCCATTAGCGTAGAGAAGTTGCCCTGCAGGTATAACCACAGTGGATCCCCAAAACGA -TTACCttcataacaacaacaaaaaataccCAAAAGCTTCCCCACAAATGCACATGGGCACTGACCTGGTCAGCTTCATAC -CGACGGTAAGGTAATATCAGCTGAAATACGAAAAATTCATGATCAACCCTCAGAAATACACTATCTGGATGAATATTTGA -TAGAGTACGAGATTATATATACTATGCGAAAGTAAAGTTTAACCAGAGTTTGGAAATTAATGAGCAGACTCACAGTCTTT -TCCCCTGAAGCATTTATGTACTCCACGCTAAATCCGATATCCTGGTAAAAGACAACAGAAATATAAACGGAGGACAAACA -ACAGAAGCTGAGAACCTAACTTAGATCCCGTATCATGTCAAGAAATAACCATTCTTGTCCTTTTACATAAAAGATTCATC -ACAGACCAAGATAACGCTGTATACTATGtatgaaaacaaagataacCAGAGTCTGGCAAAAATAGCAAAAGatacaacaa -taaaaatctaatatacGGCAGCTAGAGAGAGTGTGATGTTCTCGACATGCAATCCAGAGACCAAAAACTAAGTTTCATGA -ATTCTTGAACTCTACTCATAAGAGAACAAACTAGACACCCCTGTGAAGAGGGAAAGAACCCCAATACCATGCTTGGGAAA -CATATTGCAGGTTTAAAAATCAATACCATGATGGGGAAACATATCGCGAGTTCAATCATCCGAAAAAGCAATCAAATGAT -TCAAGGTTACGTATTGGggtttaaaaattattaccATGCTTATCTTGCCTTGCATCAAAGAGAAATCCCAAGCAATATAC -GAATTTTCAGATTCCACCATCAATGAGATctagataaacaaaaagaacatgcATCAATACTTACGCCAGACTCAAACGAA -AGTGCTTATCATATGCTTTCGTTTTTCTGCCAGCAGAAAATCTGAATGCTACATACTACAGTCATCAACATCACTTTTCA -CGTTTTTGAACATGACAATTTCAGATGGAACAAGTGTCAAGAGTCTTAGAATGGCAAtaagtttcagtttcattaATAAC -CAAAAGCATCTACGGAGAACATATTACCTCATAGGTTCTCCCAGCTTGAACGATTATCTCCTTGTACTCCTCATTGTCCC -TAAGAAGTATAAACACTTAGAGCTAGAAATCGTGAATTGAAGTGAGAATCTTGTGAATGATGGAAGCTAACCTTGACCAC -AATATGCCAGCTGTATCAGCTGAAATAAAGAAGGGGGAATTGGCGAATACATCGctgaaaaagtaaaatgttAATGACCC -TCCATAGTGAGAAAGCAATACCTAAAGACGTCCAGCATAATTAAGGTTGGAACTGGggatataaattttaatcaaaaccG -AATAAAGCTGAAAattaacacaaaaataatgaattcGAGATAATGTCTAACACTTTATTAGATTTGTCTCTAATAACGCA -TGCCTTTGCAATTTGCATACTAGgaaaactaataaaagaaTACAATGGAGAACAAACCTTAAAATAGACATAAACGTAAT -TGTCCTTAACTTTCCAAGGAATGTTTCAAAAGTTAAGTACATCATatactcaaaagaaaataaagcaaCCCACGACCAAG -CCcatagaaagagagaaagtacCTGATAAATGTGACGAATCTTTCAAACTCAGAAGTGTAGACTATAGCAGCTTCAGACA -GGAGATTCATTTGGTCTTTACTCCTGCTCATCACACACATAATAAAATTTCACTACCTCTAAATGAAAAAGTTCATGGAG -CACTTCAACCTCGCTGATTATTATTGACTTGTGGTAATTTAAGGCAATCTTACTTTAACaacaataaaccaaaagatGGA -AAATATTCTTGGACTATCTTACAGTTTGAAGGTATCATATCTTTCCCACAGAAGTGTTAGGAAAACCCGAATTGCGATCA -CCATTTTTGTGAGACTGTATAGAGGGGGTCCATAACGTTCTCGCTGTTCTTCCATTGGCCTTTACATTAGAACATTAATT -CTGTCAGTTAAAGATTCATATGCAACCTGAACCTTCTGGCAAACACTCATTGTGTAATTTAAATGAGACCATGGTACATA -CCCATCATCATCGTTTATTTGTCGAATAAAATCCAACAACACCTACAAGGTATGAGCGAAGAAGAATCATGAGGACTATT -GGCGgataagaataagaaaattagCCATAAAGACACGGTGGAAGATGAAGAGCTTTGCCAGAAAGAGTAGAGACGGGTAA -GCCTACCTGTGGAACCCCTACCAAGTACTTGACCAGGGTTTTGTAGACACCAGTGGCAGAGCCTAGCTGAGCCAACTGCC -TCCTCCTAAAGAAAGGTCAATGGATGCATAAGCCAGACTCTCTGAAGAAAATCACAAGCAAAGCAGCAATTAAGAAATCA -GAAACAACCAGGCTCTCTCACCTCTCCATTTGCTGCTTCCAAAGAAGAGCATATGTGTCGCGTATGCTCCCTCCAGAGCT -GACCAACGCATCAACCTCCGCCTGTTTGTTCCTCTCCGACCTCTCCTTCTGCTGTCTGATGAGCGTTCCCCGGAAATCTT -GAGGCATGTAGGTCATTACTGcagaaaaaggtaaataacACTCGTGTGGTAATAAATTCTATGTATACCAACAGTGTCTG -CTTAGAATTTATACCTGTGCTGAATATGCGCTCGGAATTCTTCGTCTGGAAGGAAATCATAGCAGTGAATGCGTTATCAA -AACTGTCCTTGAGAGTCCGCAAAATAGAAGCGAATTCAGCATCTTCGGATGTGGAAGGTTCCCGAAGCTGcccaaaacaa -agagagaattCAAGTCACCAGAAGCAGGCGAAGTAGAGGCAACATGGACACAAAACGATACTAAGATTCACCTGAACAGG -CCAGCGAGATGGTGACAGAAGAAACAGTATCTCCTCCATCTGCTCCCTATTTTTCCACATATTCTCATCAATTTTGTGAG -GGGGCTGACGGTTTGCTTCGTCAATCAGGGAAGTTTCCCCTATAAAACGACGAACCATAAACACATTTTTATTAGTGAAT -GAATTCAAAAGCAGAAGCTATAAATAAATAGGTGGATCGGAAACCTTGTGAAGGGGGAGATTGGACGGTCAATAGCTTAA -TCAGAGATGCCATGTCAGAGGAAAGCCGAGAAACGTCGTCGGAAAGAGGAGAGAAAGGATATTTGTCGTAGTAAGAAGCG -AGAAAAGCCCGGGTGATAGGCATAAGGCCTTCCGTTGACGCcattttcagattctttgCGCGATCTACTCACTCACACAC -AAATCCAGAGCTCCATGCCACCGCCAAGCCAAGCAAATTCTCTCTCTgccggcgaagaagaagacttatTGATTATGATC -GACGAAAAATGTTGGACGACGACTAGGCCGCATATTCGCTCTTCCCAAAAGGCTTATACAATACCCACTGGGCCTTTATT -CAAGCCCACTGGTCCTTTATTCAAGCCCACTGAGCCTTTATTTACTATCGTCGtctttgtttaatgttttgtgaaattat -gatgatgaatcgAAGAGTGCACAGAAAATCTGTgaatctagttttttttttttttttttttggtacaagGTTAAATTTTA -TACCATTTTCTGAATCTAGTTTATAGCATCATGTTGGTAGAAGCAAAAATACAGTCAAATGGAGCAAGAATTACAATGGC -ATGACTTGGGAACAAAGGCACAAACGCCAAATGGCTTGTTGGGAAGCTGGCAATTGATGCCGAAACAGCAAGGCATGGTG -GCACAAGTGGTGGAGGAGCAGCATTTGCACTCCAAGCACAGCTCCAATGGCGTCATCAGCTTTCTCCTCCATACTCTATA -CTCCATCCCCACCTCCACTGGCCACATTTCTTCTGCATTTAGCCCCGTCCCGTCTCCTACACATAACACATGATCCCAGA -TGATATCCCATATTCACTACTATTTTTAACTACtgtcaaaagaaacaatttttggTGAGGACtgtcaaaagaaacaatgt -gCATACACATATTCACCTTGGCCATTGGTCGTAACCAGAATCGTCGCAAGCAAACCTAAGAAAATCACACTATGCAAGCT -AGACTCCATACTTCTCCCAGTCGCTCTAGAAAGATTAGGCGATACCAAGATCTGTGTGGTGGATAAAAAGAGACATGGTT -TAGTGGGTCACTCCACCAGATTCTACAAGTCCAATCATACACAGCTAAGGCAACAACTATTTCCAATCACATGTGTATTA -ATAGCATCATATGTCTACTGTTCATTGATATGTTATCTTCTCTTCGCCCAGTAAGTACAATGTGCAACCCTACCAAACCA -TTATGGCTGGAGAATGTCCACTTGTTAGAAAACCATATCTgcttacacaaaaaaaattcacctTGGAGTGAATAAGTGTC -GACTACTACAAGCATACTGCATCAGAGTGCGGATTAAACAAGAACCACACTCATTCATAATCATACAAGACTCTAGACAG -ATCAACACAGTAAAGTGGCAATAAACAGCagcatcaacaacaacaaaaacaacgtGCATCCACGATTTTTAGCAACCAGA -TGTTTGGCTCTGAGAGAAATTACGGAAAAGGAGACACAGCGAAACGGATTATATACACTTGACACTAATCACCGAACTCT -GCATGCTGCAGGTCCACCCGGTGAATAATTTGGATTGGGTGACCGGCAAATTGCACCTGGCCCAACGTTCTTTGCAAACC -TCCGGTGCATTCTGTAATCAGGCACCCCTCCCATTGCAAATGCAGCTCCAGCTGTAGTAGTTGCACAAGGGATCAGGGCA -TCACCAGTACACTGCAAAGGTTCCAAAGTCTCAACCACATCGCTCATCAATGGCCTAGCTTTCGGGTTCTGGCTAAGACA -ATAATACGCCAAGCTGCATGCCTTCTGAGCTGCCCTGACAGAGTATTGGTTCTCCAGTCTTGGGTCAATTATCTGCAGca -gttttcttttatcattcAGCTTTGGCCGAGCCCAATCAACCAAGTTCTGCTCTTTGCTAGGTCTTGTCTTATCCACTGAT -TTTCTTCCTGTCAACATCTCTAGAAGAACAACTCCAAAGCTGTATACATCACTTCTGGCCGTCAAGTGTCCTAGTGCATT -AGTATTAGAGTCAAGTTAGTGTTTATTTGTGTAATGGTCTAAGCACTTATTGTCATGCAAAAAGAGAGACTATGTAGCTC -GAAATGATGTTGTGAAAACAAGTGCATATATGTGCACGGCTCAACATTCTCAACAGCCACAGTCCTATATGTTAACTAAT -AGCAAACTACTAAAGCAGAGAGATAGAATTAGCTCCTGCAATATCTTATTTTCTGTATGTGGCACTGAATTGCAGGAGAA -ATAGAGACCCACATTCAGTTAACTAAAGTGATTTAAACGGTAGGACCTAAATCAATAATTGATCATCGCTCCCGTGAAAA -AAGACATTGCAGGATAGCTCGTCAAGATTGTGTATGCATCTAAGAAAATAAGTTGAATGGGATACATCTCGCTATATTAT -GCAGGTCATACCAGTCATCACATATTCTGGGGCAGCATAGCCATAAGTACCCATAACTCGAGTTGATACATGGGTTTCAT -CACCCTGGGGTCCAGCTTTAGCTAAGCCAAAATCTGAAAGCTTGGCGGTGTAGTCCTGAAGGTTCATCAGCCCAATCAAG -GATATATTAGTTGTGGAAAGGTATTCCCAATATCTTGGAGCAACTTTGGCAAagcagaaagaaaagaataactGCTTACG -GAGTCAAGCAGTATATTGGAAGTCTTGAAATCCCTATAAATAACCGGTCTTTCAGCATTGTGGAGGAAAGCAAGGCCTTT -CGCAGCTCCAAGAGCAATCATCATCCTTCTAGACCAAGATAGCGGAGCTGTGGTTTCTGAAGAGAGAGCCCATGGTGACT -TGGTTAAATAAGAGACGAGTATGACAAGACTAAAAGGCAGAATAAGCTTGTATATGTAGGAATGAACAGAGACTTCAAAA -AATGGAGAAGGGTGCGGGGATTACTTCGAAATAGGTGATTCTCAAGACTGCCTCGCAGCATGAACTCATAAACAAGTAAT -CGGTGATCGTCCTCGCAGCAGTAACCAATAAGCTTGACGAGGTTGGGATGACGGAGTTGGCCGAGGAAGTTGACCTCTGT -AAGCCATTCACGGTGACCCTGGAGTCCCTCCTTGTTAAGGACCTTGACGGCAACAGGGAGAGACTTGAGGCCGACGCGGA -GATTGTCATCAATGTAACCCTTGTAGACGGTACCGAAACCACCTTCTCCGAGTATATAATCTGGGCGGAAGCTCTTGGTG -ATGGTCTCAAGCTCAAACAAAGTAAAGGGGATGACTTGGGCATACGAAATAGGAGTGCGAGAGTCGTCTCGGAAGCGAGG -AGTGGATGGATCGCTCAGATCTGAGACGGATCGGGAGTGCTTCTTCTGGAGCTGTTGGGCTGCGAGGTGAACCAAAGAGG -AGAGAGATCAGGAAAAAAGAAACGGCGAGAgacagagatagagagaaagagaaaccttGAGCTTGAGGAGTGAAGACGGC -AGCCTCGTCTCTAGTACCGCAGTTGCCCATTGTCAGCAGGTAGAAGGAAGTGGAAAGGATCTCATCCTCAATTTCAAAGC -CGAGCACCACCGAATTCGATTACCCGttttgaaaaccctaattgcaATGGGGAAGACAACGAAGCTCTCCTCACCGCACC -ACTGAGACTGGGGAGTGctcttctctctgtctttaCAGTTTTACAGGCAGGAAATTCACAGTCCACTCCATGTTGCCGGA -ACCAATTGGGCCATTTTATAATATGGGCCTTTTTAGTGGATACTAGGCCCATTATATCCATAAAGTTTATAACCCAATGG -AACGCAGCTTGAAGAATAAATACCATCATGTGGGGATCATGGcgacaagaagaaagagtagccgaaagagagatgaaagg -GTTTGTTTAGGGTCCCTACGGGATCTTGGTGAGATGATATAGAAAAGGAACGGTAGGTAGGTACTTCTTGCTATGTTGTT -TGGTAAGCTCGTCTACTTGATCTCTCTTTCGACAGCAACTCAAACACGCATCATAAAGAATATATAGCATCAAGGAAATG -GCCAAGGTTCATCCCAAGTCACTAGAAACGGGCGGGGACGCGTCTGTGTTACCAGTTTGGAAGAAGTTATTTATAGCGAT -GGTGAGATTGAAGATCGAGAGAGAAAAGTTTGTTAGACAATTTCTCATCTTATTTGATAAAACAATCTGTACACAGTAta -gtatatatacaattgGTATAATGTTAACCGGTCtgttgaaataaataatattctgCATAACCAATTAAACTGGTGAATAC -TCAAATAAAGTTTACGTGTGATATCATAATagtaagagaaaagaaaacaaaagtagagTCCTTTTGCTTTATTGAGATTA -TTGACAATATCTAATTGGATCACAGCTCAAAgtgctcttttttttttttttgctaaaaggttaatatcatataaatgAAA -GATAGTTTTggatttacattttgattacCATAAGAAATAGACCCTTGccaaaaaaaggtaaaaaacaaggaaatatAAAG -ATGGAAAAGCAGAGGAGTGAAGCTTCAAACAAGCCAAAGTCCCATGAGATTTCTGAACTTTTTCCGGTGCCGCCTCGCCG -TGATGCTGTTTAGTCAAACAAATTACAAGCTCCTCgtgcagaaaaaaaaaacatgatttgttTATCCATCAACAATTAGA -CATGTAAAATTGTGGTGGCATACATGTGCAAATAGCAACagaaagttatatatatacttcataATCAAGTAAAGATTAGC -ATCTATGATCTAACacagattatttttttctcgtCGTCgacatagaaaaaaacttaaatacaGATTAATattgtgtttat -ttttgtcatcaCATATTACCgaaaaaattattgaagttTCTAAAGCCGTAACGgacaaaataacaaaagtagaaaaagtG -AGGAAAAGATAAGAAACTTATTACTGCTGATGTCAGCACTAATTTGTGTATGGGGATTCGTAAcgaagagagaaacaaaa -cggAAGTCTCCTAATAGGCCCCACCTCtttcaacaaataaatatcaacCACACGATTAATCTTACGTCCTCAACAACTAT -TAACGTAGACCGTACGATTCTCACACGAAggcctctctttctctttctttcttcctctaaTAAGCGGCGAAAGAGATTCT -CTGCAACTTGTTCGATTCCTTACTAAGGCTTTCTCGATTTACGTTAATCTGAGAAGAGATTGGGTTTAGTGAATCTTGAT ->ChrM -GGATCCGTTCGAAACAGGTTAGCCTACTATAATATAAGGATTGGATTCTAATAAGTTCGAAACAGGTTAGCCTTAGCCTA -CTATAGGATTAGATCTTTCTTATCAACCTACTAACTTCTTCCTTGTTGGGATGAGAAACCCTTTTGCAACCAAGCGTGCT -TTGAGTTTGTCAAGGGACCCATCTGCATTCAGTTTCACTCTGAAAACCCATTTACAACCGAGAAGATTCATGTCAGGTGA -TGCGGGAACTAAGTCCCAAGTGTGATTCTGTGTTAATGCCGACATCTCTTCTTGCATAGCTTGTCTCCATCCTGGGAGGC -AGACGTAATGGTTTTTGGTTCAGAGGGAGTGTATTTTTGTGTAAACAGGTTGTAACGAGGATTAGGCTTGCGAATACCAT -CCTTTGCCCGAGTGATCATATGATGTCTATTAGGTGAAAGTAGCTCAGGAGCAGCTGTCCCAACATCAAAAAAGGTACCG -CTGTCGCCAATAGGAACAGGATCTGAGCCTGCCGTACGCACAGGACAGTCTCTTTCTGATGTGGTAGCAGTTCCAGGAGC -AATCGCAGAGACAATTGAAGGATCTGCAGATTCGCAATCAGAGCCTGTGAAACCGGGAAGATGTCGAGATAGCAGGAGAA -GAATTAGCAGTATGTGAGTGCGGAAGCAGAGTGGAGGATCGAGGGACCTGTGAAGGTGTGATAAAGGAACTGTCTGTTGA -AACAGAAGGGACATATGAAGGTTTAGAACCAAGCTGCCAAGCACGAAGCAGAGAACTTGGATACGGTGGGATGAGATGGT -GATAACAGTCCTGAAAACGAAAGACTAGAGCTCTTGCCCAACTGACAGGCTTCACAAACAGAAAGATCCCTTTTATTAAT -AACTATAGCTTTACTAGTCTTGAGTTGTTGGAGAACTTGAGGATTTGGATGCCCAAGCCTATAATGCCAAGTGAGCTCAC -TAGCTGCTTGTTGTCTTGTAGAGTAGAAGACTTATAGATTAAAATTCTCCAACATATAGATGTCCTTACACCGTTTTCCT -TTGCTCAGCAGGCTCCGTGTTTGCTTGTCCTTTATGCATACTTCGTTAGCATCAAACTCAAAGAAGCATGGATAAATCAT -CACAAAGTTTGGACACAGAGAGAAGAGACTTAGTTATGAAAGGACAAACAAGAACTTCATTTAATGGTAAACTACCTGAT -GAGCTTGGTAGATTGGTAGATCCAACATGAGTGATGGGCAAGAAGGCTCCATCCCCAACCATCACACTGTCGGATCCCAC -ATAAGGTTGTGACTGTTGGAGGTGATGAGCAGAATTGGTAATGTGAGAGGAGGCACCAGAATCTGGAAACCATTCTGTAC -CAGAGGTATCCGTGATCTGAAGAGCAGCAAGAGCTTGCGGAATATCACTGTTCTGGAAGGAGTTGTCATATTGGTTCCAG -CATTTTAGGGCTGAGTGACCAGTTTAGCCACAGATTTGGCAAACGGGTCGAGAAGAGAACTGATCAGAGGAGTGGGATTG -ATGCAAACTAGTTGAGGGCTTGATAGCGTTGATGAAACCCTCTTCCTCTTGTAGAGAATGAGCCGCGACCACGGTAGTTA -CCAAACCGAGAATAGGACTGTCATACGAGTATACCAGAGGCTGAAGGTATTGAGTGATGATCCTTCCTCAACCCTAAGCT -AGGCGAATCAATAACAAAGCAAGACTACTTTCCATCAGTACGGGGTACGCCATAAACGAAGTCAGAAGGTTGTCAATCAA -ATATGGTACGCGATGCTTGTCCAAATAAAAAACGATCCCTTAAAAGTGAGTTAGAAAGGTAAGAGTCTTGTACCTAGTAG -AACTTCTAATAACTAATAAAAGCTATTTTCTCAGAAGCGAGAGCGCACCTCTCGCAACAAGTGCTCGAGTCACTCCGCAC -CTCGAAAAACAAGTCTCAGGAAGTGAGTGAGTTATAGTATTACAGGAGCTAATAGCTTCAGCAGAGAAATAAGCACAGGA -AATACTGGTGGGAATCTCACCTCCAAGCCTTTCATGGGCCCGCGTTGAAATACCCAACAAAAATCCAAAGATCATTGATA -GCAGAATGAAGAAACTGAAGATCCTGCTATAAAGATCTCCTCATAATGTAATGAAATTATTATAAGAAATAAAATGAAAG -CGCAGCTAACATTATCCAGGAACAAGGAACAGGTGATGGATTGAGCAGTAATAAAGGTAATGGTTGGAAGCTGATGGATG -GCCGAGTAAAGAACCCAGATATTAGAAGGGAGACCGTTACAGTGGTTCAAGGTAGCTAAATTCATGTTTCGCGAATCATA -GAAAAGAAAGAAGAAGGGATATTGGAAAAAAGAAGTCATGGATTTAGCAATACAAAGAGGTTCAGCTGTTTCCAAATACG -GCGGATCTGGTGATAAAGGCCAAGGGCGTGCTCTTCTATTAAAGGAAGAACAGAAACGAAAAAGCTCTCTTTGCGTACTA -TGGATCTCTTACGTGCGATATTCCTTGCTTTGACTTTGACGAGCAGCATCCAGTACATTCACCCCGGCTGGGCAGTAGCG -CCAAGAAGAACTTCAAGCTAAGAGCGAAGAGAAGGTAATGATTTCGCTCAGTAGAAGGTCACCTACATGGATATTAAGGC -TATAAGCCGCAGGTAAGATATAGTTCATCGAAGGGGAATCTTGAATCAAATGTCGATTCATCTTAATTGTACGTCAATTC -TAATTCAATTTGTTCTAAACTTCCTCGGGGCTAAAGCCTCGTGATTCAATTATGGCTCTTTGCTGCTATTAAGGTGATAG -TATCTGCTTAGCCCATAGTAATAAGATGGTAGTGACCGCTTATCCTAAGTCTTCCGCTGGCATGGGTGTAACTGTCCTTC -CAGAGTACCTCAAACAGTCCTCTTACGAAGCCTATTCCCGGCCTTACTCTGCATTCTTTCTTTCTGGTTGTACTAAGCAG -GAGCGTTCCCCCTTACTGGCTAGGCGGCTAGTAGATGCTTGGCTTTCATTCCATTCCATTCTGATGATAAATGAAGAAAG -AGGTGTCGGACTGGGCATATAAGCAGCTATCAGAAATTTCACTCATGATACCAGGCGCGAGGAGCCTGTTTAAGACCATA -GCTTTTCGAAACCTGCAAAGAGAAGAAGAGTATCGACCGGGAGGTTGAGACATGACTCTTTTCGGTTAAGTGACCCTGTA -GAAAAGCGTTGTTGACATCCAATTGACGAAGAGTCCAGCCATGGTATAGAGTAAGACTCTCAGACGAATAGTGATAGGCT -TAACCACAGGGCTTAATCTATCAAAAGACTCTCTCCCAGGCCGCTGATTCCTGTCTAAAACACGAGAGAACCTTGCCTTG -TGGGTGTCCGATGCCGACCCCGTTGTGCTGTGCGTCTTGTCTTTCCCAACGAAAGTGATGCCGATTCAGCGTGTGTGGCC -TGATGCGGTTCAGCCTACCAATTAGTGGGGCAAGGAGATATGGTTTCCTTAGGCATAAGCATGTCATGTATATGTACACA -AGGGGAATAGCAACTAAAGCTCAATAGCACCTTAGTGAACTACAAGGGCTCTACCGCTCGGGTCCCTCAACCGAGAGCCC -CTCCTCGCTACGATCCACCCTTTCTCTAGCCCTCTACTCAACCGCTTTAGCTGGCCCGCTTCTGACAGAAGTAGCAGATT -CAATCTGTGAATCCCGTCTAGAGCTCCTCACACTGTCCGCATCATCATCAACGGCAAGCGGATCAGATTTTAAGAGCTTC -AAAATACATACAATACCCTAAGGAGTGAGGGATGTACCTTTTGGAAAGGGACTGACTGAACGGAATCAATGACTTACATT -AACATTGCTCTTAAAAGAAGTCGAATTCCCTTCATTCAGAGCATAATTAATCTAGTCACTGATTTGAGTTATATAGTTAT -TATTCATGTTTGTTGTTCGTTGGACCTTTTTTGAAAGGCTTTGTTAATGCTTATCGAGTTATGATATAAGAAAGGGGGAC -GACTGAGGAAATGCCATGCTAAGGCCTATTTCCCTGCTGTTTCAACTTCTTTCTATAGCGATTGGACACAAGTTTTTCTC -AAGTTAATGCAACTCCGTTTCAATTCCATAATTTGACTCAAACTACATGTCAATCCCCCAGTCCACTATAGGGGAGAGTT -CACTCCAGTTAGGGGGTATTACCAGCGGCTTCGACCACATCCTATCCTCTCTAGCTACTGGCTTCTGTGGGGAGGGCAAA -CTTCTATATTTCCCTGCTAGTGCACTACTTCCTTTTCTTTCAGAACAGAGACGGAGCCCTGCTTTAAATTGACAGAGGAG -TTATTGGACGCCGGGTATATCCAGCCATCCAAAGCACCTTATGAAGCCCCAGTGTTGTTCCAGAAGAAGCGGGAGCCTAC -GTCTATGCATCGACTAACCTATATCTAAACAAGGTTACCCTCAAGAAAATAAGTACCTGATTCTGCGCGTAGAAGACCTA -TTCGATCCGTTGGGAGATGCAAGCTTCTTCACCAAGTTGGATCTAAAGCCGGGGTACTACCAGGTGCGCATCGCCGAGGG -TAATGAACCAAAGAGGAGTATACTTTATGAATGGGAAAGCAGTCATCAAGCCAGATGCGGATGAAATTCTAACTGCTGCG -CTTACGCCTTTTGATTAGACAACTCCTAGTGCCAAGCTAACTAACTAGGATTCGTTCAAAGGATTCGTGAAAACAGAAAG -AAGAGCTAGCGACTCTGACGAATCTAATGTTGCCCGCGTTGAGGCGAAAAGAAAGGCGGATTCCCTATATAAGTGAATTT -GTTCTTCAATCGATTCATCTCGGCCTTAGACTGCTACGGTTAGCTCTTGCCCCGAGCACCTGGACTGGCTATCTCGAAAG -AAATGCTTTCATATCATAGCTGCTGACTTGGCTTTGAAACTATAGGAGCTGAAGGAACGGCTACTGATTTGGACCTAAAT -CATTTCATCCGGAAGTGACTGCACTCGCCTAAGCCAAAACCAAGCTACTTTCATAACCACCAGGAAAGCCTAGCTACTTC -TTCGTTCCTCACCCTGTCCCTTACCTCTTACCGTAGGAAAAGCCGTTGATATTCGTAGATCGTTCGTTGATTCCCTTGCT -TTTGGGCGATGATTCGATTCTTCTGGGCTTGTTGCCACTAAAGAAAGAGTTCTGCCTTCTAGCCAAGCCTTTGAGACCAA -GTCAAGCTTCCCAGCAGTCAACCAAGAAAGAGTGTTTCTCCCCTACTGAAGAAATGGAAGTCAGTCTGCTTTCCTTCTTA -GCTTTGTTCACATCTGCTCTTTCCAGGACTGGCTATCTCTCAATGTATTCACGCATCTCGAAATAGTGAAAAGAAGTAGT -CCCTCCTCCCAGAGCTGAAATAGCTGGAAAAAAACTTCAACAGAAGTAATGCCGACTCTTCTACTTCCTGGTACTTTTGA -ATAAGGCAAGGCCTTTACCTATTCCCTATCACAACCACTTTCAGTAGAGGAACTTCCTCTCCTTTTAGTCGAGTTATAGC -TTTCGCTTCTTCAGATCCTGATCCTTCATCAGAGGAGATCGCTTTACTTTTTTATAAGAGCCATTGGCAGGACCAAGAAA -CTCCCATTCAAGGCGCCAATCATTCATAAATAATTCTTATATATGATATGCAATTCGATGATTCAATTTCTTGTGGAAAA -GACTAGCGCAATGGCTTAATGCATTTCATTGGCAGTTTGGTCCTAACAAATTATGCTTCTTGGGAGAGGAGAACTTCCAC -CAAGCAATATATTTGAGTTGGCTAACCCAATGATTGAGCTAGCTTCTAATCCATTTCAATCTCATCTTACACAGCAGAAG -TTGTGGATTCATACCTGGAAGCAGGCAATGCCGCCACATCTCCCCTGTGAAAGAAGGTTACGCAGCTGATTCGGTTAATC -ACATGTCAGAGGCATCTATCTAAATCGCACATGTCAGAACAAGACCTAGGGATCCGGTGGCACCAGGAGCGGGTAGCCGA -GTTGAGATCATTCCGTTAAGACACAACCACTTTTACAGTAAACATGCATCCGCCCAGCGCCCCCTCCTTACGAATGGTTA -CGGGACTAGAGCGAGTCTCTTTTTCTTTGCAAGAATAGGTCTGAGCCTGATGACATTCCTGCTTTCCTTGCCATGTCCAA -CTAAAGTGAAAGTTAATCAACTGCAAGGAGGAATCGACCTTTTTCTACTATTCATTTGCGCCGGAAAACCCCTTCATCAT -TTGCCCTGAACTGGTGAAAGGAATAGGAGGACTTTTCCCTCGGTGGAAGTAGGGATTTAAGCACAGTTGTGATTCCGCTT -TCATGTCTTGGATTGAGCTTTCTCACTCTTTCTATGCCTCTTCCTTGTCGGCGTCCTTTGTTCGCTACTGCTTTAAAGAA -TGGGATGAGGCTACCTGATCGTCGAGTCGACTTCCATCAATCAATTGGATTGGATCTTATTATCCCATAGTCATAAATCT -GATTCTTCACCCAGTGGGAACAGTCTTCATGGTGGTACCAGTGCGTATATATGTAGATGAGTTTTGGTTCCCACCCTCGA -TTTTCCATCCAATCTTCCTATCTTCTTTTCCCTGCTTTGGAAGCATTCGATCTCTCGTAAAGCAAACCCTCGTCAGAGAA -AGGGGGCGGGAAGCCTGCGTGCGATTCCTGGGTTGGATATCCCTGGCTCTCTTCTCTCTGAGTCCCCGCTAGCTTTCAAG -CGTTCATTCAATCTCCCTCCCAACGCAAGGAAACCGATCGATGCACTTGGCTTTAGGTTTCGATCGATAATAATTTATAT -TATATATAAAAACGCTTCTCGCTGGAGACTCGGGTGGGGCGCTTGCTCTCCACTGGCGGTTGAATGAAAGACGTACCCAT -AAAGTTGACCTAAGTTGGTATGCCTCCCATCGAACTAAAGCAAGAAATCTTCCTTCGATGCGAGTCTATCAAATGTTTAG -CCACATCTGCTGCGCCCCGGTCAGTGGAGTCAATAGCCTTATCAGCTGTCCCTCCCTTCTTTTAAAATATTACCCAGGAT -CTTATCCCAGGCCGCTGATGAATTGGCAACGAGGCGAGCCTTGTACCGCTCAACACTGCCATCAGGTTTCCGCTTAACCC -GATAAGAAGACCCACAACAATCTTTTGATGAGGAGATGATGGTACTAGTTCCCGGGTGCCATGGAGAATTAATGCATCAA -ATTCAGCAGACATGGATGGTGGCACTAGGATCTGCATACGAGGCTTTTGGTGTGCGGACGTATGTGACCAATGCACTTAT -GCTGCCTTCACTCAAAGGAAAGCACTTTCAAAGAAGCAAGGGATGAAGGGGAGGTAAGCCTGTCTTAAAATCGATTAACT -AAGCTAGCTTAATTCTTGAACTACTTGAACTAGAGGAGCGGTACGAGCGGCTTACTACAAAAGAAAGGCTATTTGAGATG -CTTTTTCCGGGCCAAAGTACTCTGACCCATGATACCGATTCAAGCTCACTGAGAACGGATTTCCCTAGTTTTAAATTCAA -CTACGGACCAACAAAGATTGATTGTTGTCCCGTTGACAGGAAGATGGAGGGTTGTTCTCGTACTCGCTTGGCGGGGTGGG -CATTCTTATTTGTTTAAGACTTCTCACAGCTTTTAGGCGCTAGGAGGGCTTGATAGCTTTGATGTAACCGTTTTGGTCGT -TGTTGGAATTGATGAGCCAAACAAGCCAGTTCTCAGCCTTCTATAGTATCCGTTTGAATACGAGACAAAGGAATCTATAG -GCCTATCTCTCACTTTCTAATACTACTATTGCTAGTGCTAAGGAGCTAGAGTATACTAGTCTAGAAAAGAATCCCACATA -GTTGGCTGTCTTACTCTAATACCAATGCGAAGAAACTCATTAATTCATTGATGAGGAGGGCGAAGAAACTTTCAGCTTTA -GAGAATCCAGTTCCAGCGGAAGACTAAGTACGGTAGCAAGTCAAATCAATCTCCTCCAACAGAAGGCTCTGACCTGACCA -CAGTCAATCAGTCTATTGTTCTGGTTCTAGAGAGTCTAACCGAGAAGAAATCGTCTCATCGCTTTGAGCCTGGTCCAGGT -GTGGGGGAATGAGTCCTCCATCTAGTAGCCCAGCCCTTCCGACAAGAGCAGTTACGCCTTTTCCTAAAGCTCTTACTAAA -CCACCGCCTAGCGACCACGGAAAGCATAGTCAGAAGAGCTGAAACAATAGCCATGTCATATTCCTCGGGAATTGCCTTTC -GAACTGAACTACCACGACTCTCGTTAACTGCATCGGATTCGTGAATCAATTGCTGCAGATTATCTCATTCAATTGCAGCG -GCTTTAGCAGACATCTCTTCAATTTGCGTAGATAGAAGATCCGGCTAGAAACTCCTTTTCATTGCCTTCTACTTTAAGTT -TTAAATTAATTTCTCTATATCTAATTCCAAGTGAGATGTCCAAAATCAAAGGATGGAGGGTAAGAATCGACGAGGAATCT -ATAAGATAAAATCGTTCATTCAAAAGGAAGAAGAAGAAGAATCGGACGATTGAAGACTAGAATCGCTAATAGTCAGTCGG -AGTGGATTGAGAAAGAATTGTAGGACTAGATAGCTCTTTCCTTTTTTGATGTGCTTTCTTGCGGGAAAGAAAAGGTATTT -AGTTAGCTAGGCTTTGACGCTTGTTCTCGGATTCCTTTGCTTGTATATTGTCCGAAATCTCTATGGCAAGTAGTAGGACC -CTCACACTCTGTTCGTTCTCCTGTCCCTATCTCTCTCTGTCACATCCTATCCCGTTCAGAATCTTTGGGATCAAGAACTC -TCTTCCATTTCTCTGCTCGGAAAGAAGGTTGGCAAGAGATATTTTTAAATTAGGGTGCGGCAACTAAAGAGGTATCGAGA -CTGACCGCAATTGCAGGTTGACTTTTCTTTTCATTTTGTTTATGGCAAGTGAAAGTCGTTTCGTTTAGTACGAGATGGCT -TCACAACCTCGCGGTGCTTCCACCTCTCGCCTATCGAAGTTCTGTTCTAAAACCTGTTCCGAGAACTTGTATAGAGAAGG -ATTTCCCGCTAAGCAGCAGTTCTTCCATACCAACTTAGCTGCCCGGCGCTGCTATTGGCATAACAACCGGTACACCATAG -GTTGGCCCAACCCAGTCCTCTCGTACTAGGGTTGGCTCCTCGCAGTTCTCCCTTTAACACCAACGGTAGATAGGAACCGA -ACTGTCTCACGACGTTCTAAACCCAACTCACGTACCACTTGAATCGGCGAACAACCGAACCCTTGGGACCTTCTTCAACC -CCAGGATGTGATGAGTCGACATCGAGGTGCCAAACGACTCCGTCGATAAGAGCTCTTGGGAGTCATCAGCCTGTTATCCC -CGGCGTACCTTTGATCCGTTGAGCGAGAGCCCTTCCACACGGGACTCCCGGATCACTATGGCCGACTTTCGTCTCTGTTC -GACCAGTCGGTCTCACAGTCAGGCAGGCTTATACCATTACGCTCACGAGCAGAATCTTAGCTTGAGCCTACCTTCGCACA -CCTCCGTTACTCTTTAGGAGGCATCCGCCCCAGATAAACTACCCACCTCGCAGTGTCCCGCCTCCCCCCGAATTCTCGGT -GCGGCGGTTAGGCACCCTTAGACGAAAGAGTGGTCTTTCAGGATTGGTCCTTCTATGTCACGACCTCCCACCTATCCTAC -ACATTCGATCAAGGTTGTCACTGCGAAGCTATAGTGAAGGTGCACGGGGTCTTACCGTCTAGCCGTTGGTACTCCGCATC -TTCACGGAGAATTCAATTTCACCGGGTCCATGTCGGAGACAGCGGGGCAGTCGTTACACCATTCGTGCAGGTCGCTACTT -ATGCGACAAGGAATTTCGCTACCTTAGGACAGTTAGAGTTACTGCCGCCGTTTACCGGGGCTTCCATTCAAAGCTTATAA -CACTTCTCCTTTTGACTTTCCAGCACCGGGCAGGTGTCAGACTCTATACATCGTGTTACCACTTAGCAGAGTCCTGTGTT ->ChrC -ATGGGCGAACGACGGGAATTGAACCCGCGATGGTGAATTCACAATCCACTGCCTTAATCCACTTGGCTACATCCGCCCCT -ACGCTACTATCTATTCTTTTTTGTATTGTCTAAAAAAAAAAAAAAATACAAATTTCAATAAAAAATAAAAAAAGGTAGCA -AATTCCACCTTATTTTTTTTCTAATAAAAAATATATAGTAATTTTTTATTATTTATTATTATTATTTATTATTAATATAA -TAAATAAAGTAAAATATGATACTCTATAAAAATTTGCTCATTTTTATAGAAAAAAACGAGTAATATAAGCCCTCTTTCTT -ATTTAAAGAAGGCTTATATTGCTCGTTTTTTACTAAACTAGATCTAGACTAACACTAACGAATTATCCATTTGTAGATGG -AGCCTCAACAGCAGCTAGGTCTAGAGGGAAGTTGTGAGCATTACGTTCATGCATAACTTCCATACCAAGGTTAGCACGGT -TAATAATATCAGCCCAAGTATTAATAACACGTCCTTGACTATCAACTACTGATTGGTTGAAATTGAAACCATTTAGGTTG -AAAGCCATAGTACTAATACCTAAAGCAGTAAACCAAATACCTACTACCGGCCAAGCCGCTAAGAAGAAATGTAAAGAACG -AGAATTGTTGAAACTAGCATATTGGAAAATCAATCGGCCAAAATAACCGTGAGCAGCTACAATGTTGTAAGTTTCTTCTT -CTTGCCCGAATCTGTAACCTTCATTAGCAGATTCATTTTCTGTGGTTTCCCTGATCAAACTAGAAGTTACCAAGGAACCA -TGCATAGCACTAAAAAGGGAGCCGCCGAATACACCAGCTACACCTAACATGTGAAATGGGTGCATAAGAATGTTGTGCTC -AGCCTGGAATACAATCATAAAGTTGAAAGTACCAGAGATTCCTAGAGGCATACCATCAGAAAAACTTCCCTGACCAATTG -GATAGATCAAGAAAACAGCAGTCGCAGCTGCAACAGGAGCTGAATATGCAACAGCAATCCAAGGACGCATACCCAGACGG -AAACTAAGTTCCCACTCACGACCCATATAACAAGCTACACCAAGTAAAAAGTGTAGAACAATTAGTTCATAAGGACCGCC -GTTGTATAGCCATTCATCAACGGATGCAGCTTCCCAGATTGGGTAAAAATGCAATCCAATAGCTGCAGAAGTAGGAATAA -TGGCACCGGAAATAATATTGTTTCCGTAAAGAAGAGATCCAGAAACAGGTTCACGAATACCATCAATATCTACTGGAGGA -GCAGCAATGAATGCGATAATAAAAACAGAAGTTGCGGTCAATAAGGTAGGGATCATCAAAACACCAAACCATCCAATGTA -AAGACGGTTTTCAGTGCTAGTTATCCAGTTACAGAAGCGACCCCATAGGCTTTCGCTTTCGCGTCTCTCTAAAATTGCAG -TCATGGTAAAATCCTTGGTTTATTTAATAATCAGGGACTCCCAAGCGCACAAATTCTCTAAGTAGATAATTGAGAGCTTG -TTATGAAACAGTATAACATGACTTATATAGCCATGTCAACCAATGTAAAATGGATAAGATCCTTTTAGTTTAGATTCATA -AAAAATTTTTTGTAATCGATGAAATAAATTAGAAGCGAATCCACATACATAGAAATAGAATTGCTCTAGGAATATTTTTT -CCAAATCATATGAATACGATTGAATACGATCCGTAGTGGGTTGCCCGGGACTCGAACCCGGAACTAGTCGGATGGAGTAG -ATAATCTCCTTGTTAAAATGAAAAAAAAAAGGTAAAAAACCCCTCCCCAAACCGTGCTTGCATTTTTCATTGCACACAGC -TTTCTCTATGTATACATAGAAAACTCAATTTCTTTGGTTCCTTATAAATAGGACTCCAAATTCAATACTCAGTAAATTTA -ATCGTAGTCTTACTGTATGAACATTTAATAATAGAAATAAAGCACTTTTGATAATAAAAAATAATTGATTTTTTTTGTTA -TCTCTGCATAAATTTTAATAAATTTCGATTTCATTTATGGGGTCTCAGAACCCAATTATTCATGATTGACCAAATCATTA -AGATAAAGAATATCCAAATACCAAATTCGCACTCGATATAATCTTTTAGAAGCATAATAACTTCTTGGGAAGATTAAAGA -AAGAACTTGGTCTTCCCCCGTAAGGAATTCTTCCAATAAACCAGAGCCCAACCTTTTTAAAAAAGTGCGTACAGTACTTT -TGTGTTTACGAGCCAAAGTTTTAACACAACAAAGACGAAGTATATATTTTATTCGATACAAATTCTTTTTTTTTGAAGAT -CCGCTGTAATAATGAGAAATATTTCTGCATATCCGCACAAATCGGTTGAGAATATCAGAATCTGATGAATCCGTCCAGGT -TGCTTTACTAATGGGATGCCCTAATACATTACAAAATTTATCTTTAGCCAACGATCCAATAATAGAAGAAATTGGAATTT -TGCTATCCAATTTGATTCTAACATTATCTATTAGAAATGAGTTTTCTAGCATTTGACTACGTACCACTAAAGGGTTTAAT -CGCAAACTTGACAGATAACCCAGAAACTCTAAATTATCTTTAGATAATTGATTTATATTGACCTTTTGCGATTGAAACCA -TACCGAAAAATAACATTGCCATAAATTAACAAAATAATATTTCCATTTATTCATCAGAAGCGGCGTATCCTTTGTTGCCA -GAATGCATCTTCCGTGATATCTAACATAATGTATGAAAGGATCCTTGAGCAACCCTAGGATTGCCGGAAAATTATTAACA -AAAACTTTGAAAAAATGGTGTATTTTTCCATAGAATACAATTCGCTCAAAAAGGACTTCATAAGATGTCGATCGTAAATG -CGAAGACCGCTTGCGTAGAAAAAAAAAGATGGATTCGTATTCACATACATGAGAATTATATAAGAACAAGAAAAATCTTG -GATTCAAAATTGATTTTTTTTTAATATAAAAATTCTTCCAATTACAATACTCGTATAAACAGAACCGAAAAAAATGCAAA -GAAGAGGCATCTTTTACCCGGTAACGTAGGGTTTGAACCAAGATTTCTAGATGGATGGGGTAAGGTATTAGTACATCTAA -CACATAATTAAAATGTCCTAATTTGTCTTCTAAAAAGGGAAATATTGAATGAATTGATTGTAAATTATAAGATTTTTTTA -ATTGTTTTCCTTGAAAAGAGGATCCTAATCTTAGGGAAAATGGAATTTCGACAATCACTGCAAATAAAACAGATATCATT -TGATAATAGAAAAGACTGGTATGCCCCAAAAAGGAATTTTGGTTCACATCCTTAGTGGGAATAATCAAACGATTCTGTTC -ATACATTCGCAAAATTAAGCGTTTCGTAATTAGTGAACTATATTTTTTGTCATAATCCGCATTTTCCAAGAAAATATAGC -GATTTCTATTTAATCTATTTAAACCATGATCATAAGCAAGTACATAAATATACTCCCGAAAAAAAAGTGGATATAGAAAA -CTCTGTTGCCGAGCCCCATCGAACTCTAAATATCCTTGAAATTTATCCATTTGGATTGAAATTCGATTTGAACTGAAGGT -AAAGTCTTTATTTTCTTGAGTTCTGAAATGACACATAGTGCGATACAGTCAAAATAAGGTATTAGACTACGAAAGCTATA -GATATAGATACCTCATAAACAGGTAGACTGCTAACCGGATTCTCTATCTTTAATAGGTTTCTGTTCGTTATATTATAGAA -TAACAAAACAAGATTATTAGAAATCCTTTATTTTTTTAACCTAATCGCTCTTTTGATTTTGGAAATATATATATTTTTTA -TCAATATACTGCTTCTTTTACACACTCCAACCTAATCCAAATGGACTAGTTAAAACAATAATTAGGACTCATGAAAAAAT -TGATAATAACACGCAAGAAAAAAATGCCTTCCCATACCCGTATTAGGCACTAATCTATTTTTAACATTTAATTAGTTGGG -GTAATTTTTCAAATTACGAATGGAAGCTCGTTTCTTTTTTTTTCCTGGAATAAGGAAAACTGGTTTTTTTATCCATCCAT -TTATATTTATTCACTTGACCCAAATTGGAATTCTTTTTTTTTTTTCGACATCAAAATAAGATTGTACCGATCAGGAAAGC -AAAAAAAAATGTTATCTGAATTCTCCCTTGATACGACATGCTATTTTTTCCATTCATTCCTTTCAGGATCAGTCGTGGTC -TTACAAACTCTACCGCAGATCTGGACGAATCCTTTTCTTCATACAAATGTGTAAAAGATGCTAGTCGCACTTAAAAGCCG -AGTACTCTACCGTTGAGTTAGCAACCCCCCCCAAAAAAAAAAGAACGTACTGCAAATATGTAGATACAATCAGAATAAAG -AAAAAAATACAGTCGTGTGTGCGTCAGGGATAAATAGATCCATTTATCTATGAGAGAATTATATTTGGTCCATACACTGT -TGTCAATATGATTATGAATTTTTCATATAGTCAAAAGAATAGAAAAAATAAATAAATAAAAAAGCTTAACCTCTTGGTTC -ATTAGTTCATACAATGAATGAAAACTAAGCCAGTTCCAGTTAAGGTAATCTCAAATCTTTTTATACTTTTTAGATCCATT -TTTTTTATGGCCTTTAATTTTTTATTTTTTTATGATGAAGAAATTATTCATAATAATATAATATTATTATAATATAATAA -TATATATATATTTTTTTTTATTCAGAATTATATATTATATTTATATACAGTATTATTCTTTTCTATATAACAATAACAGT -AAAATTTTGTATTTATAAAAAAATTCGAATTTATATACTCTAGATCCAAAAAATTTTTCATAAATTTGTGTATGATTATA -AAACATAGTAGTTGTTAGCAAGGTATTTTTTAGTATTCGTACCTTAGGAGGAATACTAATAATAAATAGAAATTATAATA -AATCAAAATAAATATGATGGAAGTGAAAGAGAAGAGTAGATAAAATTTTATATCACGTTATATACGAGTCTTTCACATCC -TCTTTTTTATATTTCATTAATTTCATTTCGTTTTAGTAAGACTTCATTCCGTAAAAATCCCAGCCTTCTTTGAAATATCA -TGAGCTGTTCTTGTTGGTTGAGCTCCTTTTTTAAGAAAATCGAGAATAGCAGAAAGGTTTAAAAAAGTTTGATTAGTTAT -GGGATCATAAAAACCCACCTTACTAAGATCTCTTCCTTCTCTTCGGTATCGAACATCAATTGCAAGGATTCGATAAACGG -CTCGTTGGGATAGATGTATATGAATAATACCCCCCCTAGAAACGTATAAGAGGTTTTGGCCTCGTACGGCTCGAGAAAAA -AAATTCAAATAGTAAATTCAAATATTAAATAGAGAAATAAAAACATTAAATCAATTAGCCAGTATTAAAACCCTAAATAT -TTTTTCCATAAAAAGCATTCATAACATTCGTACTCTCGTAACTCAAGTTAAACAACTCTCAAATATCTCACCGGAGAATC -CTTAAGTACTTTTTTTATTGAGTAGTCTCTAGCCCTTTTTTTGTTTGTCTCATTGCAAATTTTAGAATCAATTTTGATTC -TTCAGTTTGATCTAGTTTTTCAAACAATTGAAAACAGGATTTCCTTTTTTCAAGATTCTTTATCCTTACTTTGAATCTTT -AGGTTTAGACATGACTTCGGTGATATTGAATCGTTTTATTAAAAAAGGGCAGCAACAAGCCCCTTATTTTGTTTATGATT -TCTGTTCTTTCTATACAAAGAATCATACAAACGCTTGATTCACGCATGATAGACTTTTGATTCAAAGAATTTTACAATTT -TAAGAAAATTTCCTTTTCCATTGTAAAATTGCTTGAAAGGACTTTTTTCAATATAAAAAGACTTACGAAGTTGTTCCAAC -TTATTAATTCGCACTAACCCTAAATCCTTACTCCTGCGAAAGGACTAAAAACTTTCTATTCTCCTCGAGCTCCATCCTGT -ACTCTTTTTTATATTACAAAAAAGTGTAGGACTCTTGTAAAATAGAATACAAAATGTCGAGCCAAGAGCACCTATATTCC -TAATATAAAAATAAAAGTGGCGGATGAAAAAATCCACAGCAGATAATGTCCTTCAATTCAAGTCGTACGTTGCTTTCTAC -CACATCGTTTTAAACGAAGTTTTACCATAACATTCCTCTAGTTTGTGTAATTGATTCAATGATGGAATCATGAATAGTCA -TAGTTCAGTCAGTATATAATAATCTATACCTTTTCTTTCTCTATGAATGGAATAGTTTATTTACGCGTAAAGGTTCGGTC -AGAATGAAAATGAATTCCATATTAGTTTGAATAGAAATCTATATTTATATATAAATAAATAAATATAGATTTTTTTATTA -AAACTCTTAGAATCTGCGGTTCTACCTTACTTACCCGCATCACACAAATTAAAAAAGCAAATAGATTTTTTTTGAATTCG -GTTGAAATAATGAAAAATTAAGTTTATTCTTCTTTTCATTTCAATATTTTATTCTTAAAAAATTTGGATTTTTAAACAGA -AAGAGAAAGATGGTGTACAAAGGCAATAGAAGATTGATTCTGTAATGACTGTACTCTGGGACGGAAGGATTCGAACCTCC -GAATAGCGGGACCAAAACCCGTTGCCTTACCGCTTGGCTACGCCCCATTTCGCTTTTTATTCAAGACTACTAAAAGAGTA -ATATTCCTATTGGTTGTTCGTCAATTCAAAATGAAATATAGATTACATTGGTGCTAAAGTTTTAACACGTGTAGATAGCA -AATAAAACTTACTTTATTGATCATTACATAGAATTCAATTAAGATATTGTATGAAAATATTATTTCTTTCATTCTCATAA -GAGAATAAAAGGATTTTTGATTGAGTAAGTTCAACAAAGTCTTTTTAGACTATCTTTCTTTATTTTTTCCTTATATAAAA -AATATATTAAAAACTCAATCAAAATTAAATTATCCACAAGAACACCAATTTTTGTTATGCTTAATATATTTAATTTGATC -TGTATTTTTTTTAATTCTACCCTTTTTTCAAGCACTTTTTTAGTCGCCAAATTGCCAGAGGCCTACGCCTTTTTGAATCC -AATCGTAGATGTTATGCCCGTAATACCTCTTTTCTTTCTTCTCTTAGCCTTTGTTTGGCAAGCCGCTGTAAGTTTTCGAT -AAAATTCTTAATACTGTCTTAAACAAATTCACGATTTTGATTTTTCCAACAATTCAAAAGATCCAAAAAATCTTGACGTA -TGAACGAACTCTCAATTCAAACATTTAATTTTTTTGGTAGCCATACTAAATCTGGATCATTTCTATTTCCTAAATTTTAT -CCTCTTTTCCCTAAATGAAAGAACCTAATTAGATTCAAGTTCACCAAAAAAATATCTAGATGTTGGTATGCAAATCTGTT -TGAATATGAAAGATTCGACTATTATCTTAATTACAAATAACTTTCTGAAACCTTTTTTTTTATTGGTATCAAAATTAGAT -ATTTGATATAAAAATAGAGAATCTATTCTCTTTTTTTTTAGTAAGATCTTGGAGATTGTGTAATGCTTACTCTCAAACTT -TTTGTATACACTGTAGTTATATTCTTTGTTTCTCTCTTCATATTTGGATTCCTATCTAATGATCCAGGACGTAATCCGGG -ACGTGAAGAATAAAAAAGAAAGTTTTTTTATTGCTTTATTTAATTCGTGGAAATGCTCGAATTTTATTAGGATTTTATCT -ATTACACACCATCAAAAGGAGAAGGGGAAAGAGAGGGATTCGAACCCTCGGTACGATTAACTCGTACAATGGATTAGCAA -TCCAACGCTTTAGTCCACTCAGCCATCTCTCCTAATCGAAAAGGGATATTTAATTAGGTTCCATAAAAAAAAAAAAAGGC -TTGAAAAAGAACCTTCTCCACTTTATTCTTAAAAAGCTTTCTTTTTTTGTTATAGATATTCTTTATCTTTATATTATATA -TATATATATTTTTTTTCATTTTCTATATTTTTTTCTATATTTTATTATATTATTATATATATATATATTCTTTTTGATTA -TTTGATTATATAAATATATATATCCTATATTTAAATATATAATATATATATAATATATATCCTATATATAAATTATATAA -ATCCTCTATTATATATATAATATATATATAATATATATTATATAATATATATATTACTATTATATAACTGTTTTTATAGA -ACTTTCTCAGCAATTCTAGTTACATTAAAAATTTAGCTAAAGATTAGATAAAAAAGGCGCGAACTCAAAAAAGAAATAAA -TAAAACCATAATCATAGAAATAGAGAATCCTTTTTTTATTTTGTCTCGTCAAAACAAAAACACAAGTAAAAGATCTTTTT -TATTTTAATAGCCTGGCCTGGTCAGTCCCCAGCCGGGCCTTTTTTTGTTAAAATTAAAAAGACTCATCCGATGGATTTTT -AGATAAAAAAAGATTTGAAATAAAAAAAAAAGTGGAATTGAATTCGCTTTTACTAATTTTCTTAAGTCAACTCTAGTTTT -TTCTAAATTTTTTCAGATTTTTTTATTACACCCCCGATTACTTTGTTCGACAAAAGGTTAATTTATATGCAATAATTGCA -TTGTAGCGGGTATAGTTTAGTGGTAAAAGTGTGATTCGTTCCTTTAATCCCTTTAATAGTTAAAGGGTCTCTCGGTTTGA -TTAATCTTCCGATCAAAAATTTTATTTCTTAAAAGGATTTAGTCCTTTCCCTTTCAATGAAAGATTCAAGGAAGATTATA -GATTCTCGTAATTTATATCCAAAGACTCTAATCAATTGTAAATTTGGATTATGAAATTCCGAAACATAATTTTTGAATTG -GATGACTATTTACAATTCAATAAGTATAACAAGAGGATCCATGGATAAAGCTAGAAAAGTGTCTTTCTAATCGTAACTAA -ATCTTCAGTTCTATTCATTGTTTGGTATAGAAAAATTGAAGCAAAATAGCTATTAAACGAGAACTTTGGTTTACTAAAGA -CATCGACATATTATATTGTTTTAGCTCGGTAGAAACCAAATACTTTTCCTAAGGATTCCGTTAAATAGAAATAAAGAACG -AAGTAACTAGAAAGATTGTTCGAGTTGGCCCGATCTATCTTCTAGAAGGATCATCTAGAAAGCAAAATTTTCTGTGAAAG -TACCCAGACGGAAAAAAGCTCACATAGATGTTATGGGTCGAATTTTTATTTCGTTCCCGTCTTTTTTTATTTGGGAATTT -CTCCATCCATCATAAAGGAGCCGAATGAAACCAAAGTTTCATGTTCGGTTTTGAATTAGAGACGTTAAAAATATAAAAAT -GATCAATCGACGTCGACTAAAACCCTTAGCCTTCCAAGCTAACGATGCGGGTTCGATTCCCGCTACCCGCTCTAAATTCA -CAATTGCCCTTTTTTTTTATTAGAGAAAATTTGTTATATTAGAATTGTCTAATAGCAATTGTGTATTGAATTCACTTCAA -TACACAATTGCTAAAAAGATTTTGCACATTCTTTTTTTTTAACAATAGGAAAGTAAAAAAAAGCGAAAAGCGTCCATTGT -CTAATGGATAGGACATAGGTCTTCTAAACCTTTGGTATAGGTTCAAATCCTATTGGACGCAATATAAATATATCTATATT -GATATTTATCTATTATTTCCATTTCTATATATTATATATAATATCTATTTCGAAAAAAGATAAGAAATAAATAGAATAAG -AAAGAAATTCTGAATGCTTTAAGATTTAATATTAAACAGATATTAGTTAGATACTTCTTTCTATTATATATACTTGACTT -ATAGACTTCTATTTCTAGAATTTCTTAAAAAATTAATTAAAATTAAAGAGTAAAATTGACTAAAGAATCAAAAATTAAGA -ATAATCCGTTTCGTTTTTTATACTTTCTCCTGAAGTAGGAAACGTTCTAGTTGCTCTTGAATACCTTCTTTCAAAAAGCT diff --git a/case-studies/extract-fasta/foo.gff b/case-studies/extract-fasta/foo.gff deleted file mode 100644 index ead25d17..00000000 --- a/case-studies/extract-fasta/foo.gff +++ /dev/null @@ -1,282 +0,0 @@ -Chr1 phytozomev10 gene 3631 5899 . + . ID=AT1G01010;Name=AT1G01010 -Chr1 phytozomev10 mRNA 3631 5899 . + . ID=AT1G01010.1;Name=AT1G01010.1;pacid=19656964;longest=1;Parent=AT1G01010 -Chr1 phytozomev10 exon 3631 3913 . + . ID=AT1G01010.1.exon.1;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 five_prime_UTR 3631 3759 . + . ID=AT1G01010.1.five_prime_UTR.1;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 CDS 3760 3913 . + 0 ID=AT1G01010.1.CDS.1;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 exon 3996 4276 . + . ID=AT1G01010.1.exon.2;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 CDS 3996 4276 . + 2 ID=AT1G01010.1.CDS.2;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 exon 4486 4605 . + . ID=AT1G01010.1.exon.3;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 CDS 4486 4605 . + 0 ID=AT1G01010.1.CDS.3;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 exon 4706 5095 . + . ID=AT1G01010.1.exon.4;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 CDS 4706 5095 . + 0 ID=AT1G01010.1.CDS.4;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 exon 5174 5326 . + . ID=AT1G01010.1.exon.5;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 CDS 5174 5326 . + 0 ID=AT1G01010.1.CDS.5;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 exon 5439 5899 . + . ID=AT1G01010.1.exon.6;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 CDS 5439 5630 . + 0 ID=AT1G01010.1.CDS.6;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 three_prime_UTR 5631 5899 . + . ID=AT1G01010.1.three_prime_UTR.1;Parent=AT1G01010.1;pacid=19656964 -Chr1 phytozomev10 gene 5928 8737 . - . ID=AT1G01020;Name=AT1G01020 -Chr1 phytozomev10 mRNA 5928 8737 . - . ID=AT1G01020.1;Name=AT1G01020.1;pacid=19655142;longest=1;Parent=AT1G01020 -Chr1 phytozomev10 exon 8571 8737 . - . ID=AT1G01020.1.exon.1;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 CDS 8571 8666 . - 0 ID=AT1G01020.1.CDS.1;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 five_prime_UTR 8667 8737 . - . ID=AT1G01020.1.five_prime_UTR.1;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 exon 8417 8464 . - . ID=AT1G01020.1.exon.2;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 CDS 8417 8464 . - 0 ID=AT1G01020.1.CDS.2;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 exon 8236 8325 . - . ID=AT1G01020.1.exon.3;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 CDS 8236 8325 . - 0 ID=AT1G01020.1.CDS.3;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 exon 7942 7987 . - . ID=AT1G01020.1.exon.4;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 CDS 7942 7987 . - 0 ID=AT1G01020.1.CDS.4;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 exon 7762 7835 . - . ID=AT1G01020.1.exon.5;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 CDS 7762 7835 . - 2 ID=AT1G01020.1.CDS.5;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 exon 7564 7649 . - . ID=AT1G01020.1.exon.6;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 CDS 7564 7649 . - 0 ID=AT1G01020.1.CDS.6;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 exon 7384 7450 . - . ID=AT1G01020.1.exon.7;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 CDS 7384 7450 . - 1 ID=AT1G01020.1.CDS.7;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 exon 7157 7232 . - . ID=AT1G01020.1.exon.8;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 CDS 7157 7232 . - 0 ID=AT1G01020.1.CDS.8;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 exon 6437 7069 . - . ID=AT1G01020.1.exon.9;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 three_prime_UTR 6437 6914 . - . ID=AT1G01020.1.three_prime_UTR.1;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 CDS 6915 7069 . - 2 ID=AT1G01020.1.CDS.9;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 exon 5928 6263 . - . ID=AT1G01020.1.exon.10;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 three_prime_UTR 5928 6263 . - . ID=AT1G01020.1.three_prime_UTR.2;Parent=AT1G01020.1;pacid=19655142 -Chr1 phytozomev10 mRNA 6790 8737 . - . ID=AT1G01020.2;Name=AT1G01020.2;pacid=19655143;longest=0;Parent=AT1G01020 -Chr1 phytozomev10 exon 8571 8737 . - . ID=AT1G01020.2.exon.1;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 CDS 8571 8666 . - 0 ID=AT1G01020.2.CDS.1;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 five_prime_UTR 8667 8737 . - . ID=AT1G01020.2.five_prime_UTR.1;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 exon 8417 8464 . - . ID=AT1G01020.2.exon.2;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 CDS 8417 8464 . - 0 ID=AT1G01020.2.CDS.2;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 exon 8236 8325 . - . ID=AT1G01020.2.exon.3;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 CDS 8236 8325 . - 0 ID=AT1G01020.2.CDS.3;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 exon 7942 7987 . - . ID=AT1G01020.2.exon.4;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 CDS 7942 7987 . - 0 ID=AT1G01020.2.CDS.4;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 exon 7762 7835 . - . ID=AT1G01020.2.exon.5;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 CDS 7762 7835 . - 2 ID=AT1G01020.2.CDS.5;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 exon 7564 7649 . - . ID=AT1G01020.2.exon.6;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 CDS 7564 7649 . - 0 ID=AT1G01020.2.CDS.6;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 exon 7157 7450 . - . ID=AT1G01020.2.exon.7;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 three_prime_UTR 7157 7314 . - . ID=AT1G01020.2.three_prime_UTR.1;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 CDS 7315 7450 . - 1 ID=AT1G01020.2.CDS.7;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 exon 6790 7069 . - . ID=AT1G01020.2.exon.8;Parent=AT1G01020.2;pacid=19655143 -Chr1 phytozomev10 three_prime_UTR 6790 7069 . - . ID=AT1G01020.2.three_prime_UTR.2;Parent=AT1G01020.2;pacid=19655143 -Chr2 phytozomev10 gene 1025 2810 . + . ID=AT2G01008;Name=AT2G01008 -Chr2 phytozomev10 mRNA 1025 2810 . + . ID=AT2G01008.1;Name=AT2G01008.1;pacid=19640247;longest=1;Parent=AT2G01008 -Chr2 phytozomev10 exon 1025 1272 . + . ID=AT2G01008.1.exon.1;Parent=AT2G01008.1;pacid=19640247 -Chr2 phytozomev10 CDS 1025 1272 . + 0 ID=AT2G01008.1.CDS.1;Parent=AT2G01008.1;pacid=19640247 -Chr2 phytozomev10 exon 1458 1510 . + . ID=AT2G01008.1.exon.2;Parent=AT2G01008.1;pacid=19640247 -Chr2 phytozomev10 CDS 1458 1510 . + 1 ID=AT2G01008.1.CDS.2;Parent=AT2G01008.1;pacid=19640247 -Chr2 phytozomev10 exon 1873 2810 . + . ID=AT2G01008.1.exon.3;Parent=AT2G01008.1;pacid=19640247 -Chr2 phytozomev10 CDS 1873 2111 . + 2 ID=AT2G01008.1.CDS.3;Parent=AT2G01008.1;pacid=19640247 -Chr2 phytozomev10 three_prime_UTR 2112 2810 . + . ID=AT2G01008.1.three_prime_UTR.1;Parent=AT2G01008.1;pacid=19640247 -Chr2 phytozomev10 gene 6571 6672 . + . ID=AT2G01021;Name=AT2G01021 -Chr2 phytozomev10 mRNA 6571 6672 . + . ID=AT2G01021.1;Name=AT2G01021.1;pacid=19640291;longest=1;Parent=AT2G01021 -Chr2 phytozomev10 exon 6571 6672 . + . ID=AT2G01021.1.exon.1;Parent=AT2G01021.1;pacid=19640291 -Chr2 phytozomev10 CDS 6571 6672 . + 0 ID=AT2G01021.1.CDS.1;Parent=AT2G01021.1;pacid=19640291 -Chr2 phytozomev10 gene 9648 9767 . - . ID=AT2G01023;Name=AT2G01023 -Chr2 phytozomev10 mRNA 9648 9767 . - . ID=AT2G01023.1;Name=AT2G01023.1;pacid=19638712;longest=1;Parent=AT2G01023 -Chr2 phytozomev10 exon 9648 9767 . - . ID=AT2G01023.1.exon.1;Parent=AT2G01023.1;pacid=19638712 -Chr2 phytozomev10 CDS 9648 9767 . - 0 ID=AT2G01023.1.CDS.1;Parent=AT2G01023.1;pacid=19638712 -Chr3 phytozomev10 gene 4342 4818 . + . ID=AT3G01010;Name=AT3G01010 -Chr3 phytozomev10 mRNA 4342 4818 . + . ID=AT3G01010.1;Name=AT3G01010.1;pacid=19663886;longest=1;Parent=AT3G01010 -Chr3 phytozomev10 exon 4342 4818 . + . ID=AT3G01010.1.exon.1;Parent=AT3G01010.1;pacid=19663886 -Chr3 phytozomev10 CDS 4342 4818 . + 0 ID=AT3G01010.1.CDS.1;Parent=AT3G01010.1;pacid=19663886 -Chr3 phytozomev10 gene 1653 4159 . - . ID=AT3G01015;Name=AT3G01015 -Chr3 phytozomev10 mRNA 1653 4159 . - . ID=AT3G01015.1;Name=AT3G01015.1;pacid=19662121;longest=1;Parent=AT3G01015 -Chr3 phytozomev10 exon 3203 4159 . - . ID=AT3G01015.1.exon.1;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 CDS 3203 4017 . - 0 ID=AT3G01015.1.CDS.1;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 five_prime_UTR 4018 4159 . - . ID=AT3G01015.1.five_prime_UTR.1;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 exon 3064 3109 . - . ID=AT3G01015.1.exon.2;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 CDS 3064 3109 . - 1 ID=AT3G01015.1.CDS.2;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 exon 2885 2977 . - . ID=AT3G01015.1.exon.3;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 CDS 2885 2977 . - 0 ID=AT3G01015.1.CDS.3;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 exon 2690 2809 . - . ID=AT3G01015.1.exon.4;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 CDS 2690 2809 . - 0 ID=AT3G01015.1.CDS.4;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 exon 2428 2526 . - . ID=AT3G01015.1.exon.5;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 CDS 2428 2526 . - 0 ID=AT3G01015.1.CDS.5;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 exon 2223 2282 . - . ID=AT3G01015.1.exon.6;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 CDS 2223 2282 . - 0 ID=AT3G01015.1.CDS.6;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 exon 2048 2142 . - . ID=AT3G01015.1.exon.7;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 CDS 2048 2142 . - 0 ID=AT3G01015.1.CDS.7;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 exon 1653 1936 . - . ID=AT3G01015.1.exon.8;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 three_prime_UTR 1653 1797 . - . ID=AT3G01015.1.three_prime_UTR.1;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 CDS 1798 1936 . - 1 ID=AT3G01015.1.CDS.8;Parent=AT3G01015.1;pacid=19662121 -Chr3 phytozomev10 gene 5104 6049 . + . ID=AT3G01020;Name=AT3G01020 -Chr3 phytozomev10 mRNA 5104 6049 . + . ID=AT3G01020.1;Name=AT3G01020.1;pacid=19659067;longest=1;Parent=AT3G01020 -Chr3 phytozomev10 exon 5104 5427 . + . ID=AT3G01020.1.exon.1;Parent=AT3G01020.1;pacid=19659067 -Chr3 phytozomev10 five_prime_UTR 5104 5138 . + . ID=AT3G01020.1.five_prime_UTR.1;Parent=AT3G01020.1;pacid=19659067 -Chr3 phytozomev10 CDS 5139 5427 . + 0 ID=AT3G01020.1.CDS.1;Parent=AT3G01020.1;pacid=19659067 -Chr3 phytozomev10 exon 5536 5590 . + . ID=AT3G01020.1.exon.2;Parent=AT3G01020.1;pacid=19659067 -Chr3 phytozomev10 CDS 5536 5590 . + 2 ID=AT3G01020.1.CDS.2;Parent=AT3G01020.1;pacid=19659067 -Chr3 phytozomev10 exon 5746 6049 . + . ID=AT3G01020.1.exon.3;Parent=AT3G01020.1;pacid=19659067 -Chr3 phytozomev10 CDS 5746 5893 . + 1 ID=AT3G01020.1.CDS.3;Parent=AT3G01020.1;pacid=19659067 -Chr3 phytozomev10 three_prime_UTR 5894 6049 . + . ID=AT3G01020.1.three_prime_UTR.1;Parent=AT3G01020.1;pacid=19659067 -Chr3 phytozomev10 gene 6657 7772 . + . ID=AT3G01030;Name=AT3G01030 -Chr3 phytozomev10 mRNA 6657 7772 . + . ID=AT3G01030.1;Name=AT3G01030.1;pacid=19659060;longest=1;Parent=AT3G01030 -Chr3 phytozomev10 exon 6657 7772 . + . ID=AT3G01030.1.exon.1;Parent=AT3G01030.1;pacid=19659060 -Chr3 phytozomev10 CDS 6657 7772 . + 0 ID=AT3G01030.1.CDS.1;Parent=AT3G01030.1;pacid=19659060 -Chr4 phytozomev10 gene 1180 1536 . - . ID=AT4G00005;Name=AT4G00005 -Chr4 phytozomev10 mRNA 1180 1536 . - . ID=AT4G00005.1;Name=AT4G00005.1;pacid=19645541;longest=1;Parent=AT4G00005 -Chr4 phytozomev10 exon 1180 1536 . - . ID=AT4G00005.1.exon.1;Parent=AT4G00005.1;pacid=19645541 -Chr4 phytozomev10 CDS 1180 1536 . - 0 ID=AT4G00005.1.CDS.1;Parent=AT4G00005.1;pacid=19645541 -Chr5 phytozomev10 gene 1223 5061 . - . ID=AT5G01010;Name=AT5G01010 -Chr5 phytozomev10 mRNA 1279 4994 . - . ID=AT5G01010.2;Name=AT5G01010.2;pacid=19672579;longest=1;Parent=AT5G01010 -Chr5 phytozomev10 exon 4765 4994 . - . ID=AT5G01010.2.exon.1;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 4765 4924 . - 0 ID=AT5G01010.2.CDS.1;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 five_prime_UTR 4925 4994 . - . ID=AT5G01010.2.five_prime_UTR.1;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 4552 4679 . - . ID=AT5G01010.2.exon.2;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 4552 4679 . - 2 ID=AT5G01010.2.CDS.2;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 4335 4467 . - . ID=AT5G01010.2.exon.3;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 4335 4467 . - 0 ID=AT5G01010.2.CDS.3;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 4102 4258 . - . ID=AT5G01010.2.exon.4;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 4102 4258 . - 2 ID=AT5G01010.2.CDS.4;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 3927 4005 . - . ID=AT5G01010.2.exon.5;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 3927 4005 . - 1 ID=AT5G01010.2.CDS.5;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 3762 3802 . - . ID=AT5G01010.2.exon.6;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 3762 3802 . - 0 ID=AT5G01010.2.CDS.6;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 3543 3659 . - . ID=AT5G01010.2.exon.7;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 3543 3659 . - 1 ID=AT5G01010.2.CDS.7;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 3303 3383 . - . ID=AT5G01010.2.exon.8;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 3303 3383 . - 1 ID=AT5G01010.2.CDS.8;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 2872 2934 . - . ID=AT5G01010.2.exon.9;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 2872 2934 . - 1 ID=AT5G01010.2.CDS.9;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 2748 2799 . - . ID=AT5G01010.2.exon.10;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 2748 2799 . - 1 ID=AT5G01010.2.CDS.10;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 2435 2509 . - . ID=AT5G01010.2.exon.11;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 2435 2509 . - 0 ID=AT5G01010.2.CDS.11;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 2105 2181 . - . ID=AT5G01010.2.exon.12;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 2105 2181 . - 0 ID=AT5G01010.2.CDS.12;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 1914 2007 . - . ID=AT5G01010.2.exon.13;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 1914 2007 . - 1 ID=AT5G01010.2.CDS.13;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 1745 1780 . - . ID=AT5G01010.2.exon.14;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 1745 1780 . - 0 ID=AT5G01010.2.CDS.14;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 1572 1646 . - . ID=AT5G01010.2.exon.15;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 1572 1646 . - 0 ID=AT5G01010.2.CDS.15;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 exon 1279 1459 . - . ID=AT5G01010.2.exon.16;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 three_prime_UTR 1279 1387 . - . ID=AT5G01010.2.three_prime_UTR.1;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 CDS 1388 1459 . - 0 ID=AT5G01010.2.CDS.16;Parent=AT5G01010.2;pacid=19672579 -Chr5 phytozomev10 mRNA 1223 5061 . - . ID=AT5G01010.4;Name=AT5G01010.4;pacid=19672580;longest=0;Parent=AT5G01010 -Chr5 phytozomev10 exon 4765 5061 . - . ID=AT5G01010.4.exon.1;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 4765 4924 . - 0 ID=AT5G01010.4.CDS.1;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 five_prime_UTR 4925 5061 . - . ID=AT5G01010.4.five_prime_UTR.1;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 4552 4679 . - . ID=AT5G01010.4.exon.2;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 4552 4679 . - 2 ID=AT5G01010.4.CDS.2;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 4335 4467 . - . ID=AT5G01010.4.exon.3;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 4335 4467 . - 0 ID=AT5G01010.4.CDS.3;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 4102 4237 . - . ID=AT5G01010.4.exon.4;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 4102 4237 . - 2 ID=AT5G01010.4.CDS.4;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 3927 4005 . - . ID=AT5G01010.4.exon.5;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 3927 4005 . - 1 ID=AT5G01010.4.CDS.5;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 3762 3802 . - . ID=AT5G01010.4.exon.6;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 3762 3802 . - 0 ID=AT5G01010.4.CDS.6;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 3543 3659 . - . ID=AT5G01010.4.exon.7;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 3543 3659 . - 1 ID=AT5G01010.4.CDS.7;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 3303 3383 . - . ID=AT5G01010.4.exon.8;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 3303 3383 . - 1 ID=AT5G01010.4.CDS.8;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 2872 2934 . - . ID=AT5G01010.4.exon.9;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 2872 2934 . - 1 ID=AT5G01010.4.CDS.9;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 2748 2799 . - . ID=AT5G01010.4.exon.10;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 2748 2799 . - 1 ID=AT5G01010.4.CDS.10;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 2435 2509 . - . ID=AT5G01010.4.exon.11;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 2435 2509 . - 0 ID=AT5G01010.4.CDS.11;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 2105 2181 . - . ID=AT5G01010.4.exon.12;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 2105 2181 . - 0 ID=AT5G01010.4.CDS.12;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 1914 2007 . - . ID=AT5G01010.4.exon.13;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 1914 2007 . - 1 ID=AT5G01010.4.CDS.13;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 1745 1780 . - . ID=AT5G01010.4.exon.14;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 1745 1780 . - 0 ID=AT5G01010.4.CDS.14;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 1572 1646 . - . ID=AT5G01010.4.exon.15;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 1572 1646 . - 0 ID=AT5G01010.4.CDS.15;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 exon 1223 1459 . - . ID=AT5G01010.4.exon.16;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 three_prime_UTR 1223 1387 . - . ID=AT5G01010.4.three_prime_UTR.1;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 CDS 1388 1459 . - 0 ID=AT5G01010.4.CDS.16;Parent=AT5G01010.4;pacid=19672580 -Chr5 phytozomev10 mRNA 1251 5043 . - . ID=AT5G01010.1;Name=AT5G01010.1;pacid=19672581;longest=0;Parent=AT5G01010 -Chr5 phytozomev10 exon 4765 5043 . - . ID=AT5G01010.1.exon.1;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 4765 4924 . - 0 ID=AT5G01010.1.CDS.1;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 five_prime_UTR 4925 5043 . - . ID=AT5G01010.1.five_prime_UTR.1;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 4552 4679 . - . ID=AT5G01010.1.exon.2;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 4552 4679 . - 2 ID=AT5G01010.1.CDS.2;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 4335 4467 . - . ID=AT5G01010.1.exon.3;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 4335 4467 . - 0 ID=AT5G01010.1.CDS.3;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 4102 4258 . - . ID=AT5G01010.1.exon.4;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 4102 4258 . - 2 ID=AT5G01010.1.CDS.4;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 3927 4005 . - . ID=AT5G01010.1.exon.5;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 3927 4005 . - 1 ID=AT5G01010.1.CDS.5;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 3762 3802 . - . ID=AT5G01010.1.exon.6;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 3762 3802 . - 0 ID=AT5G01010.1.CDS.6;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 3543 3659 . - . ID=AT5G01010.1.exon.7;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 3543 3659 . - 1 ID=AT5G01010.1.CDS.7;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 3303 3383 . - . ID=AT5G01010.1.exon.8;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 3303 3383 . - 1 ID=AT5G01010.1.CDS.8;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 2872 2934 . - . ID=AT5G01010.1.exon.9;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 2872 2934 . - 1 ID=AT5G01010.1.CDS.9;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 2748 2799 . - . ID=AT5G01010.1.exon.10;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 2748 2799 . - 1 ID=AT5G01010.1.CDS.10;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 2435 2509 . - . ID=AT5G01010.1.exon.11;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 2435 2509 . - 0 ID=AT5G01010.1.CDS.11;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 1914 1961 . - . ID=AT5G01010.1.exon.12;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 1914 1961 . - 0 ID=AT5G01010.1.CDS.12;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 1745 1780 . - . ID=AT5G01010.1.exon.13;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 1745 1780 . - 0 ID=AT5G01010.1.CDS.13;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 1572 1646 . - . ID=AT5G01010.1.exon.14;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 1572 1646 . - 0 ID=AT5G01010.1.CDS.14;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 exon 1251 1459 . - . ID=AT5G01010.1.exon.15;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 three_prime_UTR 1251 1387 . - . ID=AT5G01010.1.three_prime_UTR.1;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 CDS 1388 1459 . - 0 ID=AT5G01010.1.CDS.15;Parent=AT5G01010.1;pacid=19672581 -Chr5 phytozomev10 mRNA 1279 5043 . - . ID=AT5G01010.3;Name=AT5G01010.3;pacid=19672582;longest=0;Parent=AT5G01010 -Chr5 phytozomev10 exon 4765 5043 . - . ID=AT5G01010.3.exon.1;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 4765 4924 . - 0 ID=AT5G01010.3.CDS.1;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 five_prime_UTR 4925 5043 . - . ID=AT5G01010.3.five_prime_UTR.1;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 exon 4552 4679 . - . ID=AT5G01010.3.exon.2;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 4552 4679 . - 2 ID=AT5G01010.3.CDS.2;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 exon 4335 4467 . - . ID=AT5G01010.3.exon.3;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 4335 4467 . - 0 ID=AT5G01010.3.CDS.3;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 exon 4102 4258 . - . ID=AT5G01010.3.exon.4;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 4102 4258 . - 2 ID=AT5G01010.3.CDS.4;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 exon 3927 4005 . - . ID=AT5G01010.3.exon.5;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 3927 4005 . - 1 ID=AT5G01010.3.CDS.5;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 exon 3762 3802 . - . ID=AT5G01010.3.exon.6;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 3762 3802 . - 0 ID=AT5G01010.3.CDS.6;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 exon 3543 3659 . - . ID=AT5G01010.3.exon.7;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 3543 3659 . - 1 ID=AT5G01010.3.CDS.7;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 exon 3303 3383 . - . ID=AT5G01010.3.exon.8;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 3303 3383 . - 1 ID=AT5G01010.3.CDS.8;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 exon 2872 2934 . - . ID=AT5G01010.3.exon.9;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 2872 2934 . - 1 ID=AT5G01010.3.CDS.9;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 exon 2748 2799 . - . ID=AT5G01010.3.exon.10;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 2748 2799 . - 1 ID=AT5G01010.3.CDS.10;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 exon 2435 2509 . - . ID=AT5G01010.3.exon.11;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 2435 2509 . - 0 ID=AT5G01010.3.CDS.11;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 exon 1914 1961 . - . ID=AT5G01010.3.exon.12;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 1914 1961 . - 0 ID=AT5G01010.3.CDS.12;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 exon 1745 1780 . - . ID=AT5G01010.3.exon.13;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 1745 1780 . - 0 ID=AT5G01010.3.CDS.13;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 exon 1279 1646 . - . ID=AT5G01010.3.exon.14;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 three_prime_UTR 1279 1526 . - . ID=AT5G01010.3.three_prime_UTR.1;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 CDS 1527 1646 . - 0 ID=AT5G01010.3.CDS.14;Parent=AT5G01010.3;pacid=19672582 -Chr5 phytozomev10 gene 5256 5891 . - . ID=AT5G01015;Name=AT5G01015 -Chr5 phytozomev10 mRNA 5256 5891 . - . ID=AT5G01015.1;Name=AT5G01015.1;pacid=19666270;longest=1;Parent=AT5G01015 -Chr5 phytozomev10 exon 5697 5891 . - . ID=AT5G01015.1.exon.1;Parent=AT5G01015.1;pacid=19666270 -Chr5 phytozomev10 CDS 5697 5769 . - 0 ID=AT5G01015.1.CDS.1;Parent=AT5G01015.1;pacid=19666270 -Chr5 phytozomev10 five_prime_UTR 5770 5891 . - . ID=AT5G01015.1.five_prime_UTR.1;Parent=AT5G01015.1;pacid=19666270 -Chr5 phytozomev10 exon 5256 5576 . - . ID=AT5G01015.1.exon.2;Parent=AT5G01015.1;pacid=19666270 -Chr5 phytozomev10 three_prime_UTR 5256 5334 . - . ID=AT5G01015.1.three_prime_UTR.1;Parent=AT5G01015.1;pacid=19666270 -Chr5 phytozomev10 CDS 5335 5576 . - 2 ID=AT5G01015.1.CDS.2;Parent=AT5G01015.1;pacid=19666270 -Chr5 phytozomev10 mRNA 5367 5801 . - . ID=AT5G01015.2;Name=AT5G01015.2;pacid=19666271;longest=0;Parent=AT5G01015 -Chr5 phytozomev10 exon 5687 5801 . - . ID=AT5G01015.2.exon.1;Parent=AT5G01015.2;pacid=19666271 -Chr5 phytozomev10 CDS 5687 5769 . - 0 ID=AT5G01015.2.CDS.1;Parent=AT5G01015.2;pacid=19666271 -Chr5 phytozomev10 five_prime_UTR 5770 5801 . - . ID=AT5G01015.2.five_prime_UTR.1;Parent=AT5G01015.2;pacid=19666271 -Chr5 phytozomev10 exon 5367 5576 . - . ID=AT5G01015.2.exon.2;Parent=AT5G01015.2;pacid=19666271 -Chr5 phytozomev10 three_prime_UTR 5367 5515 . - . ID=AT5G01015.2.three_prime_UTR.1;Parent=AT5G01015.2;pacid=19666271 -Chr5 phytozomev10 CDS 5516 5576 . - 1 ID=AT5G01015.2.CDS.2;Parent=AT5G01015.2;pacid=19666271 -Chr5 phytozomev10 gene 5917 8444 . - . ID=AT5G01020;Name=AT5G01020 -Chr5 phytozomev10 mRNA 5917 8444 . - . ID=AT5G01020.1;Name=AT5G01020.1;pacid=19669508;longest=1;Parent=AT5G01020 -Chr5 phytozomev10 exon 8216 8444 . - . ID=AT5G01020.1.exon.1;Parent=AT5G01020.1;pacid=19669508 -Chr5 phytozomev10 CDS 8216 8270 . - 0 ID=AT5G01020.1.CDS.1;Parent=AT5G01020.1;pacid=19669508 -Chr5 phytozomev10 five_prime_UTR 8271 8444 . - . ID=AT5G01020.1.five_prime_UTR.1;Parent=AT5G01020.1;pacid=19669508 -Chr5 phytozomev10 exon 7705 8139 . - . ID=AT5G01020.1.exon.2;Parent=AT5G01020.1;pacid=19669508 -Chr5 phytozomev10 CDS 7705 8139 . - 2 ID=AT5G01020.1.CDS.2;Parent=AT5G01020.1;pacid=19669508 -Chr5 phytozomev10 exon 7440 7576 . - . ID=AT5G01020.1.exon.3;Parent=AT5G01020.1;pacid=19669508 -Chr5 phytozomev10 CDS 7440 7576 . - 2 ID=AT5G01020.1.CDS.3;Parent=AT5G01020.1;pacid=19669508 -Chr5 phytozomev10 exon 7212 7335 . - . ID=AT5G01020.1.exon.4;Parent=AT5G01020.1;pacid=19669508 -Chr5 phytozomev10 CDS 7212 7335 . - 0 ID=AT5G01020.1.CDS.4;Parent=AT5G01020.1;pacid=19669508 -Chr5 phytozomev10 exon 5917 6790 . - . ID=AT5G01020.1.exon.5;Parent=AT5G01020.1;pacid=19669508 -Chr5 phytozomev10 three_prime_UTR 5917 6308 . - . ID=AT5G01020.1.three_prime_UTR.1;Parent=AT5G01020.1;pacid=19669508 -Chr5 phytozomev10 CDS 6309 6790 . - 2 ID=AT5G01020.1.CDS.5;Parent=AT5G01020.1;pacid=19669508 diff --git a/case-studies/extract-fasta/parse_gff.loc b/case-studies/extract-fasta/parse_gff.loc deleted file mode 100644 index 531400ac..00000000 --- a/case-studies/extract-fasta/parse_gff.loc +++ /dev/null @@ -1,46 +0,0 @@ -@type -read_tsv :: File -> Table -subset,nameG :: Table -> Table -extract :: Table -> File -> Text - -@path -null . extract . - ( nameG . subset . read_tsv . 'foo.gff' ) - 'foo.fna' - -@lang -* :: R -extract,null :: sh - -@include -core/atomic - -@after -null :: cp . 'z.fna' - -@lang -cp :: sh - -@arg -nameG :: tag="ID" -subset :: `name == "gene" & stop - start < 1200` -read_tsv :: - na = '.' - col_types = 'ccciinccc' - col_names = - ['seqid' , 'source' , 'name' , - 'start' , 'stop' , 'score' , - 'strand' , 'phase' , 'attr' ] - -@source R -require(readr) -nameG <- function(x, tag="ID"){ - pat <- sprintf('.*%s=([^;]+).*', tag) - x$name <- sub(pat, '\\1', x$attr, perl=TRUE) - x -} - -@source sh -extract () { - bedtools getfasta -fi $2 -bed $1 -fo /dev/stdout -s -name -} diff --git a/case-studies/mitochondria/README.md b/case-studies/mitochondria/README.md deleted file mode 100644 index 75af0405..00000000 --- a/case-studies/mitochondria/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# Find top hits against mitochondrial proteins - -This is a Morloc implementation of my bcb660-project repo's code. - -The core workflow does the following: - - 1. Retrieve all mitochondrial genomes - - 2. Based on the NCBI common tree, extract all mitochondria underneath - a given taxon - - 3. extract proteins from the mitochondria based on a pattern - - 4. Prepare a blast database from an input fasta file - - 5. blast selected mitochondrial proteins against database - - 6. map the reference to species name (by fasta header parsing) - - 7. merge blast result and ref2species maps, for final table - - 8. aggregate the results on species and bitscore - - 9. throw away the results - -The orthogonal pathways - - 1. plot the final result - - 2. assert that the references in ref2name and blast result table match - - 3. assert that the bitscore column is positvie integer - - 4. assert that the bitscore column is reasonably distributed diff --git a/case-studies/mitochondria/morloc-imp.loc b/case-studies/mitochondria/morloc-imp.loc deleted file mode 100644 index ef3884d4..00000000 --- a/case-studies/mitochondria/morloc-imp.loc +++ /dev/null @@ -1,121 +0,0 @@ -@type -# Functions of *Main -aggregate :: Int -> Int -> Table -ref2name :: File -> Table -uncomment :: Table -> Table -tblastn :: File -> File -> Table -makeblastdb :: File -> File -fastq2fasta :: File -> File -cat :: [File] -> File -gunzip :: File -> File -wget :: File -> File -get_children :: Int -> File -> File - -# Functions of *faa -fasta_grep :: [String] -> File -> File -taxid2sciname :: Void -> Table -get_taxid_children :: Int -> Table - -@path sh -main :: - null . - aggregate . - 2 # name - 8 # bitscore - merge . - 1 1 - ( ref2name . *faa ) - ( uncomment . tblastn . *faa ( makeblastdb . fastaq2fasta . cat . *db ) ) - -faa :: - fasta_grep . - ( cut . `-f2` merge . 1 1 taxid2sciname (get_taxid_children . *focal_taxid) ) - ( gunzip . wget . *mitochondria_proteins ) - -db :: "reads.fastq" -focal_taxid :: 6656 # The arthropoda phylum taxid id -mitochondria_proteins :: 'ftp://ftp.ncbi.nlm.nih.gov/refseq/release/mitochondrion/mitochondrion.1.protein.faa.gz' - -@before -null :: setup_litade -null :: setup_smof - -@after -null :: hist . nthcol . 2 - -@arg -tblastn :: - -task tblastn-fast - -evalue 0.001 - -num_threads 8 - -max_target_seqs 1000000000 - -outfmt '7 qseqid sseqid qlen slen qstart qstop sstart sstop bitscore pident positive evalue' - -@include -core/atomic -core/table - -@alias -tblastn :: morloc_tblastn -makeblastdb :: morloc_makeblastdb - -@source sh - -setup_litade () { - git clone https://github.com/arendsee/litade - cd litade && ./setup.sh && cd .. -} - -setup_smof () { - git clone https://github.com/arendsee/smof -} - -get_taxid_children () { - taxid=$1 - perl litade.pl $taxid | cut -f2 -} - -taxid2sciname () { - # Get the taxonomy dump - wget -O - ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdmp.zip | - unzip -p taxdmp.zip names.dmp | - # Build a map from Taxon Id to Scientific name - sed 's/[\t ]*|[\t ]*/\t/g' names.dmp | - awk ' - BEGIN{FS="\t"; OFS="\t"} - /scientific name/ {print $1,$2} - ' -} - -fasta_grep () { - # Extract the protein sequence of all arthropods - smof grep -w '\[([^\]]+)\]' -f $1 $2 -} - -fastq2fasta () { - awk 'NR % 4 == 1 {print ">" $0} NR % 4 == 2 {print}' $1 -} - -morloc_makeblastdb () { - makeblastdb -in $1 -dbtype nucl -out blastdb/foo -title foo - echo blastdb/foo -} - -morloc_tblastn () { - query=${@: -2:1} - db=${@: -1:1} - options=${@: 1: ${#@} - 2} - tblastn $options -query $query -db $db -} - -ref2name () { - sed -nr 's/>([^ ]+).*\[(.*)\]/\1\t\2/p' $1 | tr ' ' '_' -} - -aggregate () { - awk -v SCORE=$1 -v NAME=$2 ' - BEGIN{ FS="\t" ; OFS="\t" } - $SCORE > a[$NAME] { a[$NAME] = $SCORE } - END { for (k in a){ print k, a[k] } } - ' $3 -} diff --git a/data/common/binary.json b/data/common/binary.json new file mode 100644 index 00000000..f249e469 --- /dev/null +++ b/data/common/binary.json @@ -0,0 +1 @@ +{ "type":"Binary", "value":"Not implemented" } diff --git a/data/common/bool.json b/data/common/bool.json new file mode 100644 index 00000000..d3679857 --- /dev/null +++ b/data/common/bool.json @@ -0,0 +1 @@ +{ "type":"Bool", "value":"true" } diff --git a/data/common/char.json b/data/common/char.json new file mode 100644 index 00000000..c9360a43 --- /dev/null +++ b/data/common/char.json @@ -0,0 +1 @@ +{ "type":"Char", "value":"A" } diff --git a/data/common/file.json b/data/common/file.json new file mode 100644 index 00000000..2ad4d08d --- /dev/null +++ b/data/common/file.json @@ -0,0 +1 @@ +{ "type":"File", "value":"file.json" } diff --git a/data/common/hash-string-int.json b/data/common/hash-string-int.json new file mode 100644 index 00000000..563c62da --- /dev/null +++ b/data/common/hash-string-int.json @@ -0,0 +1 @@ +{ "type":"Hash String Int", "value":{"foo":12,"bar":24} } diff --git a/data/common/int.json b/data/common/int.json new file mode 100644 index 00000000..eb664c47 --- /dev/null +++ b/data/common/int.json @@ -0,0 +1 @@ +{ "type":"Int" , "value":"42" } diff --git a/data/common/matrix-int.json b/data/common/matrix-int.json new file mode 100644 index 00000000..9971cd33 --- /dev/null +++ b/data/common/matrix-int.json @@ -0,0 +1,2 @@ +{ "type":"Matrix Int" , "value":[[1,2,3],[2,3,4],[3,4,5]] } + diff --git a/data/common/num.json b/data/common/num.json new file mode 100644 index 00000000..c718d7a5 --- /dev/null +++ b/data/common/num.json @@ -0,0 +1 @@ +{ "type":"Num" , "value":"42.42" } diff --git a/data/common/set-string.json b/data/common/set-string.json new file mode 100644 index 00000000..09a27d17 --- /dev/null +++ b/data/common/set-string.json @@ -0,0 +1 @@ +{ "type":"Set String" , "value":["foo","bar"] } diff --git a/data/common/string.json b/data/common/string.json new file mode 100644 index 00000000..2470d7ba --- /dev/null +++ b/data/common/string.json @@ -0,0 +1 @@ +{ "type":"String" , "value":"foo" } diff --git a/data/common/table-String-Int-Int.json b/data/common/table-String-Int-Int.json new file mode 100644 index 00000000..be3d2985 --- /dev/null +++ b/data/common/table-String-Int-Int.json @@ -0,0 +1 @@ +{ "type":"Table [String,Int,Int]" , "value":[["foo","bar","baz"],[1,2,3],[4,5,6]] } diff --git a/data/common/text.json b/data/common/text.json new file mode 100644 index 00000000..d260ac49 --- /dev/null +++ b/data/common/text.json @@ -0,0 +1 @@ +{ "type":"Text" , "value":"This is a long string of text" } diff --git a/data/common/tree-int-int.json b/data/common/tree-int-int.json new file mode 100644 index 00000000..20455593 --- /dev/null +++ b/data/common/tree-int-int.json @@ -0,0 +1 @@ +{ "type":"Tree Int Int" , "value":{4,{5,{12},{10}},{6}} } diff --git a/data/common/tuple-string-int.json b/data/common/tuple-string-int.json new file mode 100644 index 00000000..8db1ca33 --- /dev/null +++ b/data/common/tuple-string-int.json @@ -0,0 +1 @@ +{ "type":"Tuple [Int, String]" , "value":[42, "foo"] } diff --git a/data/common/vector-int.json b/data/common/vector-int.json new file mode 100644 index 00000000..8ccdbec1 --- /dev/null +++ b/data/common/vector-int.json @@ -0,0 +1 @@ +{ "type":"Vector Int" , "value":[42, 48, 1] } diff --git a/data/raw/simple.tab b/data/raw/simple.tab new file mode 100644 index 00000000..50ecbb59 --- /dev/null +++ b/data/raw/simple.tab @@ -0,0 +1,3 @@ +1 2 3 +4 5 6 +7 8 9 diff --git a/debug.sh b/debug.sh deleted file mode 100755 index 5302dbee..00000000 --- a/debug.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -cgdb -- -x gdb-scripts/debug.gdb diff --git a/doc/terminology.md b/doc/terminology.md new file mode 100644 index 00000000..a021f838 --- /dev/null +++ b/doc/terminology.md @@ -0,0 +1,195 @@ + * programmer versus composer + +Where I say `programmer`, I mean the one who writes the functions in a +non-Morloc language. Where I say `composer`, I mean the person who writes +Morloc code (or more generally, any pure scripting language). + + + * double-blind + +Morloc is designed to allow a double-blind relation between composers and +programmers. + +The blind programmer doesn't how their code is being used by Morloc. They write +as they like using the data types that make sense for their problem. They only +know the general function type signature, which contains nothing specific to +their language. + +The blind composer builds workflows from nodes. They know the type of the nodes +and, based on documentation, know what they do. But they know nothing about the +implementation, including the language. + +A doubly blind system is a system where all programmers and all composers are +blind. Only the function signatures are known. The signatures play the role of +an API. + + + * common form + +A data form that is used everywhere between functions, and is independent of +any particular language. It is a data representation such as JSON, YAML, ASCII +text, or whatever (the details depend on the implementation and should not +normally be the concern of either the programmer of composer). +Let's say you have nodes the composition `foo . bar`. + + + * cis and trans connections + +In old Morloc, this could generate two forms of code. If both were in the same +language, it would form a *cis* connection. The code generated would be +something like `foo(bar())`. If the functions were in different languages, +there would be a *trans* connection. + +*cis* connections are completely idiomatic. They can use language-specific +features (like laziness). They can also use types that are not supported by +Morloc. No types even need to be specified for them. However, this allows +language-inflexibility, where two nodes become coupled such that they have to +be in the same language. This goes against the Morloc philosophy of double +blindness, where neither programer or composer needs to know about the other. + +*trans* calls are easy to control. The results always pass through the common +type. In a *trans* connection, `foo` would have to make a system call to the +program that has `bar` (unless the implementation optimizes this). This is +likely slow. Also the generated code is less concise. + + + * strict versus non-strict mode + +In strict mode, all connections must be *trans*. This provides fine granularity +of errors, you can know exactly where the failure occurs and handle in a clean +uniform way. This also forces double-blindness by preventing reliance on +language specific features. + + + * functions of nodes + +This is a composition that is indistinguishable from a normal node, with the +exception that its language cannot be set (since it is in Morloc). This allows +hiding of the particular nodes used inside. It also allows inputs to be freely +distributed inside the internal composition. + + + * caching + +The output of node with caching toggled will run exactly once. Any subsequent +calls to it will receive only the cache result. The caching is persistent. + + + * early and late validator + +Validators come before (early) or after (late) a function is called within +a node. Validators are themselves nodes. They must be in a layer that inherits +from the node they validate. + + + * output and input filter + +These filters take the data flowing through an edge, and access it, possibly +modifying it. They could be used to create log messages. Or they could be used to sample from or subset the data flow. + + + * layer + +A layer is an environment where nodes can be composed. They can link only to +other nodes in the layer and to nodes in any layer their parent layer inherits +from. + +Layers define scope. + + + * anonymous layer + +Layers don't have to have names. If they do not have names, then nothing can +inherit from them. + + + * master nodes, slave node, and slave layers + +A master node is a node that takes other nodes as input and uses them +internally as functions. The slave is the node so used. Masters can pass +arguments to slaves. They may call a slave many times with different arguments. +The entire graph of nodes downstream of the slaves, all filters, listeners, and +anything touching the slave, is wrapped into a slave layer. Nodes in the slave +layer link to each other or to arguments passed from the master. + +A new slave layer is generated every time the top slave node is called. Each +slave layer possesses a globally unique id. + +Slaves may have slaves. In which case, the unique id of a slave of a slave +would contain two elements. + + + * import + +Import a set of nodes from a module. These nodes behave exactly as if they were +defined locally. But nodes that were not exported by the module cannot be +altered in any way. Naming conflicts result in compile time errors, which can +be resolved by specifying the namespace (name of the imported module). + + + * module + +A module exports a specific set of nodes and specifies which parameters may be +set. Node attributes cannot be overridden. + + + * node signature + +The general type signature for the function in the node. It is general, in that +this signature is language-independent. The type system is a direct subset of +Haskell. + +In languages like Haskell (or other ML variants), type signatures are optional. +Though these languages are statically typed, explicit signatures are not +necessary since the type can be inferred from the code. However, in Morloc the +code is inside foreign languages, which are black boxes. This makes type +inference impossible in general. So explicit types are required. + + + * parameter type + +This is experimental. Currently, in old Morloc, parameters are expressed freely +without compile time checking. But this is pretty loose and highly language +dependent. The parameter typing allows tighter control of the functions and may +be used to provide automated documentation of parameters. + + + * specialization + +Ideally the type signature is all that is needed to generate required IO. But +often more is needed. Should a table passed to R, for example, be +a `data.frame`, a `data.table`, a list of vectors, a `matrix`, a `tibble`, etc. +Or should a string sent to Haskell be a String, ByteString or Text? In such +cases, hints must be passed to the compiler. The specialization syntax needs to +be general enough to allow great flexibility in meeting the needs of wildly +different languages. Perhaps it can be a YAML block. + +Where should this block be? On the composer's side or the programmer's side? Or +both? The programmer needs to be able to specialize the types. The composer +never needs to see these specializations. But there could be information that +the composer needs to pass to the programmer, for example performance +requirements or type specializations of a more general type (e.g. +distributions). + + + * primitives + +Primitives are terminal values in a workflow that are not modifiable, e.g. +numbers, strings. + + + * Workflow Intermediate Language + +This is a simple language designed to be easy to parse by a machine. It +contains all the information needed to build the Morloc executable, but is +abstracted away from the particular syntax used for specification. + + + * Void, wells and sinks + +A node that either writes to or reads from something outside the program will +have type `Void`. Functions with a void input are *wells*, they produce data, +but take nothing from other nodes. Functions that have a void output, take data +and do something with it, passing nothing on. Since functions are black boxes +in Morloc, there is no guarantee that a function without a void in its type +signature doesn't interact impurely with the system. diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index 27a54ad4..00000000 --- a/docs/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -TARGET=morloc - -${TARGET}.pdf: ${TARGET}.tex - latexmk -pdf ${TARGET}.tex - -.PHONY: clean -clean: - latexmk -c ${TARGET}.tex diff --git a/docs/images/composition.png b/docs/images/composition.png deleted file mode 100644 index 394aa57d..00000000 Binary files a/docs/images/composition.png and /dev/null differ diff --git a/docs/images/hello-world.png b/docs/images/hello-world.png deleted file mode 100644 index b1840f36..00000000 Binary files a/docs/images/hello-world.png and /dev/null differ diff --git a/docs/images/hooks.png b/docs/images/hooks.png deleted file mode 100644 index d111ef3c..00000000 Binary files a/docs/images/hooks.png and /dev/null differ diff --git a/docs/images/modifiers.png b/docs/images/modifiers.png deleted file mode 100644 index 9be7d2ee..00000000 Binary files a/docs/images/modifiers.png and /dev/null differ diff --git a/docs/images/types.png b/docs/images/types.png deleted file mode 100644 index 85b3ade2..00000000 Binary files a/docs/images/types.png and /dev/null differ diff --git a/docs/loc.tex b/docs/loc.tex deleted file mode 100644 index c43e7420..00000000 --- a/docs/loc.tex +++ /dev/null @@ -1,610 +0,0 @@ -\documentclass[12pt]{article} - -\begin{document} - -\section{Templates} - -The core functions of Morloc are manifold. These functions take no arguments. -They are conglomerations of the following elements: - -\begin{table}[htpb] - \centering - \caption{Elements of manifolds} - \label{tab:elements_of_manifolds} - \begin{tabular}{l|l} -element & description \\ -\hline -pure & pure data transformation function \\ -cache & cache output with 4 operations: 'has', 'get', 'put', and 'del' \\ -inputs & list of other manifolds from which input is requested \\ -checks & list of validator manifolds, which return booleans \\ -open & function that extracts list of inputs from list of input containers \\ -pass & executes the pure function (locally, send to a cluster, whatever you say) \\ -pack & packs the output in a container \\ -fail & produces the output in case of an error \\ -effects & list of manifolds to call after caching result - \end{tabular} -\end{table} - -A manifold itself has the form - -\begin{verbatim} -m = - if - ( cache_has m ) - ( cache_get m ) - ( - Mb = if - ( [check] ) - ( - Ma = map inputs, - a = map open Ma, - b = pass pure *a **args, - map effects b - pack Ma b - ) - ( - fail - ), - cache_put Mb, - map hooks, - Mb - ) -\end{verbatim} - -\begin{verbatim} -m = - ( - [begin] - (? - cache_condition, - get_cached, - ( - [prehooks] - (? - [evaluation_condition], - ( - Mb = function( [open input] ) - b = unpack(Mb) - M = context(Mb) - [(do_to_context M)] - [(do_to_data b)] - [(do_to_both Mb)] - (? - [inner_fail_conditions, b, M], - [inner_success, b, M], - [inner_fail, b, M] - Mb = (inner_fail_output, b, M) - ) - ), - ( - Mb = fail_output - [fail_effect] - [fail_effect_p Mb] - ) - cache Mb - ) - [posthooks] - ) - ) - [end] - ) -\end{verbatim} - - -\section{Expectations for the backends} - -The Morloc compiler translates Morloc code into an intermediate language -(Morloc Intermediate Language, LIL) that lists the steps need to build a -program. It is the job of the backend to interpret LIL into working code in an -output language (OL). The process of adding support for new languages will be -simplified if there is a roughly one-to-one correlation between instructions in -LIL and functions in the backend. - -The destination language should have an index of typed functions. It should -also maintain all manifolds in a containter where they can access one another. - -The manifolds themselves can be represented in many ways. In languages with -good metaprograming support, like R, they may be functions which are modified -as LIL is interpreted. In OOP languages, they may be objects. - -\begin{itemize} - - \item EMIT(string ID) - add a new manifold with label ID to the manifold set - - \item FUNC(string ID, string FUNC) - look of FUNC in the function database, - set ID to this function - - \item INPM(string ID1, int i, string ID2) - link ID2 as a the ith positional - argument of ID1 - - \item INPP(string ID1, int i, string ID2) - link the eval(value) as the ith - positional argument of ID1 - - \item NORM - stub - - \item INPD - stub - - \item CACHE(string ID, string C) - wrap manifold ID in the cache paradigm C - (caches are not singular functions, but rather contain at least 3 elements: - CHECK, GET, and PUT) - - \item EFCT(string ID, string F) - append function F to the effect list of manifold ID - -\begin{verbatim} - F :: (a -> *) -\end{verbatim} - - \item CHECK(string ID, string F) - append function F to the check list of manifold ID - -\begin{verbatim} - F :: (a -> Bool) -\end{verbatim} - - \item OPEN(string ID, string F) - append function F to open list of manifold - ID (which must be of length 0, 1 or the number of input functions) - -\begin{verbatim} - F :: (Ma -> a) -\end{verbatim} - - \item PACK(string ID, string F) - set pack function of manifold ID to F - -\begin{verbatim} - F :: (Ma -> b -> Mb) -\end{verbatim} - - \item PASS(string ID, string F) - set pass function of manifold ID to F - -\begin{verbatim} - F :: (f -> [inputs] -> [args] -> b) -\end{verbatim} - - \item FAIL(string ID, string F) - set the failure function of manifold ID to F - -\begin{verbatim} - F :: (NULL -> Mb) -\end{verbatim} - - \item DOC(string ID, string doc) - sets the documentation of manifold ID to doc - - \item ARG(string ID, string key, string val) - sets argument key of manifold ID to val - -\end{itemize} - -\section{Approach} - -There are two ways a workflow can be viewed: a graph of functions, or a graph -of data. Of course the two can also be merged. If the functions are typed, the -data graph is implicit in the function graph, and can be extracted from it. An -anonymous function graph is also implicit in a data graph. - -\section{On directions} - -I can write paths in two directions, from the bottom up, or from top down. - -\begin{verbatim} -FinalResult <-- Piece3 <-- Piece1 Piece 2 -\end{verbatim} - -Or - -\begin{verbatim} -Piece1 Piece2 --> Piece3 --> FinalResult -\end{verbatim} - -The latter is reminiscent of a familiar shell pipeline. It mirrors the flow of -data from well to sink. The former is like mathematical composition. - -A deeper example - -\begin{verbatim} -FinalResult . ResultA ResultB -ResultA . X Y Z -X . E R T -Y . U -Z . whatever . yeah -ResultB . W . R -\end{verbatim} - -Where $.$ represents composition. Phrases like $f . a b$ indicates, -$f(a(),b())$. Since we are dealing with manifolds, no arguments are passed to -a and b, they know what to do. Multiple inputs prevents further chaining. $f . a b . c$ doesn't make sense. It could possibly mean that that $a$ and $b$ -both request input from $c$, but that is perhaps not very useful. It is better, -probably, to consider these branches as chain ends. Then drop a level into the -definitions of $a$ and $b$. - -\begin{verbatim} -f . x y; -x = a . c; -y = b . d . (e . i) . f . g h; -\end{verbatim} - -Where $c$, $g$, $i$, and $h$ are wells, and $f$ is a sink. - -There is a recursive beauty to this, and it allows very clean abstractions, it -places the final goal at the top. It also clearly expresses the pull approach -the manifolds follow. It avoids the weird situation where I have to recurse to -the end of a path to find the sinks. - -But why choose? I can allow both. - -What if they are both used in the same statement? Should that be legal? - -\begin{verbatim} -D <-- (A --> B) C -\end{verbatim} - -\begin{verbatim} -C <-- A --> B -\end{verbatim} - -Hmm, $-->$ should have higher precedence. Still mixing is pretty convoluted. - -\begin{verbatim} -D <-- (B <-- A) --> C -\end{verbatim} - - -\begin{verbatim} -Main = Analyze . Join . Map . Filter . Divide . Retrieve -\end{verbatim} - - -sqrt(mean(runif(x))) - -sqrt . mean . runif:1 - -log . median . runif:1 - - -Nahhh, mixing the two needs to be illegal. - -Why not express these as compositions? - - -\section{Composite output} - -\begin{verbatim} -A --> (B, C, D) -\end{verbatim} - -Where A has three outputs, say of types [b,c,d]. For these, we automatically -generate the linker functions B, C, and D. - -\section{On failure} - -There are three kinds of failure. - -\begin{itemize} - \item a validator trips, the fail function is called before the run function has - even been called. - \item run functions raises an exception. - \item the run function succeeds, but the output is invalid (as assessed by - a post-validator). -\end{itemize} - -Currently, I directly handle failure of the first kind. The other two kinds can -be handled by writing checks into the pack function and passing the results in -the trappings of the pure output. This would be the monadic solution. - -To this point, I have mostly thought about validators as operating on the -values of manifolds. But equally important, perhaps, is validation of -arguments. The manifold validators check the environment and the values of -other manifolds. But they cannot see the arguments of a particular manifold. -Perhaps one solution would be for a manifold to access another manifold by -reference, not value. That is, rather than accessing the stuff in the cache, it -accesses the manifold metadata. - -No, there is a better way. Again, monads. I can pack the argument list into the -monad. Then you just change the unpack function of the validator to take the -argument list rather than just the pure value. - -\section{Conditionals} - -Partitioning data is an important part of many workflows. Morloc needs a good -<<<<<<< Updated upstream -method for expressing binary trees. It isn't hard: $V1 ? V2 ? A, B, V3 ? C, D$ etc -works fine. The grammar is: -======= -method for expressing binary trees. It isn't hard: $V1 ? V2 ? A, B, V3 ? C, D$ -etc works fine. The grammar is: ->>>>>>> Stashed changes - -\begin{verbatim} -cexp - : COND VAL VAL - | COND cexp VAL - | COND VAL cexp - | COND cexp cexp -\end{verbatim} - -This allows clean expression of binary trees, e.g. - -\begin{verbatim} - V1 ? A, - V2 ? - V3 ? B, - V4 ? F, G, - V5 ? H, - V6 ? I, J - . x -\end{verbatim} - -Here each V. conditional statement is a function of x, y, and z. If the -function returns true, the left path is evaluated. When a leaf is reached, the -leaf function is called (on x,y,z by default). - -This would compile into pseudocode like the following: - -\begin{verbatim} -if (V1 x) - A x -elif (V2 x) - if (V3 x) - B x - elif (V4 x) - F x - else - G x -else - if (V5 x) - H x - elif (V6 x) - I x - else - J x -where -x :: Foo -V1,V1,... :: Foo -> Bool -A,B,C,D,E,F,G,H,I,J :: Foo -> a -\end{verbatim} - -But how to loop this? That is, what if x is a list? - -I'll discuss the possibilities in the context of this simple example: - -\begin{verbatim} -V ? A, B . x -\end{verbatim} - -This operation has the signature: - -\begin{verbatim} -(V -> Foo -> Bool) -> (A -> Foo -> a) -> (B -> Foo -> b) -> [Foo] -> ([a], [b]) -\end{verbatim} - -There are some variants in the first expression: - -\begin{verbatim} -V :: Foo -> Bool -- e1 -V' :: [Foo] -> Bool -- e2 -V'' :: [Foo] -> [Bool] -- e3 -\end{verbatim} - -For e1, Morloc would just have to map V across x in the compiled code. The -difference between e2 and e3 is more significant. e2 reduces the entire vector -to a single boolean. This will result in only a single leaf being selected and -all data being processed by the one function. e3 maps list to list, leading to -the data being partitioned between leafs. e3 would also return an ambiguous -type (unless all A-J had the same signatures). - -Both uses are reasonable, and both should be allowed. But how to syntactically -distinguish them? This brings me back to the ever troublesome loop issue. - -\section{On inputs, outputs and parameters} - -Since Morloc is a workflow language, a multifurcating relative of linear shell -pipelines, connecting function inputs to function outputs is of prime -importance. However their are other inputs to a function, the constant -parameters. Take for example GNU grep. Grep has the general form - -\begin{verbatim} -Grep :: [Line] -> Pattern -> [Line] -\end{verbatim} - -However Grep also has the flag {\it --invert-match}. You can add this parameter to the signature, of course: - -\begin{verbatim} -Grep :: [Line] -> Pattern -> Bool -> [Line] -\end{verbatim} - -It has dozens of other options; adding all of them to the signature dilute the -clarity of the original. There are a several solutions - -\begin{itemize} - \item Have a different name for each combination of arguments, e.g. grep, vgrep, - egrep. But this quickly bloats the namespace. - \item Make functions more atomic, then transform them, e.g. `invert grep`, but - this requires extensive reworking of the grep implementation, something - I want to avoid when possible. - \item Separate inputs from parameters. This is basically a general way to do - option n2. Adding options changes the way the function works, but preserves - the function signature. -\end{itemize} - -I am going with n3. Continuing with the grep example, there are options in GNU -grep that alter the function type. For example, `--count` changes the signature -to - -\begin{verbatim} -Grep' :: [Line] -> Pattern -> Integer -\end{verbatim} - -and `--file` changes the type to - -\begin{verbatim} -Grep'' :: [Line] -> File -> [Line] -\end{verbatim} - -Of course you can also have both - -\begin{verbatim} -Grep''' :: [Line] -> File -> Integer -\end{verbatim} - -GNU grep also allows you to read from a file, so for each Grep variant above, -the first argument can be swapped with `[File]`. - -\begin{verbatim} -FGrep :: [File] -> Pattern -> [Line] -FGrep' :: [File] -> Pattern -> Integer -FGrep'' :: [File] -> File -> [Line] -FGrep''' :: [File] -> File -> Integer -\end{verbatim} - -So even after corralling type-conserving parameters into the @arg section, we -still have a combinatoric explosion. The problem is that grep does too much. We -should delegate reading files and counting lines to dedicated functions: - -\begin{verbatim} -grep (read "world.txt") "waldo" -length . grep (read "world.txt") "waldo" -unnest . map (grep (read "world.txt")) (read "patterns.txt") -\end{verbatim} - -The last example uses currying, something not implemented in Morloc. Also -something that I can't literally implement at all in Morloc since it would require -changing client code (maybe, thar be hacks ...). However, if I create a `map` -builtin, I can compile this with a loop calling `grep (read "world.txt) x` for -all x in `(read "patterns.txt")`. However, this is inefficient. Grep has -optimizations for searching multiple patterns (or if it doesn't, it should) and -also this may require multiple loadings of the input document. This is a common -problem where vectorization is optimized and problems can't be efficiently -atomized. It is a very common problem in compiling R code. One solution to the -Grep issue would be to define Grep as - -\begin{verbatim} -Grep :: [Line] -> [Pattern] -> [Line] -\end{verbatim} - -So it is always vectorized. - -\section{On effect} - -What should be passed to the effect functions. There are several possibilities, -all of them useful in certain contexts: - -Option 1: pass nothing. The effect functions are manifolds, they can be -<<<<<<< Updated upstream -elaborate entities, constructed in the Morloc path section. In this way, they are -an orthogonal dimension to the pure path through the data. -======= -elaborate entities, constructed in the Morloc path section. In this way, they -are an orthogonal dimension to the pure path through the data. ->>>>>>> Stashed changes - -Option 2: pass b (the unpackaged output). This would be extremely useful for -simple effects, like a print statement. Then builtin functions of language can -be called, without needing to be wrapped in manifolds, without the boilerplate. - -Option 3: pass Mb (the packaged output). Useful is dependent on how the state -being passed in the package is being used in the pipeline. - -Option 4: pass [a] and b. Some analyses might want to compare the output and -input. Of course this could be done with manifold calls. - -Option 5: Option 1-4. Allow everything. Build some syntax to specify which -function should be used. - -\section{A word on the future} - -Morloc is dependent on infrastructure that does not yet exist. It is a weak -dependency, since Morloc can work with any set of pure functions. But it would -be most powerful in the context of a functional database. Hoogle is the -prototype. - -The functional database obviously needs to allow lookup based on exact type -signatures. It also needs to understand the ontology, inheritance of types, -algebras. The starables of a type (orderable, comparable, printable, iterable, -numerable, etc). It needs to be able to trace paths between types, to enumerate -all possible paths between a specified set of inputs and outputs. There should -be compose and decompose operations. Slightly unrelated, but we should also -have methods to store and study typed workflows. - -Such a database would consist of the function code, an ontology (specified in -Morloc), and the signatures for each function (also in Morloc). - -\section{A word on Galaxy, KBase, IPlant desktop, and their ilk} - -These are similar to Morloc in that they allow linking of functional units and -setting of their parameters. - -Their point-and-click interfaces present a specialized subset of the -functionallity of a subset of all programs selected form a subset of all -fields. They cater to the non-programmer, offering "user friendly" access to -common workflows within specific fields. They sacrifice power for muggle -usability. Morloc is far more general and allows user-written code. It could -serve as a basis for a muggle workflow engine, but is still useful to the -programmer (well, ok, it isn't useful to anyone yet). - -The Galaxy class programs focus on linking wrappers for independent programs. -In contrast, Morloc is a metaprogramming language for creating pure code. Since -Morloc functions may be wrappers for standalone programs, Morloc supersets the -Galaxy class. Morloc can interface with the entire function set of any language -with no boilerplate (it isn't safe to do this, since you should at least have a -type signature). I should temper this by specifying the limitations of Morloc, -specifically, it requires pure functions with types that are invariant to -parameter choice. This may necessitate writing wrappers for functions, for -example see the discussion of GNU grep above. - -\section{Relation to lambda calculus} - -<<<<<<< Updated upstream -Lambda calculus distinguishes between variables and expressions. In Morloc there -are no variables. But there are expressions that take no inputs, these play the -role of variables. -======= -Lambda calculus distinguishes between variables and expressions. In Morloc -there are no variables. But there are expressions that take no inputs, these -play the role of variables. ->>>>>>> Stashed changes - -The grammar of Morloc is - -\begin{verbatim} - E = m|(E)|EE|E.E -\end{verbatim} - -Where $E$ is an expression and $m$ is a manifold. - -Here are the rules for conversion to $\lambda$-expressions: - -\begin{itemize} - \item $E = \lambda p . M$ - \item $EE = \{ \lambda p . M, \quad \lambda p . N \}$ - \item $E.E = ( \lambda p . M ) ( \lambda p . N )$ -\end{itemize} - -Where $p = \O | E$. The expressions can take no inputs, these expressions are -like variables in $\lambda$-calculus. - -The outputs of an expression are: - -\begin{itemize} - \item $O(m) = m$ - \item $O( (M) ) = O(M)$ - \item $O(M.N) = O(M)$ - \item $O(MN) = O(M) \cup O(N)$ -\end{itemize} - -The outputs are the manifolds themselves. - -NOTE: I do not allow a nested expression to produce multiple outputs in Morloc. - -Likewise, the receivers of input to an expression are: - -\begin{itemize} - \item $I(m) = m$ - \item $I( (M) ) = I(M)$ - \item $I(M.N) = I(N)$ - \item $I(MN) = I(M) \cup I(N)$ -\end{itemize} - -Every manifold wraps a single pure function. This function has $k$ positional -parameters. The number of inputs may be either 0, in which case the manifold is -\textit{open} or $k$, in which case the manifold is \textit{closed}. - -This open/closed terminology draws from TTFP (Nederpelt, Geuvers). - -\end{document} diff --git a/examples-2/atom/Makefile b/examples-2/atom/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/examples-2/atom/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/examples-2/atom/x.loc b/examples-2/atom/x.loc deleted file mode 100644 index e3b14a18..00000000 --- a/examples-2/atom/x.loc +++ /dev/null @@ -1,8 +0,0 @@ -@path R -roll -@arg -roll :: prob = [0.1,0.1,0.1,0.1,0.1,0.5] -@source R -roll <- function(...) { - sum(sample.int(6,3,replace=TRUE,...)) -} diff --git a/examples-2/composition/Makefile b/examples-2/composition/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/examples-2/composition/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/examples-2/composition/x.loc b/examples-2/composition/x.loc deleted file mode 100644 index ec08d01a..00000000 --- a/examples-2/composition/x.loc +++ /dev/null @@ -1,13 +0,0 @@ -@type -printf :: String -> String -> String - -@path -printf . "reverse:%s\n" (reverse . 'hello') - -@lang -printf :: sh -reverse :: py - -@source py -def reverse(x): - return x[::-1] diff --git a/examples-2/iris-head/Makefile b/examples-2/iris-head/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/examples-2/iris-head/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/examples-2/iris-head/x.loc b/examples-2/iris-head/x.loc deleted file mode 100644 index 1e288657..00000000 --- a/examples-2/iris-head/x.loc +++ /dev/null @@ -1,9 +0,0 @@ -@type -head :: Table -> Table -@path -head . foo -@lang -foo :: R -head :: sh -@source R -foo <- function() { iris } diff --git a/examples/10_data.tar b/examples/10_data.tar deleted file mode 100644 index a375de36..00000000 Binary files a/examples/10_data.tar and /dev/null differ diff --git a/examples/10_wc.loc b/examples/10_wc.loc deleted file mode 100644 index 7b588f7a..00000000 --- a/examples/10_wc.loc +++ /dev/null @@ -1,70 +0,0 @@ -@comment - -This is an implementation of the cannonical wc problem. - -I am adapting the R code from the Cuniform paper (Brandt 2013) for a clean -side-by-side comparison. - -``` -deftask wc( csv( File ) : txt( File ) )in r *{ - dtm <- table( scan( txt, what='character' ) ) - df <- as.data.frame( dtm ) - write.table( df, csv, col.names=FALSE,row.names=FALSE ) -}* - -deftask groupby - ( result( File ) : )in r *{ - library( plyr ) - all <- NULL - for( i in csv ) - all <- rbind( all, - read.table( i, header=FALSE ) ) - x <- ddply( all, .( V1 ), summarize, - count=sum( V2 ) ) - write.table( x, result, col.names=FALSE, - row.names=FALSE ) -}* - -deftask untar - ( : tar( File ) )in bash *{ - tar xf $tar - list=`tar tf $tar` -}* - -txt = untar( tar: 'corpus.tar' ); -csv = wc( txt: txt ); -result = groupby( csv: csv ); -result; -``` - -@path -groupby . map . &(wc . $1) (untar . '10_data.tar') - -@source R -library(plyr) - -wc <- function(txt){ - dtm <- table(scan(txt, what='character')) - as.data.frame(dtm) -} - -groupby <- function(csvs){ - all <- do.call(rbind, csvs) - ddply(all, .( Var1 ), summarize, count=sum( Freq )) -} - -@source sh -untar (){ - tar xf $1 - tar tf $1 -} - -@lang -* :: R -untar :: sh - -@include -core/control - -@type -untar :: String -> [String] diff --git a/examples/11.txt b/examples/11.txt deleted file mode 100644 index d2b3ec9a..00000000 --- a/examples/11.txt +++ /dev/null @@ -1,20 +0,0 @@ -2 dogs -10 cats -16 macaws -2 dogs -10 cats -16 macaws -2 dogs -10 cats -16 macaws -2 dogs -10 cats -16 macaws -2 dogs -10 cats -16 macaws -2 dogs -10 cats -16 macaws -2 dogs -10 cats diff --git a/examples/11_filter.loc b/examples/11_filter.loc deleted file mode 100644 index a2d429df..00000000 --- a/examples/11_filter.loc +++ /dev/null @@ -1,57 +0,0 @@ -@type -divide :: File -> Table -filter :: Table -> Table -transform :: Table -> [a] -join :: [a] -> b -format :: b -> String - -@path py -format . join . transform . filter . divide . '11.txt' - -@alias -divide :: loc_divide -filter :: loc_filter -transform :: loc_transform -join :: loc_join -format :: loc_format - -@source py - -def loc_divide(filename): - with open(filename, 'r') as f: - for line in f: - yield line.rstrip().split() - -def loc_filter(xs): - for x in xs: - if int(x[0]) > 5: - yield x - -def loc_transform(xs): - for x in xs: - yield x[1] == "cats" - -def loc_join(xs): - return sum(xs) - -def loc_format(x): - return "There are %s groups of more than 5 cats" % int(x) - -# def loc_input(): -# with open('11.txt', 'r') as f: -# return f.readlines() -# -# def loc_divide(f): -# return (x.rstrip().split() for x in f) -# -# def loc_filter(xs): -# return (x for x in xs if int(x[0]) > 5) -# -# def loc_transform(xs): -# return (x[1] == "cats" for x in xs) -# -# def loc_join(xs): -# return sum(xs) -# -# def loc_format(x): -# return "There are %s groups of more than 5 cats" % int(x) diff --git a/examples/12_read_gff.loc b/examples/12_read_gff.loc deleted file mode 100644 index 1366470b..00000000 --- a/examples/12_read_gff.loc +++ /dev/null @@ -1,162 +0,0 @@ -@comment - -function readGFF( - filename, - print_comments=FALSE - print_stats=FALSE - plot_lengths=FALSE - validate_columns=FALSE - start_lt_stop=FALSE - has_CDS=FALSE -){ - if(!file.exists(filename)){ - .... - } - - if(print_comments){ - # system call to grep - } - - # read gff - - if(print_stats){ ... } - if(plot_lengths){ ... } - if(validate_columns){ ... } - if(start_lt_stop){ ... } - if(has_CDS){ ... } - - gff -} - -@type -get_outdir :: File -> File - -@path -_ :: analysis . readGFF . *gff -_ :: get_outdir . *gff - -gff :: "al.gff" - -out_comments :: "comments.txt" -out_stats :: "stats.txt" -out_lengths :: "lengths.pdf" - -@assert -readGFF :: file.exists . *gff - -@before -analysis :+ print_comments . *gff *out_comments -analysis :+ print_stats . *out_stats -analysis :+ plot_lengths . *out_lengths - -@after -analysis :+ mkdir . -analysis :+ mv . - *out_comments - *out_stats - *out_lengths - - -@assert -analysis :+ validate_columns . -analysis :+ start_lt_stop . -analysis :+ has_feature . "CDS" - -@lang -* :: R -print_comments , -mkdir , -mv , -get_outdir :: sh - -@source R - -gff_colnames = c( - "seqname", "source", "feature", "start", "end", - "score", "strand", "frame", "attributes") - -analysis <- function(x) { - # do stuff -} - -print_stats <- function(gff, outfile){ - sink(outfile) - gff$feature <- as.factor(gff$feature) - gff$strand <- as.factor(gff$strand) - gff$frame <- as.factor(gff$frame) - gff$source <- as.factor(gff$source) - gff$seqname <- as.factor(gff$seqname) - print(summary(gff)) - sink() -} - -plot_lengths <- function(gff, outfile){ - pdf(outfile) - hist(log2(gff$end - gff$start + 1)) - dev.off() -} - -readGFF <- function(x) { - gff = read.table( - x, - sep="\t", - stringsAsFactors=FALSE, - quote="", - header=FALSE, - comment.char="#", - ) - colnames(gff) = gff_colnames - gff -} - -validate_columns <- function(x) { - valid <- TRUE - if(ncol(x) != 9){ - warning("GFF expected to have 9 columns") - valid <- FALSE - } - if(!all(names(x) == gff_colnames)){ - msg <- "Expected column names: %s" - warning(sprintf(msg, paste(gff_colnames, collapse=", "))) - valid <- FALSE - } - if(!is.numeric(x$start) || !is.numeric(x$end)){ - warning("start and end fields in GFF must be numeric") - valid <- FALSE - } - if(!all(x$strand %in% c("+", "-", "."))){ - warning("strand expected to only have characters [+-.]") - valid <- FALSE - } - valid -} - -start_lt_stop <- function(x){ - if(all(x$start <= x$end)){ - TRUE - } else { - warning("GFF start > end") - FALSE - } -} - -has_feature <- function(feature, x){ - if(feature %in% x$feature){ - TRUE - } else { - msg <- "features '%s' is missing in GFF" - warning(sprintf(msg, feature)) - FALSE - } -} - - -@source sh -print_comments (){ - grep '^#' $1 > $2 -} - -get_outdir (){ - gfffile=$1 - echo ${gfffile%.gff} -} diff --git a/examples/13_blast.loc b/examples/13_blast.loc deleted file mode 100644 index 804c72eb..00000000 --- a/examples/13_blast.loc +++ /dev/null @@ -1,32 +0,0 @@ -@type -blastp :: File -> File -> Table -plot :: Table -> Void - -@path -plot . blastp . *query *database - -query :: 'human.fa' -database :: 'chimp_db' - -@arg -blastp :: -outfmt '6 score length' - -num_threads 6 - -word_size 4 -makeblastdb :: -in 'chimp.fa' - -out 'chimp_db' - -dbtype 'nucl' - -@lang -blastp :: sh -plot :: R - -@before -blastp :: makeblastdb - -@after sh -blastp :: cleanup - -@source sh -cleanup () { - rm chimp_db.* -} diff --git a/examples/1_hello_world.loc b/examples/1_hello_world.loc deleted file mode 100644 index c77a3d72..00000000 --- a/examples/1_hello_world.loc +++ /dev/null @@ -1,3 +0,0 @@ -@path sh - -echo . "hello world" diff --git a/examples/2_composition.loc b/examples/2_composition.loc deleted file mode 100644 index ba2c86f9..00000000 --- a/examples/2_composition.loc +++ /dev/null @@ -1,9 +0,0 @@ -@path -uniq . sort . grep . man - -@arg -grep := -Po "[a-z]+ed" -man := ls - -@lang -* :: sh diff --git a/examples/3_modifiers.loc b/examples/3_modifiers.loc deleted file mode 100644 index c64f73ba..00000000 --- a/examples/3_modifiers.loc +++ /dev/null @@ -1,26 +0,0 @@ -@path - -rnorm:main . - rbinom:n - rnorm:mean - rnorm:sd - -@lang -* :: R - -@assert -rnorm:main :: is.positive . - -@arg -rbinom:n :: n=1 size=100 prob=0.1 -rnorm:mean :: n=1 mean=0 sd=10 -rnorm:sd :: n=1 mean=2 sd=1 - -@cache -rnorm,rbinom :: memcache - -@source R -is.positive <- function(x){ all(x > 0) } - -@include -core/memcache diff --git a/examples/4_hooks.loc b/examples/4_hooks.loc deleted file mode 100644 index df559401..00000000 --- a/examples/4_hooks.loc +++ /dev/null @@ -1,64 +0,0 @@ -@type -map :: (Int -> [Int]) -> [Int] -> [[Int]] - -@path - -null . map . - & ( - to_table . - ( - rnorm:main . - rbinom:n - ( sum . rnorm:mean $1 ) - rnorm:sd - ) - $1 - ) - ( seq . 1 10 ) - - -@lang -* :: R -cleanup :: sh - -@assert -rnorm:main :: is.positive . -to_table :: is.numeric . $1 - -@arg -rbinom:n :: n=1 size=100 prob=0.1 -rnorm:mean :: n=1 mean=0 sd=10 -rnorm:sd :: n=1 mean=2 sd=1 - -@cache -rnorm,rbinom,map :: memcache - -@5 -rnorm:main :: record_result . $1 -map := plot . do.call . `rbind` - -@1 -null :: cleanup - -@source R -is.positive <- function(x){ all(x > 0) } - -record_result <- function(x, i){ - write(x, file=sprintf("sample-%s.txt", i)) -} - -to_table <- function(x, i){ - data.frame(x=x, i=rep(i, length(x))) -} - -@source sh -cleanup () { - mkdir -p results - mv sample-* results - mv Rplots.pdf results/plot.pdf -} - -@include -core/memcache -core/atomic -core/control diff --git a/examples/5_types.loc b/examples/5_types.loc deleted file mode 100644 index e65eb8b9..00000000 --- a/examples/5_types.loc +++ /dev/null @@ -1,14 +0,0 @@ -@type -c :: ? -> [Int] -seq :: Int -> Int -> [Int] -sum :: [Int] -> Int - -@path -map . & ( sum . seq . 1 $1) (c . 1 2 3 4 5) - -@lang -* :: R -seq :: sh - -@include -core/control diff --git a/examples/6_filesize.loc b/examples/6_filesize.loc deleted file mode 100644 index c6565799..00000000 --- a/examples/6_filesize.loc +++ /dev/null @@ -1,32 +0,0 @@ -@comment - -Here is an alternative script written in Shell and R - -==== p l o t . R ==== -#!/usr/bin/Rscript --vanilla -f <- commandArgs(trailingOnly=TRUE)[1] -x <- read.table(f)$V1 -hist(log2(x)) - -==== m a i n . s h ==== -#!/usr/bin/env bash -filesizes (){ - ls -s $1 | awk 'NR > 2 && $1 > 0 { print $1 }' -} -./plot.R <(filesizes /usr/bin) - -@type -log2 :: [Int] -> [Num] -hist :: [Num] -> Void - -@path -hist . log2 . filesizes . '/usr/bin' - -@lang -log2,hist :: R -filesizes :: sh - -@source sh -filesizes (){ - ls -s $1 | awk 'NR > 1 && $1 > 0 { print $1 }' -} diff --git a/examples/7_times.loc b/examples/7_times.loc deleted file mode 100644 index 489639d3..00000000 --- a/examples/7_times.loc +++ /dev/null @@ -1,87 +0,0 @@ -@comment - -The code is long and repetitive. Being repetitive is not good, of course, but -can be solved with a bit of sugar. More importantly, this script is very simple. - -This is not a very fair way to compare times, since the R functions are native -calls and the python funcions are foreign. - -# === t i m e . R ==== -#!/usr/bin/Rscript --vanilla -k <- commandArgs(trailingOnly=TRUE) -system.time(runif(k)) -system.time(rnorm(k)) -system.time(rexp(k)) - -# === t i m e . p y ==== -#!/usr/bin/env python3 - -import time -import sys - -def time_func(f, *args): - a = time.time() - f(*args) - b = time.time() - return b - a - -def py_runif(k): - return [random.uniform(0,1) for x in range(k)] - -def py_rnorm(k): - return [random.gauss(0,1) for x in range(k)] - -def py_rexp(k): - return [random.expovariate(1) for x in range(k)] - -k = sys.args[1] - -print(time_func(py_runif(k))) -print(time_func(py_rnorm(k))) -print(time_func(py_rxp(k))) - -# === m a i n . s h ==== -#!/usr/bin/env bash - -./time.R -./time.py - -@include -core/atomic - -@path R -Main :: null . *A *B *C - *D *E *F -A :: *Time -B :: *Time -C :: *Time -D :: *Time -E :: *Time -F :: *Time - -Time :: write . system.time . random . 1000000 - -@arg -write :: file="/dev/stderr" - -@alias -Main/A/Time/random :: runif -Main/B/Time/random :: rnorm -Main/C/Time/random :: rexp -Main/D/Time/random :: py_runif -Main/E/Time/random :: py_rnorm -Main/F/Time/random :: py_rexp - -@lang -Main/D/Time/random :: py -Main/E/Time/random :: py -Main/F/Time/random :: py - -@source py -import random -def py_runif(k): - return [random.uniform(0,1) for x in range(k)] -def py_rnorm(k): - return [random.gauss(0,1) for x in range(k)] -def py_rexp(k): - return [random.expovariate(1) for x in range(k)] diff --git a/examples/8_glue.loc b/examples/8_glue.loc deleted file mode 100644 index 5982c619..00000000 --- a/examples/8_glue.loc +++ /dev/null @@ -1,52 +0,0 @@ -@comment - -Another usage of Morloc is simply as a glue for connecting scripts of -different languages into an single script with a nice interface. - -R has really good libraries for reading files from online. readr can read URLs -as easily as it can files. It will also automatically unzip them. So we could -write: `read_tsv(url, comment="#", col_names=FALSE)` and bypass the shell -function altogether. - -@type -prepare :: Void -> File -analyze :: File -> Void - -@path -analyze . prepare - -@lang -analyze :: R -prepare :: sh - - -@source sh -prepare () { - ncbi=ftp://ftp.ncbi.nih.gov/genomes - spec=Apis_cerana - gfffile=ref_ACSNU-2.0_top_level.gff3 - wget -O - $ncbi/$spec/GFF/$gfffile.gz | gunzip > $gfffile - echo $gfffile -} - - -@source R -require(readr) -analyze <- function(f){ - d <- read_tsv(f, comment="#", col_names=FALSE) - names(d) <- c( - "seqid", - "source", - "type", - "start", - "stop", - "score", - "strand", - "phase", - "attr" - ) - sink('result.txt') - fit <- lm(start ~ stop, d) - print(summary(fit)) - sink() -} diff --git a/examples/9_better_r.loc b/examples/9_better_r.loc deleted file mode 100644 index aff6b571..00000000 --- a/examples/9_better_r.loc +++ /dev/null @@ -1,5 +0,0 @@ -@path R -print . summary . `iris` - -@source R -sink('/dev/stderr') diff --git a/examples/Makefile b/examples/Makefile deleted file mode 100644 index f6e7a04f..00000000 --- a/examples/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -.PHONY: 1 -1: - morloc -kt -o hello_world -x pools 1_hello_world.loc - -.PHONY: 2 -2: - morloc -kt -o composition -x pools 2_composition.loc - -.PHONY: 3 -3: - morloc -kt -o modifiers -x pools 3_modifiers.loc - -.PHONY: 4 -4: - morloc -k -o hooks -x pools 4_hooks.loc - -.PHONY: 5 -5: - morloc -kt -o types -x pools 5_types.loc - -.PHONY: 6 -6: - morloc -kt -o filesize -x pools 6_filesize.loc - -.PHONY: 7 -7: - morloc -kt -o times -x pools 7_times.loc - -.PHONY: 8 -8: - morloc -kt -o glue -x pools 8_glue.loc - -.PHONY: 9 -9: - morloc -kt -o better_r -x pools 9_better_r.loc - -.PHONY: 10 -10: - morloc -kt -o wc -x pools 10_wc.loc - -.PHONY: 11 -11: - morloc -kt -o filter -x pools 11_filter.loc - -.PHONY: 12 -12: - morloc -kt -o gff -x pools 12_read_gff.loc - -.PHONY: clean -clean: - rm -rf pools hello_world composition modifiers \ - hooks *pdf manifold-nexus.py \ - sample* results types filesize times \ - glue *gff3 result.txt \ - better_r wc [abc].txt filter \ - gff al/ \ - __pycache__ diff --git a/examples/al.gff b/examples/al.gff deleted file mode 100644 index a2a66be0..00000000 --- a/examples/al.gff +++ /dev/null @@ -1,99 +0,0 @@ -##gff-version 3 -#!gff-spec-version 1.21 -#!processor NCBI annotwriter -#!genome-build v.1.0 -#!genome-build-accession NCBI_Assembly:GCF_000004255.1 -##sequence-region NW_003302555.1 1 33132539 -##species http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=81972 -NW_003302555.1 RefSeq gene 47 2523 . - . ID=gene0;Dbxref=GeneID:9330760;Name=ARALYDRAFT_887207;gbkey=Gene;gene_biotype=protein_coding;locus_tag=ARALYDRAFT_887207 -NW_003302555.1 RefSeq mRNA 47 2523 . - . ID=rna0;Parent=gene0;Dbxref=Genbank:XM_002891972.1,GeneID:9330760;Name=XM_002891972.1;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891972.1 -NW_003302555.1 RefSeq exon 2444 2523 . - . ID=id1;Parent=rna0;Dbxref=Genbank:XM_002891972.1,GeneID:9330760;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891972.1 -NW_003302555.1 RefSeq exon 2124 2347 . - . ID=id2;Parent=rna0;Dbxref=Genbank:XM_002891972.1,GeneID:9330760;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891972.1 -NW_003302555.1 RefSeq exon 1803 2035 . - . ID=id3;Parent=rna0;Dbxref=Genbank:XM_002891972.1,GeneID:9330760;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891972.1 -NW_003302555.1 RefSeq exon 1423 1642 . - . ID=id4;Parent=rna0;Dbxref=Genbank:XM_002891972.1,GeneID:9330760;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891972.1 -NW_003302555.1 RefSeq exon 407 782 . - . ID=id5;Parent=rna0;Dbxref=Genbank:XM_002891972.1,GeneID:9330760;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891972.1 -NW_003302555.1 RefSeq exon 47 252 . - . ID=id6;Parent=rna0;Dbxref=Genbank:XM_002891972.1,GeneID:9330760;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891972.1 -NW_003302555.1 RefSeq CDS 2444 2503 . - 0 ID=cds0;Parent=rna0;Dbxref=InterPro:IPR006088,JGIDB:Araly1_887207,Genbank:XP_002892018.1,GeneID:9330760;Name=XP_002892018.1;Note=similar to possible aldehyde decarbonylase%3B expressed hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892018.1 -NW_003302555.1 RefSeq CDS 2124 2347 . - 0 ID=cds0;Parent=rna0;Dbxref=InterPro:IPR006088,JGIDB:Araly1_887207,Genbank:XP_002892018.1,GeneID:9330760;Name=XP_002892018.1;Note=similar to possible aldehyde decarbonylase%3B expressed hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892018.1 -NW_003302555.1 RefSeq CDS 1803 2035 . - 1 ID=cds0;Parent=rna0;Dbxref=InterPro:IPR006088,JGIDB:Araly1_887207,Genbank:XP_002892018.1,GeneID:9330760;Name=XP_002892018.1;Note=similar to possible aldehyde decarbonylase%3B expressed hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892018.1 -NW_003302555.1 RefSeq CDS 1423 1642 . - 2 ID=cds0;Parent=rna0;Dbxref=InterPro:IPR006088,JGIDB:Araly1_887207,Genbank:XP_002892018.1,GeneID:9330760;Name=XP_002892018.1;Note=similar to possible aldehyde decarbonylase%3B expressed hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892018.1 -NW_003302555.1 RefSeq CDS 407 782 . - 1 ID=cds0;Parent=rna0;Dbxref=InterPro:IPR006088,JGIDB:Araly1_887207,Genbank:XP_002892018.1,GeneID:9330760;Name=XP_002892018.1;Note=similar to possible aldehyde decarbonylase%3B expressed hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892018.1 -NW_003302555.1 RefSeq CDS 67 252 . - 0 ID=cds0;Parent=rna0;Dbxref=InterPro:IPR006088,JGIDB:Araly1_887207,Genbank:XP_002892018.1,GeneID:9330760;Name=XP_002892018.1;Note=similar to possible aldehyde decarbonylase%3B expressed hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892018.1 -NW_003302555.1 RefSeq gene 3311 6198 . - . ID=gene1;Dbxref=GeneID:9328081;Name=ARALYDRAFT_470048;gbkey=Gene;gene_biotype=protein_coding;locus_tag=ARALYDRAFT_470048 -NW_003302555.1 RefSeq mRNA 3311 6198 . - . ID=rna1;Parent=gene1;Dbxref=Genbank:XM_002891973.1,GeneID:9328081;Name=XM_002891973.1;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891973.1 -NW_003302555.1 RefSeq exon 5631 6198 . - . ID=id7;Parent=rna1;Dbxref=Genbank:XM_002891973.1,GeneID:9328081;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891973.1 -NW_003302555.1 RefSeq exon 5319 5538 . - . ID=id8;Parent=rna1;Dbxref=Genbank:XM_002891973.1,GeneID:9328081;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891973.1 -NW_003302555.1 RefSeq exon 4851 5228 . - . ID=id9;Parent=rna1;Dbxref=Genbank:XM_002891973.1,GeneID:9328081;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891973.1 -NW_003302555.1 RefSeq exon 4730 4736 . - . ID=id10;Parent=rna1;Dbxref=Genbank:XM_002891973.1,GeneID:9328081;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891973.1 -NW_003302555.1 RefSeq exon 4483 4590 . - . ID=id11;Parent=rna1;Dbxref=Genbank:XM_002891973.1,GeneID:9328081;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891973.1 -NW_003302555.1 RefSeq exon 4164 4364 . - . ID=id12;Parent=rna1;Dbxref=Genbank:XM_002891973.1,GeneID:9328081;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891973.1 -NW_003302555.1 RefSeq exon 3810 4082 . - . ID=id13;Parent=rna1;Dbxref=Genbank:XM_002891973.1,GeneID:9328081;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891973.1 -NW_003302555.1 RefSeq exon 3513 3708 . - . ID=id14;Parent=rna1;Dbxref=Genbank:XM_002891973.1,GeneID:9328081;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891973.1 -NW_003302555.1 RefSeq exon 3311 3490 . - . ID=id15;Parent=rna1;Dbxref=Genbank:XM_002891973.1,GeneID:9328081;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891973.1 -NW_003302555.1 RefSeq CDS 5631 6123 . - 0 ID=cds1;Parent=rna1;Dbxref=InterPro:IPR006088,JGIDB:Araly1_470048,Genbank:XP_002892019.1,GeneID:9328081;Name=XP_002892019.1;Note=conserved hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892019.1 -NW_003302555.1 RefSeq CDS 5319 5538 . - 2 ID=cds1;Parent=rna1;Dbxref=InterPro:IPR006088,JGIDB:Araly1_470048,Genbank:XP_002892019.1,GeneID:9328081;Name=XP_002892019.1;Note=conserved hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892019.1 -NW_003302555.1 RefSeq CDS 4851 5228 . - 1 ID=cds1;Parent=rna1;Dbxref=InterPro:IPR006088,JGIDB:Araly1_470048,Genbank:XP_002892019.1,GeneID:9328081;Name=XP_002892019.1;Note=conserved hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892019.1 -NW_003302555.1 RefSeq CDS 4730 4736 . - 1 ID=cds1;Parent=rna1;Dbxref=InterPro:IPR006088,JGIDB:Araly1_470048,Genbank:XP_002892019.1,GeneID:9328081;Name=XP_002892019.1;Note=conserved hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892019.1 -NW_003302555.1 RefSeq CDS 4483 4590 . - 0 ID=cds1;Parent=rna1;Dbxref=InterPro:IPR006088,JGIDB:Araly1_470048,Genbank:XP_002892019.1,GeneID:9328081;Name=XP_002892019.1;Note=conserved hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892019.1 -NW_003302555.1 RefSeq CDS 4164 4364 . - 0 ID=cds1;Parent=rna1;Dbxref=InterPro:IPR006088,JGIDB:Araly1_470048,Genbank:XP_002892019.1,GeneID:9328081;Name=XP_002892019.1;Note=conserved hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892019.1 -NW_003302555.1 RefSeq CDS 3810 4082 . - 0 ID=cds1;Parent=rna1;Dbxref=InterPro:IPR006088,JGIDB:Araly1_470048,Genbank:XP_002892019.1,GeneID:9328081;Name=XP_002892019.1;Note=conserved hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892019.1 -NW_003302555.1 RefSeq CDS 3529 3708 . - 0 ID=cds1;Parent=rna1;Dbxref=InterPro:IPR006088,JGIDB:Araly1_470048,Genbank:XP_002892019.1,GeneID:9328081;Name=XP_002892019.1;Note=conserved hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892019.1 -NW_003302555.1 RefSeq gene 7429 7630 . + . ID=gene2;Dbxref=GeneID:9328082;Name=ARALYDRAFT_887209;gbkey=Gene;gene_biotype=protein_coding;locus_tag=ARALYDRAFT_887209 -NW_003302555.1 RefSeq mRNA 7429 7630 . + . ID=rna2;Parent=gene2;Dbxref=Genbank:XM_002889282.1,GeneID:9328082;Name=XM_002889282.1;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002889282.1 -NW_003302555.1 RefSeq exon 7429 7630 . + . ID=id16;Parent=rna2;Dbxref=Genbank:XM_002889282.1,GeneID:9328082;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002889282.1 -NW_003302555.1 RefSeq CDS 7449 7610 . + 0 ID=cds2;Parent=rna2;Dbxref=JGIDB:Araly1_887209,Genbank:XP_002889328.1,GeneID:9328082;Name=XP_002889328.1;Note=similar to unnamed protein product%3B expressed hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002889328.1 -NW_003302555.1 RefSeq gene 9512 10567 . + . ID=gene3;Dbxref=GeneID:9325393;Name=ARALYDRAFT_470049;gbkey=Gene;gene_biotype=protein_coding;locus_tag=ARALYDRAFT_470049 -NW_003302555.1 RefSeq mRNA 9512 10567 . + . ID=rna3;Parent=gene3;Dbxref=Genbank:XM_002889283.1,GeneID:9325393;Name=XM_002889283.1;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002889283.1 -NW_003302555.1 RefSeq exon 9512 9564 . + . ID=id17;Parent=rna3;Dbxref=Genbank:XM_002889283.1,GeneID:9325393;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002889283.1 -NW_003302555.1 RefSeq exon 9576 9657 . + . ID=id18;Parent=rna3;Dbxref=Genbank:XM_002889283.1,GeneID:9325393;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002889283.1 -NW_003302555.1 RefSeq exon 9873 10567 . + . ID=id19;Parent=rna3;Dbxref=Genbank:XM_002889283.1,GeneID:9325393;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002889283.1 -NW_003302555.1 RefSeq CDS 9576 9657 . + 0 ID=cds3;Parent=rna3;Dbxref=JGIDB:Araly1_470049,Genbank:XP_002889329.1,GeneID:9325393;Name=XP_002889329.1;Note=conserved hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002889329.1 -NW_003302555.1 RefSeq CDS 9873 10471 . + 2 ID=cds3;Parent=rna3;Dbxref=JGIDB:Araly1_470049,Genbank:XP_002889329.1,GeneID:9325393;Name=XP_002889329.1;Note=conserved hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002889329.1 -NW_003302555.1 RefSeq gene 10652 11944 . - . ID=gene4;Dbxref=GeneID:9325394;Name=ARALYDRAFT_677681;end_range=11944,.;gbkey=Gene;gene_biotype=protein_coding;locus_tag=ARALYDRAFT_677681;partial=true;start_range=.,10652 -NW_003302555.1 RefSeq mRNA 10652 11944 . - . ID=rna4;Parent=gene4;Dbxref=Genbank:XM_002891974.1,GeneID:9325394;Name=XM_002891974.1;end_range=11944,.;gbkey=mRNA;partial=true;product=predicted protein;start_range=.,10652;transcript_id=XM_002891974.1 -NW_003302555.1 RefSeq exon 11813 11944 . - . ID=id20;Parent=rna4;Dbxref=Genbank:XM_002891974.1,GeneID:9325394;end_range=11944,.;gbkey=mRNA;partial=true;product=predicted protein;transcript_id=XM_002891974.1 -NW_003302555.1 RefSeq exon 11260 11619 . - . ID=id21;Parent=rna4;Dbxref=Genbank:XM_002891974.1,GeneID:9325394;gbkey=mRNA;partial=true;product=predicted protein;transcript_id=XM_002891974.1 -NW_003302555.1 RefSeq exon 11044 11202 . - . ID=id22;Parent=rna4;Dbxref=Genbank:XM_002891974.1,GeneID:9325394;gbkey=mRNA;partial=true;product=predicted protein;transcript_id=XM_002891974.1 -NW_003302555.1 RefSeq exon 10782 11006 . - . ID=id23;Parent=rna4;Dbxref=Genbank:XM_002891974.1,GeneID:9325394;gbkey=mRNA;partial=true;product=predicted protein;transcript_id=XM_002891974.1 -NW_003302555.1 RefSeq exon 10652 10711 . - . ID=id24;Parent=rna4;Dbxref=Genbank:XM_002891974.1,GeneID:9325394;gbkey=mRNA;partial=true;product=predicted protein;start_range=.,10652;transcript_id=XM_002891974.1 -NW_003302555.1 RefSeq CDS 11813 11944 . - 0 ID=cds4;Parent=rna4;Dbxref=JGIDB:Araly1_677681,Genbank:XP_002892020.1,GeneID:9325394;Name=XP_002892020.1;end_range=11944,.;gbkey=CDS;partial=true;product=hypothetical protein;protein_id=XP_002892020.1 -NW_003302555.1 RefSeq CDS 11260 11619 . - 0 ID=cds4;Parent=rna4;Dbxref=JGIDB:Araly1_677681,Genbank:XP_002892020.1,GeneID:9325394;Name=XP_002892020.1;gbkey=CDS;partial=true;product=hypothetical protein;protein_id=XP_002892020.1 -NW_003302555.1 RefSeq CDS 11044 11202 . - 0 ID=cds4;Parent=rna4;Dbxref=JGIDB:Araly1_677681,Genbank:XP_002892020.1,GeneID:9325394;Name=XP_002892020.1;gbkey=CDS;partial=true;product=hypothetical protein;protein_id=XP_002892020.1 -NW_003302555.1 RefSeq CDS 10782 11006 . - 0 ID=cds4;Parent=rna4;Dbxref=JGIDB:Araly1_677681,Genbank:XP_002892020.1,GeneID:9325394;Name=XP_002892020.1;gbkey=CDS;partial=true;product=hypothetical protein;protein_id=XP_002892020.1 -NW_003302555.1 RefSeq CDS 10652 10711 . - 0 ID=cds4;Parent=rna4;Dbxref=JGIDB:Araly1_677681,Genbank:XP_002892020.1,GeneID:9325394;Name=XP_002892020.1;gbkey=CDS;partial=true;product=hypothetical protein;protein_id=XP_002892020.1 -NW_003302555.1 RefSeq gene 12552 13416 . - . ID=gene5;Dbxref=GeneID:9328083;Name=ARALYDRAFT_470051;gbkey=Gene;gene_biotype=protein_coding;locus_tag=ARALYDRAFT_470051 -NW_003302555.1 RefSeq mRNA 12552 13416 . - . ID=rna5;Parent=gene5;Dbxref=Genbank:XM_002891975.1,GeneID:9328083;Name=XM_002891975.1;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891975.1 -NW_003302555.1 RefSeq exon 13395 13416 . - . ID=id25;Parent=rna5;Dbxref=Genbank:XM_002891975.1,GeneID:9328083;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891975.1 -NW_003302555.1 RefSeq exon 13267 13382 . - . ID=id26;Parent=rna5;Dbxref=Genbank:XM_002891975.1,GeneID:9328083;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891975.1 -NW_003302555.1 RefSeq exon 12873 12949 . - . ID=id27;Parent=rna5;Dbxref=Genbank:XM_002891975.1,GeneID:9328083;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891975.1 -NW_003302555.1 RefSeq exon 12552 12843 . - . ID=id28;Parent=rna5;Dbxref=Genbank:XM_002891975.1,GeneID:9328083;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891975.1 -NW_003302555.1 RefSeq CDS 13267 13357 . - 0 ID=cds5;Parent=rna5;Dbxref=InterPro:IPR010625,JGIDB:Araly1_470051,Genbank:XP_002892021.1,GeneID:9328083;Name=XP_002892021.1;Note=similar to unknown protein%3B expressed hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892021.1 -NW_003302555.1 RefSeq CDS 12873 12949 . - 2 ID=cds5;Parent=rna5;Dbxref=InterPro:IPR010625,JGIDB:Araly1_470051,Genbank:XP_002892021.1,GeneID:9328083;Name=XP_002892021.1;Note=similar to unknown protein%3B expressed hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892021.1 -NW_003302555.1 RefSeq CDS 12739 12843 . - 0 ID=cds5;Parent=rna5;Dbxref=InterPro:IPR010625,JGIDB:Araly1_470051,Genbank:XP_002892021.1,GeneID:9328083;Name=XP_002892021.1;Note=similar to unknown protein%3B expressed hypothetical protein;gbkey=CDS;product=hypothetical protein;protein_id=XP_002892021.1 -NW_003302555.1 RefSeq gene 13702 15386 . - . ID=gene6;Dbxref=GeneID:9328084;Name=ARALYDRAFT_887213;gbkey=Gene;gene_biotype=protein_coding;locus_tag=ARALYDRAFT_887213 -NW_003302555.1 RefSeq mRNA 13702 15386 . - . ID=rna6;Parent=gene6;Dbxref=Genbank:XM_002891976.1,GeneID:9328084;Name=XM_002891976.1;gbkey=mRNA;product=pentatricopeptide repeat-containing protein;transcript_id=XM_002891976.1 -NW_003302555.1 RefSeq exon 15007 15386 . - . ID=id29;Parent=rna6;Dbxref=Genbank:XM_002891976.1,GeneID:9328084;gbkey=mRNA;product=pentatricopeptide repeat-containing protein;transcript_id=XM_002891976.1 -NW_003302555.1 RefSeq exon 13702 14936 . - . ID=id30;Parent=rna6;Dbxref=Genbank:XM_002891976.1,GeneID:9328084;gbkey=mRNA;product=pentatricopeptide repeat-containing protein;transcript_id=XM_002891976.1 -NW_003302555.1 RefSeq CDS 15007 15363 . - 0 ID=cds6;Parent=rna6;Dbxref=InterPro:IPR002885,JGIDB:Araly1_887213,Genbank:XP_002892022.1,GeneID:9328084;Name=XP_002892022.1;gbkey=CDS;product=pentatricopeptide repeat-containing protein;protein_id=XP_002892022.1 -NW_003302555.1 RefSeq CDS 13722 14936 . - 0 ID=cds6;Parent=rna6;Dbxref=InterPro:IPR002885,JGIDB:Araly1_887213,Genbank:XP_002892022.1,GeneID:9328084;Name=XP_002892022.1;gbkey=CDS;product=pentatricopeptide repeat-containing protein;protein_id=XP_002892022.1 -NW_003302555.1 RefSeq gene 15665 19464 . - . ID=gene7;Dbxref=GeneID:9328085;Name=ARALYDRAFT_887214;gbkey=Gene;gene_biotype=protein_coding;locus_tag=ARALYDRAFT_887214 -NW_003302555.1 RefSeq mRNA 15665 19464 . - . ID=rna7;Parent=gene7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;Name=XM_002891977.1;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 19419 19464 . - . ID=id31;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 19254 19339 . - . ID=id32;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 19143 19184 . - . ID=id33;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 19010 19055 . - . ID=id34;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 18847 18933 . - . ID=id35;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 18687 18742 . - . ID=id36;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 18425 18542 . - . ID=id37;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 18246 18304 . - . ID=id38;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 18062 18133 . - . ID=id39;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 17884 17947 . - . ID=id40;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 17676 17779 . - . ID=id41;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 17403 17474 . - . ID=id42;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 17206 17292 . - . ID=id43;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 17048 17115 . - . ID=id44;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 16813 16881 . - . ID=id45;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 16652 16734 . - . ID=id46;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 16343 16442 . - . ID=id47;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 16032 16097 . - . ID=id48;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 -NW_003302555.1 RefSeq exon 15841 15934 . - . ID=id49;Parent=rna7;Dbxref=Genbank:XM_002891977.1,GeneID:9328085;gbkey=mRNA;product=hypothetical protein;transcript_id=XM_002891977.1 diff --git a/examples/case1/case1.loc b/examples/case1/case1.loc new file mode 100644 index 00000000..105c0ad9 --- /dev/null +++ b/examples/case1/case1.loc @@ -0,0 +1,68 @@ +from core/atomic import null +from core/table import merge + + +export main as run + +typedef CName :: String +typedef FBioSeq :: File + +Table :: table Record + +typedef BlastResult :: Table + { + qseqid :: String, + sseqid :: String, + qlen :: Int, + slen :: Int, + qstart :: Int, + qstop :: Int, + sstart :: Int, + sstop :: Int, + bitscore :: Num, + pident :: Num, + positive :: Num, + evalue :: Num + } + +type aggregate :: CName -> Table -> Table +type ref2name :: File -> Table +type tblastn :: File -> File -> BlastResult +type makeblastdb :: File -> File +type fastq2fasta :: File -> File +type cat :: [File] -> File +type gunzip :: File -> File +type wget :: URL -> File +type get_children :: Int -> File -> File +type fasta_grep :: [String] -> File -> File +type taxid2sciname :: Void -> Table +type get_taxid_children :: Int -> Table + + +main = null $ aggregate 2 8 $ merge 1 1 ( ref2name prot ) blastresult + +blastresult = tblastn prot blastdb + +blastdb = makeblastdb (fastaq2fasta $ cat db) + +prot = + fasta_grep + ( cut 2 $ merge 1 1 taxid2sciname (get_taxid_children focal_taxid) ) + ( gunzip $ wget dataurl ) + +db = "reads.fastq" +taxid = 6656 +dataurl = 'ftp://ftp.ncbi.nlm.nih.gov/refseq/release/mitochondrion/mitochondrion.1.protein.faa.gz' + +before main :: setup_litade +before main :: setup_smof + +after main :: hist $ nthcol 2 + +after prot/merge :: hist $ nthcol 2 where + set arg hist :: + breaks=50 + main="A plot of prot/merge" + +alias tblastn :: morloc_tblastn +alias makeblastdb :: morloc_makeblastdb diff --git a/examples/case1/config.loc b/examples/case1/config.loc new file mode 100644 index 00000000..be203f8c --- /dev/null +++ b/examples/case1/config.loc @@ -0,0 +1,7 @@ +include case1 + +set arg tblastn :: + -task tblastn-fast + -evalue 0.001 + -num_threads 8 + -max_target_seqs 1000000000 diff --git a/executable/Main.hs b/executable/Main.hs new file mode 100644 index 00000000..4ab77f1c --- /dev/null +++ b/executable/Main.hs @@ -0,0 +1,6 @@ +module Main (main) where + +import MorlocExecutable.Repl (repl) + +main :: IO () +main = repl diff --git a/executable/MorlocExecutable/Mode.hs b/executable/MorlocExecutable/Mode.hs new file mode 100644 index 00000000..13c9a1f8 --- /dev/null +++ b/executable/MorlocExecutable/Mode.hs @@ -0,0 +1,49 @@ +module MorlocExecutable.Mode (asCode, asResult) where + +import System.Directory +import System.Process + +import Morloc.Graph +import Morloc.Data +import Morloc.Generator (generate) + +asCode :: Graph MData -> IO () +asCode g = case generate g of + (nexus, pools) -> putStr $ nexusCode ++ poolCode where + nexusCode = unlines ["NEXUS", indent nexus] + poolCode = concatMap writePool pools + + indent :: String -> String + indent = unlines . map (\s -> " " ++ s) . lines + + writePool :: Show a => (a, String) -> String + writePool (l,c) = unlines [show l, indent c] + + +asResult :: Graph MData -> IO () +asResult g = case generate g of + (nexus, pools) -> do + + -- write nexus to a file + writeExeFile ("nexus.sh", nexus) + + mapM_ writeExeFile pools + + -- execute nexus, recording STDOUT to string + _ <- rawSystem "./nexus.sh" [] + + -- cleanup + removeFile "nexus.sh" + mapM_ (removeFile . fst) pools + +setExecutable :: FilePath -> IO () +setExecutable f = do + p <- getPermissions f + setPermissions f (p {executable = True}) + +writeExeFile :: (String,String) -> IO () +writeExeFile (name,code) = do + -- write pools to files + writeFile name code + -- make poosl executable + setExecutable name diff --git a/executable/MorlocExecutable/Repl.hs b/executable/MorlocExecutable/Repl.hs new file mode 100644 index 00000000..37e13ef4 --- /dev/null +++ b/executable/MorlocExecutable/Repl.hs @@ -0,0 +1,48 @@ +module MorlocExecutable.Repl (repl) where + +import System.Console.Repline +import Control.Monad.State.Strict +import Data.List (isPrefixOf) +import Data.Maybe (fromMaybe) + +import Morloc (interpret) +import MorlocExecutable.Mode (asResult) + +type Repl a = HaskelineT IO a + +say :: MonadIO m => String -> m () +say = liftIO . putStrLn + +says :: (MonadIO m, Show a) => a -> m () +says = liftIO . print + +-- main command, interpret Morloc +cmd :: String -> Repl() +cmd line = case interpret line of + (Left err) -> say err + (Right res) -> liftIO . asResult $ res + +opts :: [(String, [String] -> Repl ())] +opts = [( "cat", catFiles)] + +catFiles :: [String] -> Repl () +catFiles args = liftIO $ do + contents <- readFile (unwords args) + putStrLn contents + +repl = evalRepl prompt cmd opts autocomplete start where + + prompt = "morloc> " + + matcher :: MonadIO m => [(String, CompletionFunc m)] + matcher = [(":cat", fileCompleter)] + + byWord :: Monad m => WordCompleter m + byWord n = do + let names = [":cat"] + return $ filter (isPrefixOf n) names + + autocomplete = Prefix (wordCompleter byWord) matcher + + start :: Repl () + start = return () diff --git a/frontend/Makefile b/frontend/Makefile deleted file mode 100644 index 352f8475..00000000 --- a/frontend/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -TARGET=morloc -CC=gcc -XXFLAGS=-Wall -Wextra -Wno-unused-parameter -g -std=gnu99 -# XXFLAGS=-Wall -Wextra -Wno-unused-parameter \ -# -Wno-implicit-function-declaration -Wno-int-conversion \ -# -Wformat-security \ -# -g -std=c99 -LINKERFLAGS=-lfl - -SRC_BISON=${TARGET}.y -SRC_LEXER=${TARGET}.l - -LEXER=lex.yy -PARSER=${TARGET}.tab - -OBJECTS = \ - label.o \ - couplet.o \ - manifold.o \ - section.o \ - w.o \ - ws.o \ - lhs.o \ - hof.o \ - ws_access.o \ - type_util.o \ - type_Generic.o \ - type_GenericList.o \ - type_HomoSet.o \ - type_HomoSetList.o \ - type_ManifoldList.o \ - type.o \ - build_io.o \ - build_path.o \ - build_mod.o \ - build.o \ - lil.o \ - ${LEXER}.o \ - bufstack.o - -${TARGET}: ${OBJECTS} - ${CC} -o ${TARGET} ${OBJECTS} ${PARSER}.o ${LINKERFLAGS} - -%.o: %.c %.h - ${CC} -c ${XXFLAGS} $< -o $@ - -${LEXER}.o: ${SRC_LEXER} ${SRC_BISON} - flex ${SRC_LEXER} - bison -d --report=all -Wall ${SRC_BISON} - ${CC} -c ${XXFLAGS} ${LEXER}.c ${PARSER}.c - -.PHONY: clean -clean: - rm -f ${TARGET} ${PARSER}.[hc] ${LEXER}.[hc] - rm -rf ${OBJECTS} ${PARSER}.o - rm -f tok.log morloc.output - rm -f vgcore* diff --git a/frontend/bufstack.c b/frontend/bufstack.c deleted file mode 100644 index 6dbe47e3..00000000 --- a/frontend/bufstack.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "bufstack.h" - -char* yyfilename = NULL; - -bufstack *current_bs = NULL; - -int newfile(char* fn){ - FILE *f = fopen(fn, "r"); - - char* home = getenv("HOME"); - - if(f == NULL){ - char* lib = ".morloc/lib"; - int size = strlen(fn) + strlen(home) + strlen(lib) + 3; - char* libfn = (char*)malloc(size * sizeof(char)); - sprintf(libfn, "%s/%s/%s", home, lib, fn); - f = fopen(libfn, "r"); - if(f == NULL){ - warn("Could not find '%s'\n", libfn); - return 1; - } - free(libfn); - } - - struct bufstack *bs = malloc(sizeof(struct bufstack)); - if(bs == NULL){ - warn("malloc error\n"); - return 0; - } - - if(current_bs != NULL) current_bs->lineno = yylineno; - - bs->prev = current_bs; - bs->bs = yy_create_buffer(f, YY_BUF_SIZE); - bs->lineno = 1; - bs->filename = strdup(fn); - bs->f = f; - - yy_switch_to_buffer(bs->bs); - - current_bs = bs; - yyfilename = bs->filename; - yylineno = 1; - - return 1; -} - -int popfile(void){ - struct bufstack *bs = current_bs; - struct bufstack *prevbs; - - if(bs == NULL) return 0; - - fclose(bs->f); - free(bs->filename); - yy_delete_buffer(bs->bs); - - prevbs = current_bs->prev; - free(bs); - - if(prevbs == NULL) return 0; - - yy_switch_to_buffer(prevbs->bs); - current_bs = prevbs; - - yylineno = current_bs->lineno; - yyfilename = current_bs->filename; - - return 1; -} diff --git a/frontend/bufstack.h b/frontend/bufstack.h deleted file mode 100644 index 8d3d142a..00000000 --- a/frontend/bufstack.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __BUFSTACK_H__ -#define __BUFSTACK_H__ - -#include "lex.yy.h" - -#include -#include -#include -#include - -/* My buffer stack handling code draws heavily from: */ -/* John Levine (2009) 'Flex and Bison' */ -typedef struct bufstack{ - struct bufstack *prev; - YY_BUFFER_STATE bs; - int lineno; - char *filename; - FILE *f; -} bufstack; - -/* descend into an included file */ -int newfile(char *fn); - -/* leave a file */ -int popfile(void); - -/* global variable for storing filename */ -extern char* yyfilename; - -/* global variable for storing buffer stack */ -extern bufstack *current_bs; - -#endif diff --git a/frontend/build.c b/frontend/build.c deleted file mode 100644 index 8eab5bbd..00000000 --- a/frontend/build.c +++ /dev/null @@ -1,20 +0,0 @@ -#include "build.h" - -void build_manifolds(Ws* ws_top, bool verbose_infer){ - - resolve_grprefs(ws_top); - - resolve_derefs(ws_top); - - resolve_refers(ws_top); - - link_modifiers(ws_top); - - propagate_nargs(ws_top); - - set_as_function(ws_top); - - link_inputs(ws_top); - - infer_types(ws_top, verbose_infer); -} diff --git a/frontend/build.h b/frontend/build.h deleted file mode 100644 index 7cb6d022..00000000 --- a/frontend/build.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BUILD_H__ -#define __BUILD_H__ - -#include "build_io.h" -#include "build_path.h" -#include "build_mod.h" - -void build_manifolds(Ws* ws_top, bool infer_verbose); - -#endif diff --git a/frontend/build_io.c b/frontend/build_io.c deleted file mode 100644 index 49df801d..00000000 --- a/frontend/build_io.c +++ /dev/null @@ -1,136 +0,0 @@ -#include "build_io.h" - -void _link_composon(W* a, W* b); -void _link_pair(W* input, W* output); -Ws* _recurse_tail(W*); -Ws* _recurse_head(W*); -bool _is_emmisive(W*); -Ws* _extract_ws(W* w); - -void _set_as_function(W* w); - -void set_as_function(Ws* ws){ - ws_rcmod( - ws, - ws_recurse_most, - w_is_deref, - _set_as_function - ); -} - -void _set_as_function(W* w){ - - Ws* outputs = composon_outputs(w_new(C_COMPOSON, ws_new(w))); - - if(ws_length(outputs) > 1){ - warn("A functionalized composition can have only one output\n"); - } - - W* o = outputs->head; - - if(o->cls == C_MANIFOLD){ - Manifold* output = g_manifold(g_rhs(o)); - output->as_function = (w->cls == C_DEREF) ? true : false; - } -} - -void link_inputs(Ws* ws){ - - ws_recursive_reduce_mod( - ws, // recurse over full symbol table - ws_recurse_composition, // descend into each composition - w_is_composon, // assert e_i must take input - w_is_composon, // assert e_{i+1} must produce output - _link_composon // link output of b to input of a - ); - -} - - -void _link_composon(W* a, W* b){ - - // identify the elements within this composon which take input - Ws* inputs = composon_inputs(a); - - // identify the elements in the next composon which produce output - Ws* outputs = composon_outputs(b); - - // link each input to each output - ws_2mod(inputs, outputs, _link_pair); -} - -Ws* composon_inputs(W* w){ - // recurse to the rightmost manifold set - return ws_rfilter(_extract_ws(w), _recurse_tail, w_is_manifold); -} -Ws* composon_outputs(W* w){ - // recurse to the leftmost manifold set - return ws_rfilter(_extract_ws(w), _recurse_head, _is_emmisive); -} - -Ws* _extract_ws(W* w){ - if(!w) return NULL; - return w->cls == T_PATH ? g_ws(g_rhs(w)): g_ws(w); -} - -bool _is_emmisive(W* w){ - switch(w->cls){ - case C_MANIFOLD: - case C_POSITIONAL: - case C_ARGREF: - case C_REFER: - return true; - default: - return false; - } -} - -Ws* _recurse_tail(W* w){ - Ws* result = NULL; - switch(w->cls){ - case C_NEST: - result = ws_add_val(result, P_WS, g_ws(g_ws(w)->last)); - break; - case T_PATH: - result = ws_add_val(result, P_WS, g_ws(g_ws(g_rhs(w))->last)); - break; - default: - break; - } - return result; -} - -Ws* _recurse_head(W* w){ - Ws* result = NULL; - switch(w->cls){ - case C_NEST: - case C_DEREF: - result = ws_add_val(result, P_WS, g_ws(g_ws(w)->head)); - break; - case T_PATH: - result = ws_add_val(result, P_WS, g_ws(g_ws(g_rhs(w))->head)); - break; - default: - break; - } - if(ws_length(result) > 1){ - warn("A nested expression MUST have exactly 1 output.\n"); - } - return result; -} - -// link all top level elements in c_{i+1} as inputs to c_i -void _link_pair(W* input, W* output){ - if(!input || !output) return; - // I'm dealing with C_MANIFOLD's not P_MANIFOLD's - // A C_MANIFOLD manifold is a couplet with a P_MANIFOLD rhs - if(input->cls == C_MANIFOLD){ - Manifold* m = g_manifold(g_rhs(input)); - m->inputs = ws_add(m->inputs, output); - // Propagate number of manifold arguments to inputs - if(m->nargs != 0 && output->cls == C_MANIFOLD){ - Manifold* o = g_manifold(g_rhs(output)); - o->nargs = m->nargs; - } - } -} diff --git a/frontend/build_io.h b/frontend/build_io.h deleted file mode 100644 index 721d8d99..00000000 --- a/frontend/build_io.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __BUILD_IO_H__ -#define __BUILD_IO_H__ - -#include "ws_access.h" - -void set_as_function(Ws* ws); - -void link_inputs(Ws* ws); - -Ws* composon_inputs(W* w); - -Ws* composon_outputs(W* w); - -#endif diff --git a/frontend/build_mod.c b/frontend/build_mod.c deleted file mode 100644 index 92bc1e34..00000000 --- a/frontend/build_mod.c +++ /dev/null @@ -1,260 +0,0 @@ -#include "build_mod.h" - -void _set_manifold_defaults(W* cm); -void _set_manifold_type(W*, W*); -void _transfer_type(W* type_w, W* man_w); -bool _manifold_modifier(W* w); -void _mod_add_modifiers(Ws* ws_top, W* p); -bool _basename_match(W* w, W* p); -void _add_modifier(W* w, W* p); -Ws* _do_operation(Ws* ws, W* p, char op); - -void link_modifiers(Ws* ws_top){ - - // Set default function names for all manifolds - ws_filter_mod(ws_top, get_manifolds, _set_manifold_defaults); - - // Set manifold type based off the manifold names - ws_2mod( - // get all manifolds - ws_rfilter(ws_top, ws_recurse_composition, w_is_manifold), - // get all defined types - ws_rfilter(ws_top, ws_recurse_section, w_is_type), - // if the names match, add the type to the manifold - _set_manifold_type - ); - - // set manifold languages - // this must be done prior to setting other modifiers - Ws* langs = ws_rfilter(ws_top, ws_recurse_most, w_is_lang); - langs = ws_map_split(langs, ws_split_couplet); - ws_map_pmod(ws_top, langs, _mod_add_modifiers); - - // add modifiers to all manifolds - Ws* cs = ws_rfilter(ws_top, ws_recurse_most, _manifold_modifier); - cs = ws_map_split(cs, ws_split_couplet); - ws_map_pmod(ws_top, cs, _mod_add_modifiers); - -} - -// Given the couplet {Label, Manifold}, transfer the name from Label to -// Manifold->function IFF it is not already defined. -void _set_manifold_defaults(W* cm){ - Manifold* m = g_manifold(g_rhs(cm)); - char* name = g_label(g_lhs(cm))->name; - char* lang = g_label(g_lhs(cm))->lang; - m->function = strdup(name); - m->lang = lang ? strdup(lang) : NULL; -} - -void _set_manifold_type(W* mw, W* tw){ - - Ws* w_types = ws_split_couplet(tw); - - ws_cap( - w_types, // for t in types - mw, // given manifold m - w_string_equal, // if name(m) == name(type) - _transfer_type // m->type = type - ); -} -void _transfer_type(W* type_w, W* man_w){ - Manifold* m = g_manifold(g_rhs(man_w)); - if(m->type){ - fprintf(stderr, "TYPE WARNING: redeclaration of '%s' type\n", m->function); - } - m->type = g_ws(g_rhs(type_w)); -} - -bool _manifold_modifier(W* w){ - switch(w->cls){ - case T_H0: - case T_H1: - case T_H2: - case T_H3: - case T_H4: - case T_H5: - case T_H6: - case T_H7: - case T_H8: - case T_H9: - case T_CACHE: - case T_ASSERT: - case T_FAIL: - case T_ALIAS: - case T_DOC: - case T_ARGUMENT: - return true; - case T_LANG: // Language must be set first - return false; - default: - return false; - } -} - -void _mod_add_modifiers(Ws* ws_top, W* p){ - ws_prmod( - ws_top, - p, - ws_recurse_path, - _basename_match, - _add_modifier, - w_nextval_ifpath - ); -} - -bool _basename_match(W* w, W* p){ - bool result = false; - if(w->cls == C_MANIFOLD){ - Ws* pws = g_ws(g_lhs(p)); - result = - ws_length(pws) == 1 && - label_cmp(g_label(pws->head), g_label(g_lhs(w))); - } - return result; -} - -char* get_lang(W* w){ - W* lhs = g_lhs(w); - char* lang = NULL; - switch(lhs->cls){ - case K_LABEL: - lang = g_label(lhs)->lang; - break; - case K_LIST: - case K_PATH: - lang = g_label(g_ws(lhs)->head)->lang; - break; - case K_NAME: - lang = NULL; - break; - default: - lang = NULL; - break; - } - return lang; -} - -// add the modifier stored in p (rhs of couplet) to w -// if: -// 1. the p->lhs contains only one name -// 2. the name matches the name of w -void _add_modifier(W* w, W* p){ - if(!p || w->cls != C_MANIFOLD) return; - Manifold* m = g_manifold(g_rhs(w)); - W* rhs = g_rhs(p); - char op = g_couplet(p)->op; - - char* mod_lang = get_lang(p); - char* man_lang = m->lang; - - if(mod_lang && - man_lang && - strcmp(mod_lang, man_lang) != 0) return; - - switch(p->cls){ - case T_ALIAS: - if(g_string(rhs)){ - m->function = g_string(rhs); - } else { - _set_manifold_defaults(w); - } - break; - case T_LANG: - m->lang = g_string(rhs) ? g_string(rhs) : "*"; - break; - - /* For compositional modifiers add all ultimate manifolds */ - case T_H0: m->h0 = g_ws(rhs) ? _do_operation(m->h0, g_ws(rhs)->head, op) : NULL; break; - case T_H1: m->h1 = g_ws(rhs) ? _do_operation(m->h1, g_ws(rhs)->head, op) : NULL; break; - case T_H2: m->h2 = g_ws(rhs) ? _do_operation(m->h2, g_ws(rhs)->head, op) : NULL; break; - case T_H3: m->h3 = g_ws(rhs) ? _do_operation(m->h3, g_ws(rhs)->head, op) : NULL; break; - case T_H4: m->h4 = g_ws(rhs) ? _do_operation(m->h4, g_ws(rhs)->head, op) : NULL; break; - case T_H5: m->h5 = g_ws(rhs) ? _do_operation(m->h5, g_ws(rhs)->head, op) : NULL; break; - case T_H6: m->h6 = g_ws(rhs) ? _do_operation(m->h6, g_ws(rhs)->head, op) : NULL; break; - case T_H7: m->h7 = g_ws(rhs) ? _do_operation(m->h7, g_ws(rhs)->head, op) : NULL; break; - case T_H8: m->h8 = g_ws(rhs) ? _do_operation(m->h8, g_ws(rhs)->head, op) : NULL; break; - case T_H9: m->h9 = g_ws(rhs) ? _do_operation(m->h9, g_ws(rhs)->head, op) : NULL; break; - - case T_ASSERT: - m->assert = g_ws(rhs) ? _do_operation(m->assert, g_ws(rhs)->head, op) : NULL; - break; - case T_FAIL: - m->fail = g_ws(rhs) ? _do_operation(m->fail, g_ws(rhs)->head, op) : NULL; - break; - - case T_ARGUMENT: - op = g_couplet(rhs) ? op : '!'; - switch(op){ - case '-': - warn( - "The ':-' operator is not supported for args." - " Nor will it ever be (%s:%d)\n", - __func__, __LINE__ - ); - break; - case '=': - m->args = ws_new(rhs); - break; - case '+': - m->args = ws_add_val(m->args, P_ARGUMENT, g_couplet(rhs)); - break; - case '!': - m->args = NULL; - break; - default: - warn( - "Unexpected operator at (%s:%d)\n", - __func__, __LINE__ - ); - break; - } - break; - - case T_CACHE: - m->cache = g_string(rhs) ? ws_add_val(m->cache, P_STRING, g_string(rhs)) : NULL; - break; - case T_DOC: - m->doc = g_string(rhs) ? ws_add_val(m->doc, P_STRING, g_string(rhs)) : NULL; - break; - default: - break; - warn( - "Illegal p (%s) in %s:%d\n", - w_class_str(p->cls), __func__, __LINE__ - ); - } -} - -bool _none_match(W* w, W* ps){ - bool result = true; - Manifold* mw = g_manifold(g_rhs(w)); - for(W* p = g_ws(ps)->head; p; p = p->next){ - if(mw->uid == g_manifold(g_rhs(p))->uid){ - result = false; - break; - } - } - return result; -} - -Ws* _do_operation(Ws* ws, W* p, char op){ - switch(op){ - case '+': - ws = ws_join(ws, g_ws(p)); - break; - case '=': - ws = ws_copy(g_ws(p)); - break; - case '-': - ws = ws_pfilter(ws, p, _none_match); - break; - default: - warn( - "Unexpected operator (%c) in %s:%d\n", - op, __func__, __LINE__ - ); - break; - } - return ws; -} diff --git a/frontend/build_mod.h b/frontend/build_mod.h deleted file mode 100644 index 57ab14e0..00000000 --- a/frontend/build_mod.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __BUILD_MOD_H__ -#define __BUILD_MOD_H__ - -#include "ws_access.h" -#include "type.h" - -void link_modifiers(Ws* ws_top); - -#endif diff --git a/frontend/build_path.c b/frontend/build_path.c deleted file mode 100644 index 43aea7cf..00000000 --- a/frontend/build_path.c +++ /dev/null @@ -1,163 +0,0 @@ -#include "build_path.h" - -void _resolve_grprefs_r(Ws* current, Ws* global); -void _resolve_one_grpref(W* e_ref, Ws* global); -bool _matches_path(W* w, W* p); - -void _resolve_one_deref(W* w); - -void resolve_grprefs(Ws* ws){ - _resolve_grprefs_r(ws, ws); -} - -/* Requires input of both a global and current table. The global one is the top - * level symbol table where all paths should be searched without recursion. The - * current table is where group references should be sought.*/ -void _resolve_grprefs_r(Ws* current, Ws* global){ - ws_ref_rmod( - current, // current list over which to recurse - global, // global list (passed into _resolve_one_grpref - ws_recurse_most, // recursion rule - w_is_grpref, // criterion for calling resolve_one_grpref - _resolve_one_grpref // main operation - ); -} - -void _resolve_one_grpref(W* e_ref, Ws* global){ - - Ws* path = ws_yaf(global, e_ref, ws_recurse_section, _matches_path); - - if(!path){ - warn("ERROR: group reference could not be resolved -- path not found\n"); - return; - } - if(ws_length(path) > 1){ - warn("ERROR: group reference could not be resolved -- ambiguous paths\n"); - return; - } - - force_set_couplet(e_ref, T_PATH, g_couplet(path->head)); - - w_clone_value(e_ref); - - _resolve_grprefs_r(g_ws(g_rhs(e_ref)), global); - -} - -bool _matches_path(W* w, W* p){ - return - w->cls == T_PATH && - p->cls == C_GRPREF && - strcmp(g_label(g_lhs(w))->name, g_string(p)) == 0; -} - - -void resolve_refered(W* man, W* ref){ - if(ref->cls == C_REFER){ - s_couplet(ref, g_couplet(man)); - } -} -bool w_is_matching_manifold(W* w, W* ref){ - bool result = false; - if(w->cls == C_MANIFOLD){ - result = w_equal_lhs(w, ref); - } - return result; -} -void seek_referenced_manifold(W* ref, Ws* top){ - ws_modcrawl( - top, - ref, - ws_recurse_most, - w_is_matching_manifold, - resolve_refered - ); -} -void resolve_refers(Ws* ws){ - ws_ref_rmod( - ws, - ws, - ws_recurse_most, - w_is_refer, - seek_referenced_manifold - ); -} - - -void resolve_derefs(Ws* ws){ - // set nargs within the derefs - ws_rcmod(ws, ws_recurse_most, w_is_deref, _resolve_one_deref); -} - -W* _highest_argref(W* w, W* p){ - return (!p || g_string(w)[0] > g_string(p)[0]) ? w : p; -} - -void _set_nargs(W* w, W* p){ - sscanf(g_string(p), "%d", &g_manifold(g_rhs(w))->nargs); -} - -bool _w_is_manifold(W* w, W* p){ - return w_is_manifold(w); -} - -void _resolve_one_deref(W* w){ - // Find the highest ARGREF, e.g. 3 in `(g . $3 f . $1 $2 )` - W* margs = ws_scrap( - g_ws(w), - NULL, - ws_recurse_most, - w_is_argref, - _highest_argref - ); - - if(margs){ - // pass ARGREF onto all descendents of this DEREF - ws_modcrawl( - g_ws(w), - margs, - ws_recurse_most, - _w_is_manifold, - _set_nargs - ); - } -} - - -// NOTE: this propagates the number of manifold arguments to the head manifold -// in the given composition. It does not propagate into the rest of the -// composition. This job is performed when input/oututs are linked. -void _copy_nargs(W* a, W* b){ - Manifold* ma = g_manifold(g_rhs(a)); - Manifold* mb = g_manifold(b); - ma->nargs = mb->nargs; -} -bool _has_args(W* a, W* b){ - return g_manifold(b)->nargs != 0; -} -void _propagate_one_nargs(W* w){ - Manifold* m = g_manifold(g_rhs(w)); - - ws_cap(m->assert, g_rhs(w), _has_args, _copy_nargs); - - ws_cap(m->h0, g_rhs(w), _has_args, _copy_nargs); - ws_cap(m->h1, g_rhs(w), _has_args, _copy_nargs); - ws_cap(m->h2, g_rhs(w), _has_args, _copy_nargs); - ws_cap(m->h3, g_rhs(w), _has_args, _copy_nargs); - ws_cap(m->h4, g_rhs(w), _has_args, _copy_nargs); - ws_cap(m->h5, g_rhs(w), _has_args, _copy_nargs); - ws_cap(m->h6, g_rhs(w), _has_args, _copy_nargs); - ws_cap(m->h7, g_rhs(w), _has_args, _copy_nargs); - ws_cap(m->h8, g_rhs(w), _has_args, _copy_nargs); - ws_cap(m->h9, g_rhs(w), _has_args, _copy_nargs); - - ws_cap(m->fail, g_rhs(w), _has_args, _copy_nargs); -} -void propagate_nargs(Ws* ws){ - ws_rcmod( - ws, - ws_recurse_most, - w_is_manifold, - _propagate_one_nargs - ); -} diff --git a/frontend/build_path.h b/frontend/build_path.h deleted file mode 100644 index 61b9eddf..00000000 --- a/frontend/build_path.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __BUILD_PATH_H__ -#define __BUILD_PATH_H__ - -#include "ws_access.h" -#include "build_io.h" // needed for composon_inputs/composon_outputs - -void resolve_grprefs(Ws* ws); - -void resolve_refers(Ws* ws); - -void resolve_derefs(Ws* ws); - -void propagate_nargs(Ws* ws); - -#endif diff --git a/frontend/couplet.c b/frontend/couplet.c deleted file mode 100644 index 6fdd83d8..00000000 --- a/frontend/couplet.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "couplet.h" - -Couplet* couplet_new(struct W* lhs, struct W* rhs, char op){ - Couplet* c = (Couplet*)malloc(sizeof(Couplet)); - c->lhs = lhs; - c->rhs = rhs; - c->op = op; - return c; -} - -Couplet* couplet_copy(Couplet* c){ - return couplet_new(c->lhs, c->rhs, c->op); -} diff --git a/frontend/couplet.h b/frontend/couplet.h deleted file mode 100644 index d69a6d97..00000000 --- a/frontend/couplet.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __COUPLET_H__ -#define __COUPLET_H__ - -#include - -typedef struct Couplet{ - struct W* lhs; - struct W* rhs; - char op; -} Couplet; - -Couplet* couplet_new(struct W* lhs, struct W* rhs, char op); - -Couplet* couplet_copy(Couplet* c); - -#endif diff --git a/frontend/hof.c b/frontend/hof.c deleted file mode 100644 index 3996532a..00000000 --- a/frontend/hof.c +++ /dev/null @@ -1,373 +0,0 @@ -#include "hof.h" - -Ws* ws_rfilter( Ws* ws, Ws*(*recurse)(W*), bool(*criterion)(W*) ){ - Ws* result = NULL; - if(!ws || !ws->head) return NULL; - for(W* w = ws->head; w; w = w->next){ - if(criterion(w)){ - result = ws_add(result, w); - } - Ws* rs = recurse(w); - if(!rs) continue; - for(W* r = rs->head; r; r = r->next){ - Ws* down = ws_rfilter(g_ws(r), recurse, criterion); - result = ws_join(result, down); - } - } - return result; -} - -Ws* ws_pfilter(Ws* ws, W* p, bool(*criterion)(W*, W*)){ - Ws* result = NULL; - if(!ws || !ws->head) return NULL; - for(W* w = ws->head; w; w = w->next){ - if(criterion(w, p)){ - result = ws_add(result, w); - } - } - return result; -} - -Ws* ws_prfilter( - Ws* ws, - W* p, - Ws*(*recurse)(W* w, W* p), - bool(*criterion)(W* w, W* p), - W*(*nextval)(W* w, W* p) -){ - Ws* result = NULL; - if(!ws || !ws->head) return NULL; - for(W* w = ws->head; w; w = w->next){ - if(criterion(w, p)){ - result = ws_add(result, w); - } - Ws* rs = recurse(w, p); - if(!rs) continue; - for(W* r = rs->head; r; r = r->next){ - Ws* down = ws_prfilter(g_ws(r), nextval(w, p), recurse, criterion, nextval); - result = ws_join(result, down); - } - } - return result; -} - -Ws* ws_yaf( - Ws* ws, - W* p, - Ws*(*recurse)(W* w), - bool(*criterion)(W* w, W* p) -){ - Ws* result = NULL; - if(!ws || !ws->head) return NULL; - for(W* w = ws->head; w; w = w->next){ - if(criterion(w, p)){ - result = ws_add(result, w); - } - Ws* rs = recurse(w); - if(!rs) continue; - for(W* r = rs->head; r; r = r->next){ - Ws* down = ws_yaf(g_ws(r), p, recurse, criterion); - result = ws_join(result, down); - } - } - return result; -} - - -void ws_modcrawl( - Ws* ws, - W* p, - Ws*(*recurse)(W*), - bool(*criterion)(W*, W*), - void(*mod)(W*, W*) -){ - if(!ws || !ws->head) return; - for(W* w = ws->head; w; w = w->next){ - if(criterion(w, p)){ - mod(w, p); - } - Ws* rs = recurse(w); - if(!rs) continue; - for(W* r = rs->head; r; r = r->next){ - ws_modcrawl(g_ws(r), p, recurse, criterion, mod); - } - } -} - -void ws_prmod( - Ws* ws, - W* p, - Ws*(*recurse)(W* w, W* p), - bool(*criterion)(W* w, W* p), - void(*mod)(W* w, W* p), - W*(*nextval)(W* w, W* p) -){ - if(!ws || !ws->head) return; - for(W* w = ws->head; w; w = w->next){ - if(criterion(w,p)){ - mod(w, p); - } - Ws* rs = recurse(w, p); - if(!rs) continue; - for(W* r = rs->head; r; r = r->next){ - ws_prmod(g_ws(r), nextval(w, p), recurse, criterion, mod, nextval); - } - } -} - -void ws_recursive_reduce_mod( - Ws* ws, - Ws*(*recurse)(W*), - bool(*lc)(W*), - bool(*rc)(W*), - void(*mod)(W*, W*) -){ - if(!ws || !ws->head) return; - for(W* a = ws->head; a; a = a->next){ - W* b = a->next; - if(lc(a) && rc(b)){ - mod(a, b); - } - Ws* rs = recurse(a); - if(!rs) continue; - for(W* r = rs->head; r; r = r->next){ - ws_recursive_reduce_mod(g_ws(r), recurse, lc, rc, mod); - } - } -} - -void ws_ref_rmod( - Ws* ws, - Ws* ps, - Ws*(*recurse)(W*), - bool(*criterion)(W*), - void(*mod)(W* w, Ws* ps) -){ - if(!ws || !ws->head) return; - for(W* w = ws->head; w; w = w->next){ - if(criterion(w)){ - mod(w, ps); - } - Ws* rs = recurse(w); - if(!rs) continue; - for(W* r = rs->head; r; r = r->next){ - ws_ref_rmod(g_ws(r), ps, recurse, criterion, mod); - } - } -} - -void ws_rcmod( - Ws* ws, - Ws*(*recurse)(W*), - bool(*criterion)(W*), - void(*mod)(W*) -){ - if(!ws || !ws->head) return; - for(W* w = ws->head; w; w = w->next){ - if(criterion(w)){ - mod(w); - } - Ws* rs = recurse(w); - if(!rs) continue; - for(W* r = rs->head; r; r = r->next){ - ws_rcmod(g_ws(r), recurse, criterion, mod); - } - } -} -void ws_cmod( - Ws* ws, - bool(*criterion)(W*), - void(*mod)(W*) -){ - if(!ws || !ws->head) return; - for(W* w = ws->head; w; w = w->next){ - if(criterion(w)){ - mod(w); - } - } -} - -W* ws_scrap( - Ws* ws, - W* st, - Ws*(*recurse)(W*), - bool(*criterion)(W*), - W*(*mod)(W*, W*) -){ - if(!ws || !ws->head) return st; - for(W* w = ws->head; w; w = w->next){ - if(criterion(w)){ - st = mod(w, st); - } - Ws* rs = recurse(w); - if(!rs) continue; - for(W* r = rs->head; r; r = r->next){ - st = ws_scrap(g_ws(r), st, recurse, criterion, mod); - } - } - return st; -} - -void ws_cap( - Ws* ws, - W* m, - bool(*criterion)(W*, W*), - void(*mod)(W* w, W* m) -){ - if(!ws || !ws->head) return; - for(W* w = ws->head; w; w = w->next){ - if(criterion(w, m)){ - mod(w, m); - } - } -} - -void ws_map_pmod(Ws* xs, Ws* ps, void(*pmod)(Ws*, W*)){ - if(!ps) return; - for(W* p = ps->head; p; p = p->next){ - pmod(xs, p); - } -} - -Ws* ws_map_split(Ws* ws, Ws*(*split)(W*)){ - if(!ws) return NULL; - Ws* result = NULL; - for(W* w = ws->head; w; w = w->next){ - result = ws_join(result, split(w)); - } - return result; -} - -void ws_mod(Ws* ws, void(*mod)(W*)){ - if(!ws) return; - for(W* w = ws->head; w; w = w->next){ - mod(w); - } -} - -void ws_2mod(Ws* xs, Ws* ys, void(*mod)(W*, W*)){ - if(!(xs && ys)) return; - for(W* x = xs->head; x; x = x->next){ - for(W* y = ys->head; y; y = y->next){ - mod(x, y); - } - } -} - -void ws_3mod(Ws* xs, Ws* ys, Ws* zs, void(*mod)(W* x, W* y, W* z)){ - if(!(xs && ys && zs)) return; - for(W* x = xs->head; x; x = x->next){ - for(W* y = ys->head; y; y = y->next){ - for(W* z = zs->head; z; z = z->next){ - mod(x, y, z); - } - } - } -} - -Ws* ws_map(Ws* xs, W*(*fun)(W*)){ - Ws* ys = NULL; - if(!xs) return ys; - for(W* w = xs->head; w; w = w->next){ - ys = ws_add(xs, fun(w)); - } - return ys; -} - -Ws* ws_m2n_map(Ws* xs, Ws* ys, Ws*(*fun)(W* x, Ws* ys)){ - if(!xs) return NULL; - - for(W* x = xs->head; x; x = x->next){ - ys = fun(x, ys); - } - return ys; -} - -void ws_zip_mod(Ws* xs, Ws* ys, void(*mod)(W*, W*)){ - if(!(xs && ys)) return; - W* x = xs->head; - W* y = ys->head; - for(; x && y; x = x->next, y = y->next){ - mod(x, y); - } -} - -W* ws_szap(Ws* xs, Ws* ys, W* st, W*(*mod)(W*, W*, W*)){ - if(!(xs && ys)) return st; - W* x = xs->head; - W* y = ys->head; - for(; x && y; x = x->next, y = y->next){ - st = mod(x, y, st); - } - return st; -} - - -void ws_pmod(Ws* ws, W* p, void(*mod)(W*, W*)){ - for(W* w = ws->head; w; w = w->next){ - mod(w, p); - } -} - -void ws_filter_mod(Ws* top, - Ws*(*xfilter)(Ws*), - void(*mod)(W* x) -){ - Ws* xs = xfilter(top); - ws_mod(xs, mod); -} - -void ws_filter_2mod(Ws* top, - Ws*(*xfilter)(Ws*), - Ws*(*yfilter)(Ws*), - void(*mod)(W* x, W* y) -){ - Ws* xs = xfilter(top); - Ws* ys = yfilter(top); - ws_2mod(xs, ys, mod); -} - -void ws_filter_3mod(Ws* top, - Ws*(*xfilter)(Ws*), - Ws*(*yfilter)(Ws*), - Ws*(*zfilter)(Ws*), - void(*mod)(W* x, W* y, W* z) -){ - Ws* xs = xfilter(top); - Ws* ys = yfilter(top); - Ws* zs = zfilter(top); - ws_3mod(xs, ys, zs, mod); -} - - -void ws_cone(Ws* top, - Ws*(*xfilter)(Ws*), - Ws*(*yfilter)(Ws*, W*), - void(*mod)(Ws*, W* x, W* y) -){ - Ws* xs = xfilter(top); - for(W* x = xs->head; x; x = x->next){ - Ws* ys = yfilter(top, x); - for(W* y = ys->head; y; y = y->next){ - mod(top, x, y); - } - } -} - -void ws_2cone(Ws* top, - Ws*(*xfilter)(Ws* top), - Ws*(*yfilter)(Ws* top, W* x), - Ws*(*zfilter)(Ws* top, W* x, W* y), - void(*mod)(Ws* top, W* x, W* y, W* z) -){ - Ws* xs = xfilter(top); - for(W* x = xs->head; x; x = x->next){ - Ws* ys = yfilter(top, x); - for(W* y = ys->head; y; y = y->next){ - Ws* zs = zfilter(top, x, y); - for(W* z = zs->head; z; z = z->next){ - mod(top, x, y, z); - } - } - } -} diff --git a/frontend/hof.h b/frontend/hof.h deleted file mode 100644 index d944492a..00000000 --- a/frontend/hof.h +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef __HOF_H__ -#define __HOF_H__ - -/* The functions declared below are intended to be very general. They should - * not contain any type-specific handling. More specific applications are - * developed in ws_access.h. - */ - -#include "ws.h" - -// Recursively moves through a Ws, accumulating W that meet a criterion into a flat list -Ws* ws_rfilter( - Ws*, - Ws*(*recurse)(W*), - bool(*criterion)(W*) -); - -// Non-recursive filter -Ws* ws_filter( - Ws*, - bool(*criterion)(W*) -); - -// Non-recursive parameterized filter -Ws* ws_pfilter(Ws*, W*, bool(*criterion)(W*, W*)); - -// Parameterized version of ws_rfilter -Ws* ws_prfilter( - Ws*, - W*, - Ws*(*recurse)(W*, W*), - bool(*criterion)(W*, W*), - W*(*nextval)(W*, W*) -); - -// Yet Another Filter -Ws* ws_yaf( - Ws* ws, - W* p, - Ws*(*recurse)(W* w), - bool(*criterion)(W* w, W* p) -); - - -// like ws_prfilter, but modifies rather than filtering. -void ws_prmod( - Ws* ws, - W* p, - Ws*(*recurse)(W*, W*), - bool(*criterion)(W*, W*), - void(*mod)(W*, W*), - W*(*nextval)(W*, W*) -); - -void ws_modcrawl( - Ws* ws, - W* p, - Ws*(*recurse)(W*), - bool(*criterion)(W*, W*), - void(*mod)(W*, W*) -); - -void ws_recursive_reduce_mod( - Ws* ws, - Ws*(*recurse)(W*), - bool(*l_criterion)(W*), - bool(*r_criterion)(W*), - void(*mod)(W*, W*) -); - -// maps ws_prmod over parameter list ps -void ws_map_pmod(Ws* xs, Ws* ps, void(*pmod)(Ws*, W*)); - -/* A 'split' takes one thing and returns several: - * - * split :: a -> [b] - * - * map_split maps a split over a list and flattens the list: - * - * map_split :: [a] -> (a -> [b]) -> [b] - * - * Notice the flattening, the output isn't `[[b]]` - * - * contrast this to a simple map: - * - * map :: [a] -> (a -> b) -> [b] - */ -Ws* ws_map_split(Ws* ws, Ws*(*split)(W*)); - -// Maps over 1, 2, or 3 variables. All combinations are considered, that is, -// ws_2mod is quadratic and ws_3mod is cubic. -void ws_mod(Ws*, void(*mod)(W*)); -void ws_2mod(Ws*, Ws*, void(*mod)(W*, W*)); -void ws_3mod(Ws*, Ws*, Ws*, void(*mod)(W*, W*, W*)); - -// Map each element in X to one element in Y -Ws* ws_map(Ws* xs, W*(*fun)(W*)); - -// calls mod(xs[i], ys[i]) for all i. Stop when first list ends -void ws_zip_mod( - Ws* xs, - Ws* ys, - void(*mod)(W* x, W* y) -); -// stateful zip apply -W* ws_szap( - Ws* xs, - Ws* ys, - W* st, - W*(*mod)(W* x, W* y, W* st) -); - -// Recurse along ws according to `recurse`. Perform function `mod` on all w if -// `criterion`. ws in `mod` are processed in the context of `ps`, which may, -// for example, be a symbol table. -void ws_ref_rmod( - Ws* ws, - Ws* ps, - Ws*(*recurse)(W*), - bool(*criterion)(W*), - void(*mod)(W*, Ws*) -); - -// Recursive Conditional Modifier -void ws_rcmod( - Ws* ws, - Ws*(*recurse)(W*), - bool(*criterion)(W*), - void(*mod)(W*) -); - -// Stateful Conditional Recursive Apply -W* ws_scrap( - Ws* ws, - W* st, - Ws*(*recurse)(W*), - bool(*criterion)(W*), - W*(*mod)(W* w, W* st) -); - -void ws_cap( - Ws* ws, - W* m, - bool(*criterion)(W*, W*), - void(*mod)(W* w, W* m) -); - -void ws_filter_mod( - Ws* top, - Ws*(*xfilter)(Ws*), - void(*mod)(W* x) -); - -void ws_filter_2mod( - Ws* top, - Ws*(*xfilter)(Ws*), - Ws*(*yfilter)(Ws*), - void(*mod)(W* x, W* y) -); - -void ws_filter_3mod( - Ws* top, - Ws*(*xfilter)(Ws*), - Ws*(*yfilter)(Ws*), - Ws*(*zfilter)(Ws*), - void(*mod)(W* x, W* y, W* z) -); - -#endif diff --git a/frontend/label.c b/frontend/label.c deleted file mode 100644 index d6ba2568..00000000 --- a/frontend/label.c +++ /dev/null @@ -1,67 +0,0 @@ -#include "label.h" - -Label* label_new(){ - return (Label*)calloc(1, sizeof(Label)); -} - -Label* label_new_set(char* name, char* label, char* lang){ - Label* l = (Label*)malloc(sizeof(Label)); - l->name = name; - l->label = label; - l->lang = lang; - return l; -} - -Label* label_copy(Label* l){ - char* name = l->name ? strdup(l->name) : NULL; - char* label = l->label ? strdup(l->label) : NULL; - char* lang = l->lang ? strdup(l->lang) : NULL; - return label_new_set(name, label, lang); -} - -// assume 'a' is being searched against 'b' -bool label_cmp(Label* a, Label* b){ - return - // both must exist - ( a && b ) - && - // both must have names - ( a->name && b->name ) - // names must match - && - ( - // EITHER one must be wild - ( - strcmp(a->name, "*") == 0 || strcmp(b->name, "*") == 0 - ) - || - // OR - ( - // names are equal - strcmp(a->name, b->name) == 0 - && - // AND EITHER - ( - // the query has no label - a->label == NULL || - // OR both labeled identically - ( - b->label != NULL && - strcmp(a->label, b->label) == 0 - ) - ) - ) - ) - && - // languages must be compatible - ( - // Either language is unspecified for either - (! a->lang || ! b->lang) - || - // Or language is specified and equal for both - ( - strcmp(a->lang, b->lang) == 0 - ) - ) - ; -} diff --git a/frontend/label.h b/frontend/label.h deleted file mode 100644 index ebe98bcb..00000000 --- a/frontend/label.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __LABEL_H__ -#define __LABEL_H__ - -#include -#include -#include - -typedef struct Label{ - char* name; - char* label; - char* lang; -} Label; - -Label* label_new(); - -// creates a new label with copies of the original strings -Label* label_copy(Label*); - -Label* label_new_set(char* name, char* label, char* lang); - -bool label_cmp(Label* a, Label* b); - -#endif diff --git a/frontend/lhs.c b/frontend/lhs.c deleted file mode 100644 index 31aa26d6..00000000 --- a/frontend/lhs.c +++ /dev/null @@ -1,90 +0,0 @@ -#include "lhs.h" - -char* trim_ws(char* s){ - if(!s) return NULL; - - int N = strlen(s); - - // Set string start to first non-whitespace character OR end of string - int a = 0; - while(isspace(s[a]) && a < N) a++; - - // Set string end to last non-whitespace character - int b = strlen(s) - 1; - while(isspace(s[b]) && b > a) b--; - - int n = b - a + 1; - - char* newstring = (char*)malloc((n+1)*sizeof(char)); - memcpy(newstring, s + a, n); - newstring[n] = '\0'; - - return newstring; -} - -W* label_from_str(char* s, char* lang){ - Label* id = (Label*)calloc(1, sizeof(Label)); - int i = 0; - for(;;i++){ - if(s[i] == '\0'){ - break; - } - else if(s[i] == ':'){ - id->label = strdup(s + i + 1); - break; - } - } - id->name = (char*)malloc((i+1) * sizeof(char)); - id->name = memcpy(id->name, s, i*sizeof(char)); - id->name[i] = '\0'; - - id->name = trim_ws(id->name); - id->label = trim_ws(id->label); - id->lang = lang; - - W* w = w_new(K_LABEL, id); - - return w; -} - -W* path_from_str(char* path_str, char* lang){ - char* s = path_str; - Ws* p = NULL; - for(int i = 0; ; i++){ - if(s[i] == '\0'){ - p = ws_add(p, label_from_str(s, lang)); - break; - } - else if(s[i] == '/'){ - s[i] = '\0'; - p = ws_add(p, label_from_str(s, lang)); - s = s + i + 1; - i = 0; - } - } - - W* w = w_new(K_PATH, p); - - return w; -} - -W* list_from_str(char* list_str, char* lang){ - char* s = list_str; - Ws* ws = NULL; - for(int i = 0; ; i++){ - if(s[i] == '\0'){ - ws = ws_add(ws, path_from_str(s, lang)); - break; - } - else if(s[i] == ','){ - s[i] = '\0'; - ws = ws_add(ws, path_from_str(s, lang)); - s = s + i + 1; - i = 0; - } - } - - W* w = w_new(K_LIST, ws); - - return w; -} diff --git a/frontend/lhs.h b/frontend/lhs.h deleted file mode 100644 index 40694696..00000000 --- a/frontend/lhs.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __LHS_H__ -#define __LHS_H__ - -#include -#include -#include -#include - -#include "ws.h" -#include "label.h" - -W* label_from_str(char* s, char* lang); // W - -W* list_from_str(char* s, char* lang); // W - -W* path_from_str(char* s, char* lang); // W - -#endif diff --git a/frontend/lil.c b/frontend/lil.c deleted file mode 100644 index 0222e4a8..00000000 --- a/frontend/lil.c +++ /dev/null @@ -1,296 +0,0 @@ -#include "lil.h" - -char* _mid(Manifold* m); -char* _mid(Manifold* m); -char* _num(int i); -W* _wtwo(char* c1, char* c2); -W* _wthree(char* c1, char* c2, char* c3); -W* _wfour(char* c1, char* c2, char* c3, char* c4); -W* _wfive(char* c1, char* c2, char* c3, char* c4, char* c5); -Ws* _two(Ws* ws, char* c1, char* c2); -Ws* _three(Ws* ws, char* c1, char* c2, char* c3); -Ws* _four(Ws* ws, char* c1, char* c2, char* c3, char* c4); -Ws* _five(Ws* ws, char* c1, char* c2, char* c3, char* c4, char* c5); -Ws* _pairlist(Ws* lil, Ws* ws, char* cmd, Manifold* m); -Ws* _pathmod(Ws* lil, Ws* ws, char* cmd, Manifold* m); -Ws* _manifold_to_lil(W* cm); -Ws* build_lil_prolog(Ws* ws_top); -Ws* build_lil_manifolds(Ws* ws_top); -Ws* build_lil_epilog(Ws* ws_top); -Ws* _hook(Ws* lil, Ws* ws, char* p, Manifold* m); - -void print_lil(Ws* lil){ - if(!lil) return; - for(W* w = lil->head; w; w = w->next){ - W* ww = wws_head(w); - if(wws_length(w) > 2 && strcmp(LIL_SOURCE, g_string(ww)) == 0){ - printf( - "%s\t%s\n", - g_string(ww), - g_string(ww->next) - ); - ww = ww->next->next; - for(; ww; ww = ww->next){ - // no newline needed, since newline from source is preserved - printf(" %s", g_string(ww)); - } - } else { - printf("%s", g_string(ww)); - for(ww = ww->next; ww; ww = ww->next){ - printf("\t%s", g_string(ww)); - } - } - printf("\n"); - } -} - -Ws* build_lil(Ws* ws_top){ - Ws* lil = NULL; - if(ws_top && ws_top->head){ - lil = ws_join(lil, build_lil_prolog(ws_top)); - lil = ws_join(lil, build_lil_manifolds(ws_top)); - lil = ws_join(lil, build_lil_epilog(ws_top)); - } else { - warn("The symbol table is empty - nothing to do\n"); - } - return lil; -} - -bool _is_source(W* w){ - return w->cls == T_SECTION && - g_lhs(w)->cls == P_SECTION && - strcmp(g_section(g_lhs(w))->name, "source") == 0; -} -Ws* build_lil_prolog(Ws* ws_top){ - Ws* lil = NULL; - - Ws* src = ws_rfilter(ws_top, ws_recurse_section, _is_source); - - if(!src) return lil; - - for(W* e = src->head; e; e = e->next){ - if(wws_length(g_rhs(e)) > 0){ - W* a = wws_join( - _wtwo(LIL_SOURCE, g_section(g_lhs(e))->lang), - g_rhs(e) - ); - lil = ws_add(lil, a); - } - } - return lil; -} - -Ws* build_lil_manifolds(Ws* ws_top){ - Ws* ws_man = ws_rfilter(ws_top, ws_recurse_most, w_is_manifold); - Ws* lil = ws_map_split(ws_man, _manifold_to_lil); - return lil; -} - -Ws* build_lil_epilog(Ws* ws_top){ - Ws* lil = NULL; - - Ws* exp = ws_rfilter(ws_top, ws_recurse_section, w_is_export); - - if(!exp) return lil; - - for(W* e = exp->head; e; e = e->next){ - Ws* exports = get_by_name(ws_top, e); - if(ws_length(exports) == 0){ - warn("Cannot export path\n"); - } else { - Manifold* m = g_manifold(g_rhs(exports->head)); - char* alias = g_string(g_rhs(e)); - if(alias){ - lil = _three(lil, LIL_EXPORT, _mid(m), alias); - } else { - lil = _three(lil, LIL_EXPORT, _mid(m), m->function); - } - } - } - return lil; -} - -Ws* _manifold_to_lil(W* cm){ - Manifold* m = g_manifold(g_rhs(cm)); - - if(!m) return NULL; - - Ws* lil = NULL; - - lil = _three(lil, LIL_EMIT, _mid(m), m->lang ? m->lang : "*"); - - lil = _three(lil, LIL_FUNCTION, _mid(m), m->function); - - if(m->type){ - char* s = type_str(m->type->last); - lil = _three(lil, LIL_TYPE, _mid(m), s); - } - - if(m->nargs > 0){ - char* s = (char*)malloc(10 * sizeof(char)); - sprintf(s, "%d", m->nargs); - lil = _three(lil, LIL_N_MANIFOLD_ARGS, _mid(m), s); - } - - if(m->inputs){ - bool is_typed = false; - W* type = NULL; - char* t_str = NULL; - if(m->type && ws_length(m->type) == (ws_length(m->inputs) + 1)){ - is_typed = true; - type = m->type->head; - } - int i = 0; - for(W* w = m->inputs->head; w; w = w->next){ - t_str = is_typed ? type_str(type) : "*"; - if(is_typed) - type = type->next; - switch(w->cls){ - case C_REFER: - case C_MANIFOLD: - if(g_manifold(g_rhs(w))->as_function) { - lil = _five( - lil, - LIL_FUNCTION_INPUT, - _mid(m), // input id - _num(i++), // position - _mid(g_manifold(g_rhs(w))), // output id - t_str - ); - } else { - lil = _five( - lil, - LIL_MANIFOLD_INPUT, - _mid(m), // input id - _num(i++), // position - _mid(g_manifold(g_rhs(w))), // output id - t_str - ); - } - break; - case C_POSITIONAL: - lil = _five( - lil, - LIL_POSITIONAL_INPUT, - _mid(m), - _num(i++), - g_string(g_rhs(w)), - t_str - ); - break; - case C_ARGREF: - lil = _five( - lil, - LIL_ARG_INPUT, - _mid(m), - _num(i++), - g_string(w), - t_str - ); - break; - case C_DEREF: - // build_io will have pointed the manifold to the - // appropriate manifold within the deref path - break; - default: - break; - } - } - } - - lil = _pathmod(lil, m->assert, LIL_ASSERT, m); - lil = _pathmod(lil, m->fail, LIL_FAIL, m); - - lil = _hook(lil, m->h0, "0", m); - lil = _hook(lil, m->h1, "1", m); - lil = _hook(lil, m->h2, "2", m); - lil = _hook(lil, m->h3, "3", m); - lil = _hook(lil, m->h4, "4", m); - lil = _hook(lil, m->h5, "5", m); - lil = _hook(lil, m->h6, "6", m); - lil = _hook(lil, m->h7, "7", m); - lil = _hook(lil, m->h8, "8", m); - lil = _hook(lil, m->h9, "9", m); - - lil = _pairlist(lil, m->cache, LIL_CACHE, m); - lil = _pairlist(lil, m->doc, LIL_MANIFOLD_DOC, m); - - if(m->args){ - int i = 0; - for(W* w = m->args->head; w; w = w->next){ - W* a = wws_join( - _wfour(LIL_FUNCTION_ARG, _mid(m), _num(i++), g_string(g_lhs(w))), - g_rhs(w) - ); - lil = ws_add(lil, a); - } - } - - return lil; -} - -Ws* _pairlist(Ws* lil, Ws* ws, char* cmd, Manifold* m){ - if(!ws) return lil; - for(W* w = ws->head; w; w = w->next){ - lil = _three(lil, cmd, _mid(m), g_string(w)); - } - return lil; -} - -Ws* _pathmod(Ws* lil, Ws* ws, char* cmd, Manifold* m){ - if(!ws) return lil; - for(W* w = ws->head; w; w = w->next){ - lil = _three(lil, cmd, _mid(m), _mid(g_manifold(g_rhs(w)))); - } - return lil; -} - -Ws* _hook(Ws* lil, Ws* ws, char* p, Manifold* m){ - if(!ws) return lil; - for(W* w = ws->head; w; w = w->next){ - lil = _four(lil, LIL_HOOK, _mid(m), p, _mid(g_manifold(g_rhs(w)))); - } - return lil; -} - -char* _mid(Manifold* m){ - char* s = (char*)calloc(20, sizeof(char)); - sprintf(s, "m%lu", m->uid); - return s; -} - -char* _num(int i){ - char* s = (char*)calloc(20, sizeof(char)); - sprintf(s, "%d", i); - return s; -} - -W* _wtwo(char* c1, char* c2){ - W* a = w_new(P_STRING, c1); - W* b = w_new(P_STRING, c2); - W* out = wws_add(wws_new(a), b); - return out; -} -W* _wthree(char* c1, char* c2, char* c3){ - return wws_add(_wtwo(c1, c2), w_new(P_STRING, c3)); -} -W* _wfour(char* c1, char* c2, char* c3, char* c4){ - return wws_add(_wthree(c1, c2, c3), w_new(P_STRING, c4)); -} -W* _wfive(char* c1, char* c2, char* c3, char* c4, char* c5){ - return wws_add(_wfour(c1, c2, c3, c4), w_new(P_STRING, c5)); -} - -// these just wrappers for the above three -Ws* _two(Ws* ws, char* c1, char* c2){ - return ws_add(ws, _wtwo(c1, c2)); -} -Ws* _three(Ws* ws, char* c1, char* c2, char* c3){ - return ws_add(ws, _wthree(c1, c2, c3)); -} -Ws* _four(Ws* ws, char* c1, char* c2, char* c3, char* c4){ - return ws_add(ws, _wfour(c1, c2, c3, c4)); -} -Ws* _five(Ws* ws, char* c1, char* c2, char* c3, char* c4, char* c5){ - return ws_add(ws, _wfive(c1, c2, c3, c4, c5)); -} diff --git a/frontend/lil.h b/frontend/lil.h deleted file mode 100644 index 62d8adea..00000000 --- a/frontend/lil.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __LIL_H__ -#define __LIL_H__ - -#include "ws_access.h" -#include "type.h" - - -// LIL instruction strings -// ----------------------- -// NOTE: changes must be synced with backends/parse-grammar.awk or possibly -// backends/build.sh. -#define LIL_SOURCE "NSRC" -#define LIL_EXPORT "EXPT" -#define LIL_EMIT "EMIT" -#define LIL_FUNCTION "FUNC" -#define LIL_TYPE "TYPE" -#define LIL_MANIFOLD_INPUT "INPM" -#define LIL_POSITIONAL_INPUT "INPP" -#define LIL_FUNCTION_INPUT "INPF" -#define LIL_ARG_INPUT "INPA" -#define LIL_N_MANIFOLD_ARGS "NARG" -#define LIL_ASSERT "CHEK" -#define LIL_FAIL "FAIL" -#define LIL_CACHE "CACH" -#define LIL_MANIFOLD_DOC "MDOC" -#define LIL_FUNCTION_ARG "FARG" -#define LIL_HOOK "HOOK" - -void print_lil(Ws* lil); - -Ws* build_lil(Ws* t); - -#endif diff --git a/frontend/manifold.c b/frontend/manifold.c deleted file mode 100644 index bb4ec4e2..00000000 --- a/frontend/manifold.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "manifold.h" - -size_t _manifold_uid(){ - static size_t uid = 0; - return uid++; -} - -Manifold* manifold_new(){ - Manifold* m = (Manifold*)calloc(1, sizeof(Manifold)); - m->uid = _manifold_uid(); - return m; -} - -Manifold* manifold_clone(Manifold* m){ - Manifold* new_m = (Manifold*)malloc(sizeof(Manifold)); - memcpy(new_m, m, sizeof(Manifold)); - new_m->uid = _manifold_uid(); - return new_m; -} diff --git a/frontend/manifold.h b/frontend/manifold.h deleted file mode 100644 index 6cb43fc6..00000000 --- a/frontend/manifold.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __MANIFOLD_H__ -#define __MANIFOLD_H__ - -#include -#include -#include - -typedef struct Manifold { - size_t uid; - char* function; - char* lang; - struct Ws* h0; // Couplet - struct Ws* h1; // " - struct Ws* h2; // " - struct Ws* h3; // " - struct Ws* h4; // " - struct Ws* h5; // " - struct Ws* h6; // " - struct Ws* h7; // " - struct Ws* h8; // " - struct Ws* h9; // " - struct Ws* cache; // " - struct Ws* assert; // " - struct Ws* fail; // " - struct Ws* doc; // " - struct Ws* inputs; // Couplet - struct Ws* args; // Couplet> - struct Ws* type; // P_STRING | P_WS - int nargs; // args passed to manifold and onto children - bool as_function; -} Manifold; - -Manifold* manifold_new(); - -// Creates a copy of m with a new uid -Manifold* manifold_clone(Manifold* m); - -#endif diff --git a/frontend/morloc.l b/frontend/morloc.l deleted file mode 100644 index 94cf4aed..00000000 --- a/frontend/morloc.l +++ /dev/null @@ -1,453 +0,0 @@ -%{ -#include -#include - -#include "morloc.tab.h" - -int newfile(char *fn); -int popfile(void); - -FILE* toklog; - -char* current_lang = NULL; - -#define LOG(x) fprintf(toklog, x); fflush(toklog); -#define LOGV(x,a) fprintf(toklog, x, a); fflush(toklog); - -#define RETURN(x, t) \ - LOG(#t " "); \ - yylval.t = x; \ - return t; - -#define RETURN_TOKEN(t) \ - LOG(#t " "); \ - return t; - -// Removes first and last characters around a string -char* unquote(const char* in_str); -// Removes leading whitespace and trailing whitspace and c in in_str -// For example, `trim_back("x ::", ":") --> "x"` -char* trim_back(const char* in_str, const char* c); -// Same as `trim_back(x, "")` -char* trim(const char* in_str); -// Same as `trim_back(x, ":")` -char* trim_couple(const char* in_str); -W* couplet_str_str(char* lhs, char* rhs, Class cls); -// After trimming, it is often necessary to put characters back into the buffer: -// unput a specific string -#define UNPUT_S(x) for(int i = strlen(x)-1; i >= 0; i--){ unput(x[i]); } -// unput k characters -#define UNPUT_N(k) \ - char* zs = strdup(yytext); \ - int zn = strlen(yytext); \ - for(int zi = 0; zi < k; zi++){ unput(zs[zn - zi - 1]); } \ - free(zs); - -#define RETURN_SECTION(s) \ - LOG(#s " "); \ - char* name = (char*)calloc(16, sizeof(char)); \ - char* lang = (char*)calloc(16, sizeof(char)); \ - int n = sscanf(yytext, "@%s %s", name, lang); \ - lang = (n == 2) ? lang : NULL; \ - Section* sec = section_new(name, lang); \ - Couplet* c = couplet_new(w_new(P_SECTION, sec), NULL, '='); \ - yylval.s = w_new(T_SECTION, c); \ - current_lang = lang; \ - return s; - -%} - -%option header-file="lex.yy.h" -%option noyywrap noinput pointer yylineno - -%s S_TYPE -%s S_ONTOLOGY -%s S_INCLUDE -%s S_EXPORT -%x X_COMMENT -%s X_SOURCE -%s S_PATH -%s S_SIDE -%s S_CPLT -%s S_ARG - -ws [ \t\n\r] -comment #.*\n - -sym [a-zA-Z_][a-zA-Z0-9_.-]* -var {sym}(:[a-zA-Z0-9_]+)? -path {var}(\/{var})* -selection ({path}({ws}*,{ws}*{path})*|\*){ws}*:[:=+-] - -type {sym}|\*|\? -list {sym}({ws}*,{ws}*{sym})* - -identifier {var}{ws}*:[:=+-] - -parameter [a-zA-Z0-9_.-]+{ws}*= -flag [-][a-zA-Z0-9_.-]+ - -str \'[^']*\'|\"[^"]*\" -bak `[^`]*` -int -?([0-9]|[1-9][0-9]+) -dbl -?{int}\.[0-9]+ -lgc TRUE|FALSE - -file {sym}(\/{sym})* - -grpref \*{var} -argref ${int} -refer <{var}> - -couple ::|:=|:-|:\+ - -lang ([ ]+[^ \t\n\r]+)? - -%% - - -{comment} { } -^{ws}*----+{ws}*$ { } -; { } - -@comment { BEGIN(X_COMMENT); } -@include { BEGIN(S_INCLUDE); } - -@path{lang} { BEGIN(S_PATH) ; RETURN_SECTION ( SECTION_PATH ) ; } -@assert{lang} { BEGIN(S_SIDE) ; RETURN_SECTION ( SECTION_ASSERT ) ; } -@fail{lang} { BEGIN(S_SIDE) ; RETURN_SECTION ( SECTION_FAIL ) ; } - -@[0-9]{lang} { BEGIN(S_SIDE) ; RETURN_SECTION ( SECTION_HOOK ) ; } -@before{lang} { BEGIN(S_SIDE) ; RETURN_SECTION ( SECTION_HOOK ) ; } -@after{lang} { BEGIN(S_SIDE) ; RETURN_SECTION ( SECTION_HOOK ) ; } - -@source{lang} { BEGIN(X_SOURCE) ; RETURN_SECTION ( SECTION_SOURCE ) ; } -@type{lang} { BEGIN(S_TYPE) ; RETURN_SECTION ( SECTION_TYPE ) ; } -@ontology{lang} { BEGIN(S_ONTOLOGY) ; RETURN_SECTION ( SECTION_ONTOLOGY ) ; } -@cache{lang} { BEGIN(S_CPLT) ; RETURN_SECTION ( SECTION_CACHE ) ; } -@alias{lang} { BEGIN(S_CPLT) ; RETURN_SECTION ( SECTION_ALIAS ) ; } -@lang{lang} { BEGIN(S_CPLT) ; RETURN_SECTION ( SECTION_LANG ) ; } -@doc{lang} { BEGIN(S_CPLT) ; RETURN_SECTION ( SECTION_DOC ) ; } -@arg{lang} { BEGIN(S_ARG) ; RETURN_SECTION ( SECTION_ARG ) ; } -@export{lang} { BEGIN(S_EXPORT) ; RETURN_SECTION ( SECTION_EXPORT ) ; } - -^[ \t]*([^\n@].*)?\n { - char* s = strdup(yytext); - W* w = w_new(P_STRING, s); - RETURN(w, STR); -} -@ { unput('@'); BEGIN INITIAL; } /* allow @ anywhere except ^ */ - -{ws} { LOGV("%s", yytext); } -RESET { RETURN_TOKEN(RESET); } - -@ { unput('@'); BEGIN INITIAL; } -(.|\n) { /* toss bodies */ } -\\@ { /* allow escaped @ */ } - -as { RETURN_TOKEN(AS); } -^{ws}*{path} { - W* w = path_from_str(trim_couple(yytext), current_lang); - RETURN(w, PATH); -} - -{file} { - char* s = trim(yytext); - char* filename = (char*)malloc((strlen(s) + 5) * sizeof(char)); - sprintf(filename, "%s.loc", s); - LOGV("including(%s)\n", filename); - if(!newfile(filename)) yyterminate(); - } -<> { if(!popfile()) yyterminate(); UNPUT_S("\n@include\n"); } - -{couple} { - char op = yytext[1]; - op = op == ':' ? '=' : op; - Couplet* c = couplet_new(NULL, NULL, op); - W* w = w_new(P_COUPLET, c); - RETURN(w, COUPLE); -} - -{identifier} { - W* w = label_from_str(trim_couple(yytext), current_lang); - UNPUT_N(2) - RETURN(w, IDENTIFIER); -} - -{bak} { - W* w = couplet_str_str("*", unquote(yytext), C_POSITIONAL); - RETURN(w, COMPOSON); -} -{int} { - W* w = couplet_str_str("Int", strdup(yytext), C_POSITIONAL); - RETURN(w, COMPOSON); -} -{dbl} { - W* w = couplet_str_str("Num", strdup(yytext), C_POSITIONAL); - RETURN(w, COMPOSON); -} - -{lgc} { - char* s = (strcmp(yytext, "TRUE") == 0) ? "true" : "false"; - W* w = couplet_str_str("Bool", strdup(s), C_POSITIONAL); - RETURN(w, COMPOSON); -} - -{str} { - W* w = couplet_str_str("String", strdup(yytext), C_POSITIONAL); - RETURN(w, COMPOSON); -} - -{var} { - Manifold* m = manifold_new(); - W* l = label_from_str(yytext, current_lang); - W* r = w_new(P_MANIFOLD, m); - Couplet* c = couplet_new(l, r, '.'); - W* wc = w_new(C_MANIFOLD, c); - RETURN(wc, COMPOSON); -} -{grpref} { - char* s = strdup(yytext + 1); - W* w = w_new(C_GRPREF, s); - RETURN(w, COMPOSON); -} -{argref} { - char* s = strdup(yytext + 1); - W* w = w_new(C_ARGREF, s); - RETURN(w, COMPOSON); -} - -{refer} { - Manifold* m = NULL; - W* l = label_from_str(unquote(yytext), current_lang); - W* r = w_new(P_MANIFOLD, m); - Couplet* c = couplet_new(l, r, '.'); - W* wc = w_new(C_REFER, c); - RETURN(wc, COMPOSON); -} - - -{selection} { - W* w = list_from_str(trim_couple(yytext), current_lang); - UNPUT_N(2) - RETURN(w, SELECTION); -} - -{var} { - W* w = w_new(P_STRING, strdup(yytext)); - RETURN(w, VARIABLE); -} - -{str} { - W* w = w_new(P_STRING, strdup(yytext)); - RETURN(w, STR); -} - -{parameter} { - W* w = w_new(P_STRING, trim_back(yytext, "=")); - UNPUT_S("= "); - RETURN(w, NAME); -} -{int}|{dbl}|{lgc}|{sym}|{str}|{flag} { - W* w = w_new(P_STRING, strdup(yytext)); - RETURN(w, PRIMITIVE); -} -{bak} { - /* W* w = couplet_str_str("*", unquote(yytext), C_POSITIONAL); */ - W* w = w_new(P_STRING, unquote(yytext)); - // TODO - this isn't primitive - RETURN(w, PRIMITIVE); -} - -{list}{ws}*:: { - W* w = list_from_str(trim_couple(yytext), current_lang); - UNPUT_N(2) - RETURN(w, NAMES); -} -{type} { - W* w = NULL; - - // Types are considered to be generic if they begin with a lowercase letter - // AND have a length of 1. The inferred type, on the lhs of the couplet, - // defaults to the untyped FT_ATOMIC<'*'>. The explicit type may be - // inferred later. - if(islower(yytext[0]) && strlen(yytext) == 1){ - W* lhs = w_new(P_STRING, strdup(yytext)); - W* rhs = w_new(FT_ATOMIC, "*"); - Couplet* c = couplet_new(lhs, rhs, '='); - w = w_new(FT_GENERIC, c); - // If the type symbol is not lower case, it is considered a primitive - // type, e.g. Int, Bool, or Table. - } else { - w = w_new(FT_ATOMIC, strdup(yytext)); - } - RETURN(w, TYPE); -} --> { RETURN_TOKEN(ARROW); } - -{sym} { - W* w = w_new(P_STRING, strdup(yytext)); - RETURN(w, TYPE); -} - - -. { LOGV("%c", yytext[0]); return yytext[0]; } - -%% - -#include "bufstack.h" - -// Remove the first and last characters of a string -char* unquote(const char* in_str){ - // copy the section of the string between the quotation marks - int N = strlen(in_str); - char* s = (char*)calloc((N-1), sizeof(char)); - memcpy(s, in_str+1, (N-2)*sizeof(char)); - s[N-2] = '\0'; - return s; -} - -char* trim_back(const char* in_str, const char* c) { - char* s = strdup(in_str); - int k = strlen(c); - while(isspace(s[0])) s++; - for(int i = strlen(s)-1; i >= 0; i--){ - if(isspace(s[i])){ - s[i] = '\0'; - continue; - } - for(int j = 0; j < k; j++){ - if(s[i] == c[j]){ - s[i] = '\0'; - goto keep_going; - } - } - break; - keep_going:; - } - return s; -} - -char* trim(const char* in_str) { - return trim_back(in_str, ""); -} - -char* trim_couple(const char* in_str) { - return trim_back(in_str, ":+-="); -} - -W* couplet_str_str(char* lhs, char* rhs, Class cls){ - Couplet* c = couplet_new(w_new(P_STRING, lhs), w_new(P_STRING, rhs), '='); - W* w = w_new(cls, c); - return w; -} - -void print_usage_and_exit(int exit_status){ - fprintf(stderr, -"Morloc compiler\n" -"Usage: morloc [options] myfile.loc\n" -"Arguments:\n" -" -c run the typechecker on manifolds\n" -" -z print type debugging info" -" -t print tokens\n" -" -h print this help message and exit\n" -" -l suppress normal LIL output\n" -" -d recursively dump symbol table\n" - ); - exit(exit_status); -} - -int main(int argc, char ** argv){ - - // === flags ==================================================== - bool run_typechecker = false; // type check the manifolds - bool print_type_debug = false; // print type debugging info - bool log_tokens = false; // print tokens - bool suppress_lil = false; // don't print LIL - bool dump_table = false; // recursively dump symbol table - // -------------------------------------------------------------- - - // has the loc source file been loaded successfully - int file_loaded = 0; - - if(argc == 1){ - print_usage_and_exit(1); - } - - // Process arguments - // - only one source file is allowed - // - flags may be bundled - // - flags and source files can be in any order - do{ - if(argv[1][0] == '-'){ - while(++argv[1] && argv[1][0] != '\0'){ - switch(argv[1][0]){ - case 'z': - print_type_debug = true; - break; - case 'c': - run_typechecker = true; - break; - case 't': - log_tokens = true; - break; - case 'l': - suppress_lil = true; - break; - case 'd': - dump_table = true; - break; - case 'h': - print_usage_and_exit(0); - break; - default: - warn("Argument '%c' not supported\n", argv[1][0]); - break; - } - } - } else { - if(file_loaded){ - warn("Cannot process multiple files\n"); - print_usage_and_exit(1); - } else { - file_loaded = newfile(argv[1]); - if(!file_loaded){ - warn("Could not open file '%s', skipping\n", argv[1]); - } - } - } - } while(argc-- > 2 && argv++); - - if(!file_loaded) { - warn("No readable morloc file found\n"); - print_usage_and_exit(1); - } - if(log_tokens){ - toklog = fopen("/dev/stderr", "w"); - } else { - toklog = fopen("/dev/null", "w"); - } - - - // parse the grammar - int status = yyparse(); - - // build manifolds - // - resolve group references - // - link manifolds to their modifiers - // - link manifolds inputs to manifold outputs - build_manifolds(global_table, print_type_debug); - - // extract LIL as list of lists - Ws* lil = build_lil(global_table); - - // === print statements ========================================= - if( dump_table ) ws_print(global_table, ws_recurse_most); - if( ! suppress_lil ) print_lil(lil); - // -------------------------------------------------------------- - - - fclose(toklog); - - return status; -} diff --git a/frontend/morloc.y b/frontend/morloc.y deleted file mode 100644 index 7ecdabc8..00000000 --- a/frontend/morloc.y +++ /dev/null @@ -1,350 +0,0 @@ -%{ - #include - #include "lex.yy.h" - #include "bufstack.h" - #include "ws.h" - - void yyerror(const char *); - void w_make_couplet(W* w, W* lhs, W* op, W* rhs, Class cls); - void c_make_couplet(W* w, W* lhs, char op, W* rhs, Class cls); - Class hook_type(char*); -%} - -%code requires{ -#include "lil.h" -#include "build.h" -#include "type.h" -#include "ws.h" -#include "lhs.h" -Ws* global_table; -} - -%define api.value.type union - -%token IDENTIFIER /* K_LABEL */ -%token COMPOSON /* C_MANIFOLD | C_GRPREF | C_ARGREF | C_POSITIONAL */ -%token SELECTION /* K_LIST */ -%token PATH /* K_PATH */ - -%token STR NAME NAMES PRIMITIVE VARIABLE TYPE /* P_STRING */ -%type maybe_variable maybe_str - -%token AS ARROW RESET -%token COUPLE - -%token SECTION_HOOK -%token SECTION_CACHE -%token SECTION_PATH -%token SECTION_ASSERT -%token SECTION_FAIL -%token SECTION_ALIAS -%token SECTION_LANG -%token SECTION_DOC -%token SECTION_EXPORT -%token SECTION_SOURCE -%token SECTION_ARG -%token SECTION_TYPE -%token SECTION_ONTOLOGY - -%type composition maybe_composition - -%type section - -%type s_path -%type s_hook -%type s_cache -%type s_assert -%type s_fail -%type s_alias -%type s_lang -%type s_doc -%type s_arg - -%type s_export -%type s_type -%type s_ontology -%type s_source - -%type type -%type ontology construct - -%type maybe_argument /* P_ARGUMENT:V_COUPLET */ -%type array list /* P_WS of P_STRING */ - -%left '.' -%precedence CONCAT -%precedence '&' - -%% - -input - : section { global_table = ws_new($1);} - | input section { global_table = ws_add(global_table, $2); } - -section - : s_path - | s_hook - | s_cache - | s_assert - | s_fail - | s_alias - | s_lang - | s_doc - | s_export - | s_type - | s_ontology - | s_source - | s_arg - - -/* ======================================= */ - -s_path - : SECTION_PATH { $$ = $1; } - | SECTION_PATH composition { - Label* l = label_new_set("default", NULL, NULL); - W* label = w_new(K_LABEL, l); - c_make_couplet($1, label, '=', w_new(P_WS, $2), T_PATH); - } - | s_path IDENTIFIER COUPLE composition { - w_make_couplet($1, $2, $3, w_new(P_WS, $4), T_PATH); - } - -s_hook - : SECTION_HOOK { $$ = $1; } - | s_hook SELECTION COUPLE maybe_composition { - Class c = hook_type(g_section(g_lhs($1))->name); - w_make_couplet($1, $2, $3, w_new(P_WS, $4), c); - } - -s_assert - : SECTION_ASSERT { $$ = $1; } - | s_assert SELECTION COUPLE maybe_composition { - w_make_couplet($1, $2, $3, w_new(P_WS, $4), T_ASSERT); - } - -s_fail - : SECTION_FAIL { $$ = $1; } - | s_fail SELECTION COUPLE maybe_composition { - w_make_couplet($1, $2, $3, w_new(P_WS, $4), T_FAIL); - } - -maybe_composition - : composition { $$ = $1; } - | RESET { $$ = NULL; } - -composition - : COMPOSON { - Ws* ws = ws_new($1); - W* w = w_new(C_COMPOSON, ws); - $$ = ws_new(w); - } - | '(' composition ')' { - W* n = w_new(C_NEST, $2); - W* c = w_new(C_COMPOSON, ws_new(n)); - $$ = ws_new(c); - } - | '&' COMPOSON { - W* e = w_new(C_DEREF, ws_new($2)); - W* c = w_new(C_COMPOSON, ws_new(e)); - $$ = ws_new(c); - } - | '&' '(' composition ')' { - W* d = w_new(C_DEREF, $3); - W* n = w_new(C_COMPOSON, ws_new(d)); - $$ = ws_new(n); - } - | composition composition %prec CONCAT { - $1->last = wws_join($1->last, $2->head); - } - | composition '.' composition { - $$ = ws_join($1, $3); - } - - -/* ======================================= */ - -s_cache - : SECTION_CACHE { $$ = $1; } - | s_cache SELECTION COUPLE maybe_variable { - w_make_couplet($1, $2, $3, $4, T_CACHE); - } - -s_alias - : SECTION_ALIAS { $$ = $1; } - | s_alias SELECTION COUPLE maybe_variable { - w_make_couplet($1, $2, $3, $4, T_ALIAS); - } - -s_lang - : SECTION_LANG { $$ = $1; } - | s_lang SELECTION COUPLE maybe_variable { - w_make_couplet($1, $2, $3, $4, T_LANG); - } - -s_doc - : SECTION_DOC { $$ = $1; } - | s_doc SELECTION COUPLE maybe_str { - w_make_couplet($1, $2, $3, $4, T_DOC); - } - -maybe_variable - : VARIABLE - | RESET { $$ = NULL; } - -maybe_str - : STR - | RESET { $$ = NULL; } - - - /* ======================================= */ - -s_export - : SECTION_EXPORT { $$ = $1; } - | s_export PATH { - c_make_couplet($1, $2, '=', NULL, T_EXPORT); - } - | s_export PATH AS VARIABLE { - c_make_couplet($1, $2, '=', $4, T_EXPORT); - } - - - /* ======================================= */ - -s_source - : SECTION_SOURCE STR { $$ = $1; s_rhs($1, wws_new($2)); } - | s_source STR { - s_rhs($1, wws_add(g_rhs($1), $2)); - } - - - /* ======================================= */ - -s_type - : SECTION_TYPE { $$ = $1; } - | s_type NAMES COUPLE type { - w_make_couplet($1, $2, $3, $4, T_TYPE); - } - -type - : TYPE { $$ = wws_new_cls($1, FT_FUNCTION); } - | '(' type ')' { - $$ = wws_new_cls($2, FT_FUNCTION); - } - | '[' type ']' { - $2->cls = FT_ARRAY; - $$ = wws_new_cls($2, FT_FUNCTION); - } - | type ARROW type { - $$ = wws_join($1, $3); - } - | type ',' type { - $$ = wws_join($1, $3); - $$->cls = FT_TUPLE; - } - - - /* ======================================= */ - -s_ontology - : SECTION_ONTOLOGY { $$ = $1; } - | s_ontology NAMES COUPLE ontology { - w_make_couplet($1, $2, $3, w_new(P_WS, $4), T_ONTOLOGY); - } - -ontology - : construct { $$ = ws_new(w_new(P_WS, $1)); } - | ontology '|' construct { $$ = ws_add($1, w_new(P_WS, $3)); } - -construct - : TYPE { $$ = ws_new($1); } - | construct TYPE { $$ = ws_add($1, $2); } - - - /* ======================================= */ - -s_arg - : SECTION_ARG { $$ = $1; } - | s_arg SELECTION COUPLE maybe_argument { - w_make_couplet($1, $2, $3, $4, T_ARGUMENT); - } - | s_arg maybe_argument { - if($$){ - char op = g_couplet(g_ws(g_rhs($$))->head)->op; - // If multiple arguments are assigned together, the first resets the - // argument list ('='), but subsequent ones are appended ('+'). - op = op == '=' ? '+' : op; - c_make_couplet($1, g_lhs(wws_last(g_rhs($$))), op, $2, T_ARGUMENT); - } else { - warn("ERROR: missing path in argument declaration\n"); - } - } -maybe_argument - : RESET { $$ = NULL; } - | NAME '=' PRIMITIVE { - W* w = w_new(P_WS, ws_new($3)); - $$ = w_new(P_ARGUMENT, couplet_new($1, w, '=')); - } - | PRIMITIVE { - W* w = w_new(P_WS, ws_new($1)); - W* s = w_new(P_STRING, ""); - $$ = w_new(P_ARGUMENT, couplet_new(s, w, '=')); - } - | NAME '=' array { - $$ = w_new(P_ARGUMENT, couplet_new($1, w_new(P_WS, $3), '=')); - } -array - : '[' list ']' { $$ = $2; } - | '[' ']' { $$ = NULL; } -list - : PRIMITIVE { $$ = ws_new($1); } - | list ',' PRIMITIVE { $$ = ws_add($1, $3); } - -%% - -void yyerror(char const *s){ - warn("(%s:%d) %s\n", yyfilename, yylineno, s); -} - -void w_make_couplet(W* w, W* lhs, W* op, W* rhs, Class cls){ - s_lhs(op, lhs); - s_rhs(op, rhs); - op->cls = cls; - W* wc = wws_add(g_rhs(w), op); - s_rhs(w, wc); -} - -void c_make_couplet(W* w, W* lhs, char op, W* rhs, Class cls){ - Couplet* c = couplet_new(lhs, rhs, op); - W* cw = w_new(cls, c); - s_rhs(w, wws_add(g_rhs(w), cw)); -} - -Class hook_type(char* name){ - char c; - if(strcmp(name, "before") == 0){ - c = '4'; - } - else if(strcmp(name, "after") == 0){ - c = '5'; - } - else { - c = name[0]; - } - - switch(c){ - case '0': return T_H0; - case '1': return T_H1; - case '2': return T_H2; - case '3': return T_H3; - case '4': return T_H4; - case '5': return T_H5; - case '6': return T_H6; - case '7': return T_H7; - case '8': return T_H8; - case '9': return T_H9; - default: - warn("Illegal hook section, expected @0-9\n"); - return X_NONE; - } -} diff --git a/frontend/section.c b/frontend/section.c deleted file mode 100644 index 952b98e3..00000000 --- a/frontend/section.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "section.h" - -Section* section_new(char* name, char* lang){ - Section* s = (Section*)malloc(1 * sizeof(Section)); - s->name = name; - s->lang = lang; - return s; -} - -Section* section_copy(Section* section){ - Section* s = (Section*)malloc(1 * sizeof(Section)); - s->name = strdup(section->name); - s->lang = strdup(section->lang); - return s; -} diff --git a/frontend/section.h b/frontend/section.h deleted file mode 100644 index f6ba6dae..00000000 --- a/frontend/section.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __SECTION_H__ -#define __SECTION_H__ - -#include -#include - -typedef struct Section{ - char* name; - char* lang; -} Section; - -Section* section_new(char* name, char* lang); - -Section* section_copy(Section* section); - -#endif diff --git a/frontend/type.c b/frontend/type.c deleted file mode 100644 index d53bb409..00000000 --- a/frontend/type.c +++ /dev/null @@ -1,701 +0,0 @@ -#include "type.h" - -#define IS_ATOMIC(t) ((t)->cls == FT_ATOMIC) -#define IS_GENERIC(t) ((t)->cls == FT_GENERIC) -#define IS_ARRAY(t) ((t)->cls == FT_ARRAY) -#define IS_STAR(t) (IS_ATOMIC((t)) && strcmp(g_string((t)), __WILD__) == 0) -#define IS_MULTI(t) (strcmp(g_string((t)), __MULTI__) == 0) - -#define EQUAL_ATOMICS(a,b) \ - ( \ - IS_ATOMIC(a) && IS_ATOMIC(b) \ - && \ - strcmp(g_string(g_rhs(a)), g_string(g_rhs(a))) == 0 \ - ) - - -// ================================================================== // -// // -// I N I T I A L I Z E D E F A U L T S // -// // -// ================================================================== // - -void _set_default_type(W* w); - -void _set_default_types(Ws* ws){ - ws_rcmod( - ws, - ws_recurse_most, - w_is_manifold, - _set_default_type - ); -} - -void _set_default_type(W* w){ - Manifold* m = g_manifold(g_rhs(w)); - // If the manifold is completely untyped - if(!m->type){ - int ninputs = ws_length(m->inputs); - int ntypes = ninputs ? ninputs + 1 : 2; - for(int i = 0; i < ntypes; i++){ - W* star = NULL; - if(i == 0 && ninputs == 0){ - star = w_new(FT_ATOMIC, __IO__); - } else { - star = w_new(FT_ATOMIC, __WILD__); - } - m->type = ws_add(m->type, star); - } - } - // TODO: deprecate the MULTI feature - // If the manifold has the form `? -> a` - // Then expand `?` to stars according to number of inputs, e.g. - // `? -> a` with 2 inputs (of any kind) --> `* -> * -> a` - // (Currently all other usage of `?` is illegal) - else if( - m->type && - m->type->head->cls == FT_ATOMIC && - strcmp(g_string(m->type->head), __MULTI__) == 0 && - ws_length(m->type) == 2 - ){ - if(ws_length(m->inputs) > 1){ - W* output = w_isolate(m->type->last); - m->type = NULL; - for(W* i = m->inputs->head; i != NULL; i = i->next){ - m->type = ws_add(m->type, w_new(FT_ATOMIC, __WILD__)); - } - m->type = ws_add(m->type, output); - } else { - // TODO: for legacy reasons, I have to use __WILD__ here, because - // the grammars downstream are stupid. But this really should be - // __VOID__ - m->type = ws_add(NULL, w_new(FT_ATOMIC, __WILD__)); - } - } -} - - -/* ========================================================================= // -// // -// I N F E R T Y P E S // -// // -// ========================================================================= // - -Build a list of lists, where each list is a set of elements of that must have -the same type. These sets include: - -1. io groups - Given the forms (a_i. -> a_i. -> ... -> b_i), where in a_ij, i is the id of - the terminal type (b_i) and j is the id of the input type. If b_i is - generic, b_i and all a_.i will form pairs, [(b_i, a_.i)]. If b_i is of - unknown type, but not generic, b_i and all a_.i form one set of uniform - type. - -2. star groups - stars differ from generics in that they are unknown but are the same across - all instances of the function. - -3. entangled generic groups - For example, in the signature `a -> a -> [a]`, each `a` must have the same - type in a given function. The type may differ between functions, though. - -Once the list of lists is built, all explicitly given types and all type -primitives are added. Any type that is known within a group propagates to all -other elements in its group. If a given manifold is present in two groups, the -groups may be merged. ----------------------------------------------------------------------------- */ - - -void _unify( - HomoSet* a, - HomoSet* b, - ManifoldList* mlist, - GenericList* glist, - HomoSetList* hlist -){ - // If the a is a star, swap it with b - if(IS_STAR(a->type)){ - HomoSet* c = a; a = b; b = c; - } - - if(IS_STAR(b->type)){ - // transfer type from a to b - b->type->cls = a->type->cls; - b->type->value = a->type->value; - } - - if(IS_GENERIC(a->type)){ - HomoSet* c = a; a = b; b = c; - } - - if(IS_GENERIC(b->type)){ - char b_symbol = g_string(g_lhs(b->type))[0]; - size_t b_gid = get_generic_id_from_uid(b->mid, b_symbol); - Ws* b_glist = glist->list[b_gid]; - /* both are generic, merge */ - if(IS_GENERIC(a->type)){ - char a_symbol = g_string(g_lhs(a->type))[0]; - size_t a_gid = get_generic_id_from_uid(a->mid, a_symbol); - Ws* a_glist = glist->list[a_gid]; - // If they are equal, then they have already been merged, don't repeat - if(a_glist != b_glist){ - b_glist = ws_join(b_glist, a_glist); - a_glist = b_glist; - } - W* a_head = g_rhs(ws_head(a_glist)); - W* b_head = g_rhs(ws_head(b_glist)); - W* unity = IS_STAR(a_head) ? b_head : a_head; - for(W* g = ws_head(b_glist); g; g = g->next){ - // TODO: assert it hasn't been differently inferred - s_rhs(g, unity); - } - } - - // one is generic, transfer type - else { - // transfer types from a to all instances of b - // FT_GENERIC have the form (generic_label, inferred_type), e.g. - // (a, Int), so we just have to set the rhs of all b to type(a) - for(W* g = ws_head(b_glist); g; g = g->next){ - // TODO: assert it hasn't been differently inferred - s_rhs(g, a->type); - } - } - } - - /* if( a->type->cls == FT_TUPLE || */ - /* a->type->cls == FT_ARRAY || */ - /* a->type->cls == FT_FUNCTION */ - /* ){ */ - /* if(b->type->cls != a->type->cls || */ - /* wws_length(a->type) != wws_length(b->type) */ - /* ){ */ - /* fprintf(stderr, "Type incompatibility: '%s' vs '%s'\n", */ - /* type_str(b->type), type_str(a->type)); */ - /* fprintf(stderr, " --a %s --\n", w_str(a->type)); */ - /* fprintf(stderr, " --b %s --\n", w_str(b->type)); */ - /* } else { */ - /* W* as = wws_head(a->type); */ - /* W* bs = wws_head(b->type); */ - /* for(; as && bs; as = as->next, bs = bs->next){ */ - /* HomoSet* a_hs = (HomoSet*)calloc(1, sizeof(HomoSet)); */ - /* HomoSet* b_hs = (HomoSet*)calloc(1, sizeof(HomoSet)); */ - /* a_hs->type = as; */ - /* a_hs->mid = a->mid; */ - /* a_hs->next = b_hs; */ - /* b_hs->prev = a_hs; */ - /* b_hs->type = bs; */ - /* b_hs->mid = b->mid; */ - /* hlist = append_HomoSetList(hlist, a_hs); */ - /* } */ - /* } */ - /* } */ - -} - -void infer_types(Ws* ws_top, bool verbose){ - // If untyped --> star inputs with appropriate number of arguments - // This also expands `?` types to many stars - _set_default_types(ws_top); - - ManifoldList * ml = create_ManifoldList(ws_top); - HomoSetList * hsl = create_HomoSetList(ml); - GenericList * gl = create_GenericList(ml); - - if(hsl){ - while(hsl->prev) { hsl = hsl->prev; } - for(; hsl; hsl = hsl->next ){ - // This works for pairs, which is all I currently use - HomoSet* hs = hsl->set; - while(hs->prev) { hs = hs->prev; } - _unify(hs, hs->next, ml, gl, hsl); - } - } - - if(verbose){ - print_ManifoldList(ml); - print_HomoSetList(hsl); - print_GenericList(gl); - } -} - - -/* bool _constructor_compatible(W* a, W* b); */ -/* bool _types_are_compatible(W* a, W* b); */ -/* */ -/* void _scream_about_compatibility(W* a, W* b){ */ -/* char* a_str = type_str(a); */ -/* char* b_str = type_str(b); */ -/* fprintf(stderr, "Types '%s' and '%s' are not compatible\n", a_str, b_str); */ -/* } */ -/* void all_io_types_are_compatible(Ws* ws_top){ */ -/* Ws* man = get_manifolds(ws_top); */ -/* for(W* w = ws_head(man); w; w = w->next){ */ -/* Manifold* m = g_manifold(g_rhs(w)); */ -/* W* x = ws_head(m->inputs); */ -/* W* b = ws_head(m->type); */ -/* for(; x && b; x = x->next, b = b->next){ */ -/* W* a = x; */ -/* if(x->cls == C_MANIFOLD){ */ -/* a = ws_last(g_manifold(g_rhs(x))->type); */ -/* } */ -/* if(! _types_are_compatible(a,b) ){ */ -/* _scream_about_compatibility(a,b); */ -/* } */ -/* } */ -/* } */ -/* } */ - - -/* // ========================================================================= // */ -/* // // */ -/* // T Y P E C H E C K // */ -/* // // */ -/* // ========================================================================= // */ -/* */ -/* // takes in all data */ -/* W* _typecheck_derefs(Ws* ws_top, W* msg); */ -/* */ -/* W* _type_compatible(W* i, W* t, W* msg); */ -/* */ -/* #define LOG_ERROR(st, w, s) \ */ -/* do{ \ */ -/* W* wstr = w_new(P_STRING, strdup(s)); \ */ -/* Couplet* cerr = couplet_new(w_clone(w), wstr, '='); \ */ -/* W* werr = w_new(P_COUPLET, cerr); \ */ -/* if(st){ \ */ -/* s_ws(st, ws_add(g_ws(st), werr)); \ */ -/* } else { \ */ -/* Ws* wserr = ws_new(werr); \ */ -/* st = w_new(P_WS, wserr); \ */ -/* } \ */ -/* } while(0) */ -/* */ -/* W* _typecheck(W* w, W* msg){ */ -/* Manifold* m = g_manifold(g_rhs(w)); */ -/* */ -/* if( */ -/* ws_length(m->type) == 2 && */ -/* m->type->head->cls == FT_ATOMIC && */ -/* strcmp(g_string(m->type->head), __MULTI__) == 0 */ -/* ){ */ -/* return msg; */ -/* } */ -/* */ -/* if(!m->type){ */ -/* LOG_ERROR(msg, w, "no declared type"); */ -/* return msg; */ -/* } */ -/* */ -/* */ -/* int n_types = ws_length(m->type) - 1 - type_is_well(m->type); */ -/* int n_inputs = ws_length(m->inputs); */ -/* */ -/* if(ws_length(m->type) < 2){ */ -/* LOG_ERROR(msg, w, "fewer than 2 terms in type"); */ -/* } */ -/* */ -/* if(n_inputs && n_inputs < n_types){ */ -/* LOG_ERROR(msg, w, "too few inputs (currying is not supported)"); */ -/* } */ -/* */ -/* if(n_inputs > n_types){ */ -/* LOG_ERROR(msg, w, "too many inputs"); */ -/* } */ -/* */ -/* Ws* itypes; */ -/* if(type_is_well(m->type)){ */ -/* itypes = NULL; */ -/* return msg; */ -/* } else { */ -/* itypes = ws_init(m->type); */ -/* } */ -/* msg = ws_szap(m->inputs, itypes, msg, _type_compatible); */ -/* */ -/* return msg; */ -/* } */ -/* */ -/* W* type_check(Ws* ws){ */ -/* W* w = ws_scrap(ws, NULL, ws_recurse_composition, w_is_manifold, _typecheck); */ -/* w = _typecheck_derefs(ws, w); */ -/* return w; */ -/* } */ -/* */ -/* W* _typecheck_derefs(Ws* ws, W* msg){ */ -/* [> STUB <] */ -/* return msg; */ -/* } */ -/* */ -/* W* _type_compatible(W* o, W* t, W* msg){ */ -/* switch(o->cls){ */ -/* case C_DEREF: */ -/* case C_REFER: */ -/* case C_ARGREF: */ -/* [> I currently do no type checking on these <] */ -/* break; */ -/* case C_MANIFOLD: */ -/* { */ -/* Manifold *m = g_manifold(g_rhs(o)); */ -/* if(!m->type){ */ -/* LOG_ERROR(msg, o, "cannot check usage of untyped output"); */ -/* } */ -/* else if(!m->as_function){ */ -/* char* o_type = type_str(m->type->last); */ -/* char* i_type = type_str(t); */ -/* if( ! cmp_type(o_type, i_type)){ */ -/* char* fmt = "type conflict '%s' vs '%s'\n"; */ -/* size_t size = */ -/* strlen(fmt) - // length of format string */ -/* 4 + // subtract the '%s' */ -/* strlen(o_type) + // string lengths */ -/* strlen(i_type) + // '' */ -/* 1; // add 1 for \0 */ -/* char* errmsg = (char*)malloc(size * sizeof(char)); */ -/* sprintf(errmsg, fmt, o_type, i_type); */ -/* LOG_ERROR(msg, o, errmsg); */ -/* } */ -/* } */ -/* } */ -/* break; */ -/* case C_POSITIONAL: */ -/* { */ -/* char* o_type = g_string(g_lhs(o)); */ -/* char* i_type = type_str(t); */ -/* if( ! cmp_type(o_type, i_type)){ */ -/* char* fmt = "type conflict positional ('%s') '%s' vs '%s'\n"; */ -/* size_t size = */ -/* strlen(fmt) - // length of the format string */ -/* 6 + // subtract the '%s' */ -/* strlen(o_type) + // add length of type string */ -/* strlen(g_string(g_rhs(o))) + // '' */ -/* strlen(i_type) + // '' */ -/* 1; // add 1 for \0 */ -/* char* errmsg = (char*)malloc(size * sizeof(char)); */ -/* sprintf(errmsg, fmt, o_type, g_string(g_rhs(o)), i_type); */ -/* LOG_ERROR(msg, o, errmsg); */ -/* } */ -/* } */ -/* break; */ -/* default: */ -/* break; */ -/* } */ -/* return msg; */ -/* } */ -/* */ -/* void print_error(W* msg){ */ -/* if(!msg) return; */ -/* for(W* w = g_ws(msg)->head; w; w = w->next){ */ -/* switch(g_lhs(w)->cls){ */ -/* case C_MANIFOLD: */ -/* { */ -/* warn( */ -/* "TYPE ERROR in %s: %s\n", */ -/* g_manifold(g_rhs(g_lhs(w)))->function, */ -/* g_string(g_rhs(w)) */ -/* ); */ -/* } */ -/* break; */ -/* case C_POSITIONAL: */ -/* { */ -/* warn( */ -/* "TYPE ERROR: positional is of type %s, but got %s\n", */ -/* g_string(g_lhs(g_lhs(w))), */ -/* g_string(g_rhs(w)) */ -/* ); */ -/* } */ -/* default: */ -/* break; */ -/* } */ -/* } */ -/* } */ - - -/* void _infer_multi_type(W* w); */ -/* void _infer_generic_type(W* w); */ -/* void _infer_star_type(W* w); */ -/* void _transfer_star_type(W* type, W* input); */ -/* W* _transfer_generic_type(W* t, W* i, W* m); */ -/* void _horizontal_generic_propagation(W* t, Ws* inputs, Ws* types); */ -/* W* _conditional_propagation(W* input, W* type, W* propagule); */ -/* */ -/* void infer_star_types(Ws* ws){ */ -/* ws_rcmod( */ -/* ws, */ -/* ws_recurse_most, */ -/* w_is_manifold, */ -/* _infer_star_type */ -/* ); */ -/* } */ -/* void _infer_star_type(W* w){ */ -/* Manifold* m = g_manifold(g_rhs(w)); */ -/* ws_zip_mod( */ -/* m->type, */ -/* m->inputs, */ -/* _transfer_star_type */ -/* ); */ -/* } */ -/* void _transfer_star_type(W* type, W* input){ */ -/* if(input->cls == C_MANIFOLD){ */ -/* W* itype = g_manifold(g_rhs(input))->type->last; */ -/* if( */ -/* IS_ATOMIC(type) && IS_STAR(type) && */ -/* ! (IS_ATOMIC(itype) && ( IS_STAR(itype) || IS_MULTI(itype))) */ -/* ){ */ -/* type->value = itype->value; */ -/* type->cls = itype->cls; */ -/* } */ -/* if( */ -/* IS_ATOMIC(itype) && IS_STAR(itype) && */ -/* ! (IS_ATOMIC(type) && ( IS_STAR(type) || IS_MULTI(type))) */ -/* ){ */ -/* itype->value = type->value; */ -/* itype->cls = type->cls; */ -/* } */ -/* } */ -/* } */ -/* */ -/* */ -/* void infer_multi_types(Ws* ws){ */ -/* ws_rcmod( */ -/* ws, */ -/* ws_recurse_most, */ -/* w_is_manifold, */ -/* _infer_multi_type */ -/* ); */ -/* } */ -/* void _infer_multi_type(W* w){ */ -/* Manifold *wm, *im; */ -/* wm = g_manifold(g_rhs(w)); */ -/* if(wm->type && */ -/* wm->type->head->cls == FT_ATOMIC && */ -/* strcmp(g_string(wm->type->head), __MULTI__) == 0 && */ -/* ws_length(wm->type) == 2 && */ -/* ws_length(wm->inputs) > 1 */ -/* ){ */ -/* W* output = w_isolate(wm->type->last); */ -/* wm->type = NULL; */ -/* for(W* i = wm->inputs->head; i != NULL; i = i->next){ */ -/* switch(i->cls){ */ -/* case C_ARGREF: */ -/* break; */ -/* case C_POSITIONAL: */ -/* { */ -/* char* ptype = g_string(g_lhs(i)); */ -/* wm->type = ws_add(wm->type, w_new(FT_ATOMIC, ptype)); */ -/* } */ -/* break; */ -/* case C_MANIFOLD: */ -/* { */ -/* im = g_manifold(g_rhs(i)); */ -/* if(ws_length(im->type) > 1){ */ -/* wm->type = ws_add(wm->type, w_clone(im->type->last)); */ -/* } else { */ -/* wm->type = ws_add(wm->type, w_new(FT_ATOMIC, __WILD__)); */ -/* } */ -/* } */ -/* break; */ -/* default: */ -/* warn("Unexpected input type (%s:%d)\n", __func__, __LINE__); */ -/* } */ -/* } */ -/* wm->type = ws_add(wm->type, output); */ -/* } */ -/* } */ -/* */ -/* */ -/* void infer_generic_types(Ws* ws){ */ -/* // 1) find all manifolds and infer their generic types */ -/* ws_rcmod( */ -/* ws, */ -/* ws_recurse_most, */ -/* w_is_manifold, */ -/* _infer_generic_type */ -/* ); */ -/* } */ -/* */ -/* void _infer_generic_type(W* w){ */ -/* Manifold* m = g_manifold(g_rhs(w)); */ -/* // 2) iterate through each type/input pair */ -/* ws_szap( */ -/* m->type, */ -/* m->inputs, */ -/* w, // this handle is needed to propagate types */ -/* _transfer_generic_type */ -/* ); */ -/* } */ -/* */ -/* W* _transfer_generic_type(W* tw, W* iw, W* m){ */ -/* if(tw->cls != FT_GENERIC){ */ -/* return m; */ -/* } */ -/* W* old_type = g_rhs(tw); */ -/* W* new_type = NULL; */ -/* switch(iw->cls){ */ -/* case C_MANIFOLD: */ -/* new_type = ws_last(g_manifold(g_rhs(iw))->type); */ -/* break; */ -/* case C_POSITIONAL: */ -/* new_type = w_new(FT_ATOMIC, g_string(g_lhs(iw))); */ -/* break; */ -/* case C_ARGREF: */ -/* fprintf(stderr, "ARGREF is not yet handled by %s\n", __func__); */ -/* break; */ -/* case C_DEREF: */ -/* case C_GRPREF: */ -/* case C_NEST: */ -/* case C_REFER: */ -/* fprintf(stderr, "These should have been resolved %s:%d\n", */ -/* __func__, __LINE__); */ -/* break; */ -/* default: */ -/* fprintf(stderr, "Weird case at %s:%d\n", __func__, __LINE__); */ -/* break; */ -/* } */ -/* Manifold* man = g_manifold(g_rhs(m)); */ -/* // 3) transfer types from input to type */ -/* char* old_str = type_str(old_type); */ -/* char* new_str = type_str(new_type); */ -/* if( */ -/* strcmp(new_str, __WILD__) != 0 && */ -/* strcmp(old_str, __WILD__) != 0 && */ -/* strcmp(new_str, old_str) != 0 */ -/* ){ */ -/* fprintf(stderr, */ -/* "TYPE ERROR: in '%s'(m%d in %s) expected type '%s', but got '%s'", */ -/* man->function, man->uid, man->lang, old_str, new_str); */ -/* } */ -/* // transfer type */ -/* s_rhs(tw, new_type); */ -/* // 4) for each inferred generic propagate types, die on conflict */ -/* _horizontal_generic_propagation(tw, man->inputs, man->type); */ -/* free(old_str); */ -/* free(new_str); */ -/* return m; */ -/* } */ -/* */ -/* void _horizontal_generic_propagation(W* t, Ws* inputs, Ws* types){ */ -/* ws_szap( */ -/* inputs, // the inputs */ -/* types, // the types */ -/* t, // the propagule, a generic type, FT_GENERIC */ -/* _conditional_propagation */ -/* ); */ -/* } */ -/* */ -/* // Return true if a value was copied, false otherwise */ -/* bool _copy_type_from_a_to_b(W* a, W* b){ */ -/* bool result = false; */ -/* if(!(w_is_ptype(a) && w_is_ptype(b))){ */ -/* fprintf(stderr, "ERROR: Expected a and b to both be types in %s\n", __func__); */ -/* } */ -/* W* ra = g_rhs(a); */ -/* W* rb = g_rhs(b); */ -/* char* a_str = type_str(ra); */ -/* char* b_str = type_str(rb); */ -/* if( */ -/* // they are different (there is something to do) */ -/* strcmp(a_str, b_str) != 0 */ -/* // AND a is defined (there is something to transfer) */ -/* && strcmp(a_str, "*") != 0 */ -/* ){ */ -/* if(strcmp(b_str, "*") == 0){ */ -/* // Input: */ -/* // t - FT_GENERIC */ -/* // g - FT_GENERIC */ -/* // transfer type */ -/* b->value = a->value; */ -/* b->cls = a->cls; */ -/* result = true; */ -/* } else { */ -/* fprintf(stderr, */ -/* "TYPE ERROR: during generic propagation, " */ -/* "expected type '%s', but got '%s'", */ -/* a_str, b_str); */ -/* } */ -/* } */ -/* return result; */ -/* } */ -/* */ -/* // 5) for each inferred generic 1..(k-1) transfer type to input, if needed */ -/* // 6) if k is an inferred generic, */ -/* // a. transfer it to its outputs */ -/* // b. if the output is generic, call #2 on it */ -/* W* _conditional_propagation(W* input, W* type, W* propagule){ */ -/* fprintf(stderr, " --input %s --\n", w_str(input)); */ -/* fprintf(stderr, " --type %s --\n", w_str(type)); */ -/* fprintf(stderr, " --prop %s --\n", w_str(propagule)); */ -/* // propagate to type if */ -/* if( */ -/* // is a generic type */ -/* type->cls == FT_GENERIC */ -/* // AND is the same generic type */ -/* && strcmp(g_string(g_lhs(type)), g_string(g_lhs(propagule))) == 0 */ -/* ){ */ -/* fprintf(stderr, "copying\n"); */ -/* // copy propagule type to current manifold type slot */ -/* _copy_type_from_a_to_b(propagule, type); */ -/* fprintf(stderr, " --input %s --\n", w_str(input)); */ -/* fprintf(stderr, " --type %s --\n", w_str(type)); */ -/* fprintf(stderr, " --prop %s --\n", w_str(propagule)); */ -/* fprintf(stderr, "\n"); */ -/* } */ -/* */ -/* if(input->cls == C_MANIFOLD){ */ -/* Manifold* input_man = g_manifold(g_rhs(input)); */ -/* W* input_type = ws_last(input_man->type); */ -/* if(_copy_type_from_a_to_b(propagule, input_type)){ */ -/* Ws* iinputs = input_man->inputs; */ -/* Ws* itypes = input_man->type; */ -/* _horizontal_generic_propagation(input_type, itypes, iinputs); */ -/* } */ -/* } */ -/* // to make ws_szap hof happy, it requires a return W* */ -/* return NULL; */ -/* } */ -/* */ -/* */ - - -/* // Let a and b be nodes in a type tree. */ -/* // Where */ -/* // Node :: Generic | Primitive | Constructor [Node] */ -/* // The Constructor nodes have 1 or more Node children */ -/* // */ -/* // a and b are compatible if they are specifications of a common Node */ -/* // */ -/* // comp a b = */ -/* // | Generic _ = TRUE */ -/* // | _ Generic = TRUE */ -/* // | Primitive Primitive = a == b */ -/* // | Constructor Constructor = class(a) == class(b) AND all (map (zip a b)) */ -/* // | otherwise = FALSE */ -/* // TODO: This is broken for 1) non-terminating cases `(a,(a,b)) | ((c,d),c)` */ -/* // and 2) cases with multi-use generics, e.g. `(a,a) | (Int,Num)` */ -/* bool _types_are_compatible(W* a, W* b){ */ -/* return */ -/* ( IS_GENERIC(a) || IS_GENERIC(b) ) */ -/* || */ -/* EQUAL_ATOMICS(a,b) */ -/* || */ -/* _constructor_compatible(a,b) */ -/* ; */ -/* } */ -/* bool _constructor_compatible(W* a, W* b){ */ -/* bool compatible = false; */ -/* if( a->cls == b->cls ){ */ -/* if( wws_length(a) == wws_length(b) ){ */ -/* W* aa = wws_head(a); */ -/* W* bb = wws_head(b); */ -/* for(; */ -/* aa && bb; */ -/* aa = aa->next, bb = bb->next) */ -/* { */ -/* if(! _types_are_compatible(aa, bb)){ */ -/* return false; */ -/* } */ -/* } */ -/* compatible = true; */ -/* } */ -/* } */ -/* return compatible; */ -/* } */ diff --git a/frontend/type.h b/frontend/type.h deleted file mode 100644 index b240fa26..00000000 --- a/frontend/type.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __TYPE_H__ -#define __TYPE_H__ - -#include "ws_access.h" -#include "type_util.h" -#include "type_GenericList.h" -#include "type_HomoSetList.h" -#include "type_ManifoldList.h" - -void infer_types(Ws* ws_top, bool verbose); - -#endif diff --git a/frontend/type_Generic.c b/frontend/type_Generic.c deleted file mode 100644 index c09e5787..00000000 --- a/frontend/type_Generic.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "type_Generic.h" - -Generic* append_Generic(Generic* g, W* type, Manifold* m){ - if(!g){ - g = (Generic*)malloc(sizeof(Generic)); - g->type = type; - g->list = NULL; - } - g->list = ws_add_val(g->list, P_MANIFOLD, m); - return g; -} - -void print_Generic(Generic* g){ - fprintf(stderr, "%s :: ", type_str(g->type)); - for(W* w = ws_head(g->list); w; w = w->next){ - Manifold* m = g_manifold(w); - fprintf(stderr, "m%lu(%s)", m->uid, m->function); - if(w->next) - fprintf(stderr, " | "); - } - fprintf(stderr, "\n"); -} diff --git a/frontend/type_Generic.h b/frontend/type_Generic.h deleted file mode 100644 index a6dcd150..00000000 --- a/frontend/type_Generic.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __TYPE_GENERIC_H__ -#define __TYPE_GENERIC_H__ - -#include "ws_access.h" -#include "type_util.h" - -typedef struct Generic{ - W* type; - Ws* list; -} Generic; - -Generic* append_Generic(Generic* g, W* type, Manifold* m); -void print_Generic(Generic* g); - -#endif diff --git a/frontend/type_GenericList.c b/frontend/type_GenericList.c deleted file mode 100644 index b2168903..00000000 --- a/frontend/type_GenericList.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "type_GenericList.h" - -void print_GenericList(GenericList* gl){ - fprintf(stderr, "Generic List\n"); - for(size_t i = 0; i < gl->size; i++){ - if(gl->list[i]){ - fprintf(stderr, " - %s\n", w_str(ws_head(gl->list[i]))); - } - } -} - -void _r_load_generics(GenericList* gl, W* w, Manifold* m, int gmod){ - switch(w->cls){ - case FT_FUNCTION: - case FT_TUPLE: - case FT_ARRAY: - { - for(W* wt = wws_head(w); wt != NULL; wt = wt->next){ - _r_load_generics(gl, wt, m, gmod); - } - break; - } - case FT_GENERIC: - { - // - The lhs holds the generic label (e.g. 'a') - // - The rhs of a generic holds the inferred type it will be of type - size_t gid = gmod + g_string(g_lhs(w))[0]; - if(gl->size <= gid){ - fprintf(stderr, "Invalid id at %s:%d\n", __func__, __LINE__); - } - /* gl->list[gid] = append_Generic(gl->list[gid], w, m); */ - gl->list[gid] = ws_add(gl->list[gid], w); - break; - } - case FT_ATOMIC: - case C_POSITIONAL: - // Always explicit types - break; - default: - warn("Expected FT_* at (%s:%d), got %s", __func__, __LINE__, w_str(w)); - break; - } -} - -GenericList* create_GenericList(ManifoldList* ml){ - GenericList* gl = (GenericList*)malloc(sizeof(GenericList)); - gl->size = get_generic_size(get_max_uid(ml)+1); - gl->list = (Ws**)calloc(gl->size, sizeof(Ws*)); - for(size_t i = 0; i < ml->size; i++){ - Manifold* m = ml->list[i]; - for(W* type = ws_head(m->type); type; type = type->next){ - _r_load_generics(gl, type, m, get_generic_id_offset(m->uid)); - } - } - return gl; -} - -Generic* access_GenericList(int gid){ return NULL; } diff --git a/frontend/type_GenericList.h b/frontend/type_GenericList.h deleted file mode 100644 index 28bcb538..00000000 --- a/frontend/type_GenericList.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __TYPE_GENERICLIST_H__ -#define __TYPE_GENERICLIST_H__ - -#include "type_Generic.h" -#include "type_ManifoldList.h" - -typedef struct GenericList{ - size_t size; - Ws ** list; -} GenericList; - -GenericList* create_GenericList(ManifoldList* ml); - -void print_GenericList(GenericList* gl); - -#endif diff --git a/frontend/type_HomoSet.c b/frontend/type_HomoSet.c deleted file mode 100644 index e4cdd099..00000000 --- a/frontend/type_HomoSet.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "type_HomoSet.h" - -HomoSet* append_HomoSet(HomoSet* hs, W* type, Manifold* m){ - HomoSet* x = (HomoSet*)malloc(sizeof(HomoSet)); - x->type = type; - x->mid = m ? m->uid : -1; - x->next = NULL; - x->prev = hs; - if(hs) - hs->next = x; - return x; -} - -void print_HomoSet(HomoSet* hs){ - while(hs->prev){ hs = hs->prev; } - for(; hs; hs = hs->next){ - fprintf(stderr, "%s", type_str(hs->type)); - if(hs->next) - fprintf(stderr, " | "); - } - fprintf(stderr, "\n"); -} diff --git a/frontend/type_HomoSet.h b/frontend/type_HomoSet.h deleted file mode 100644 index a1386e07..00000000 --- a/frontend/type_HomoSet.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __TYPE_HOMOSET_H__ -#define __TYPE_HOMOSET_H__ - -#include "ws_access.h" -#include "type_util.h" - - -// LL of elements with equivalent type -// Reasons for joining -// 1. The elements are IO linked -// 2. The elements are stars at the same position within the same function, -// though different manifolds -typedef struct HomoSet{ - // Types a and b must be unified, of form FT_* - W* type; - // manifold ID - int mid; - struct HomoSet* next; - struct HomoSet* prev; -} HomoSet; - -HomoSet* append_HomoSet(HomoSet* hs, W* type, Manifold* m); -void print_HomoSet(HomoSet* hs); - -#endif diff --git a/frontend/type_HomoSetList.c b/frontend/type_HomoSetList.c deleted file mode 100644 index bb56d7b4..00000000 --- a/frontend/type_HomoSetList.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "type_HomoSetList.h" - -/* HomoSetList{ */ -/* HomoSet* set; */ -/* struct HomoSetList* next; */ -/* struct HomoSetList* prev; */ -/* } */ -HomoSetList* append_HomoSetList(HomoSetList* hsl, HomoSet* hs){ - HomoSetList* x = (HomoSetList*)malloc(sizeof(HomoSetList)); - x->set = hs; - x->next = NULL; - x->prev = hsl; - if(hsl) - hsl->next = x; - return x; -} - -HomoSetList* create_HomoSetList(ManifoldList* ml){ - HomoSetList* hsl = NULL; - for(size_t i = 0; i < ml->size; i++){ - Manifold* m = ml->list[i]; - W* x = ws_head(m->inputs); - W* b = ws_head(m->type); - for(; x && b; x = x->next, b = b->next){ - W* a = x; - Manifold* man_input = NULL; - if(x->cls == C_MANIFOLD){ - man_input = g_manifold(g_rhs(x)); - a = ws_last(man_input->type); - } - // Add the input type - HomoSet* hs = append_HomoSet(NULL, a, man_input); - // Add the explicitly given type - hs = append_HomoSet(hs, b, m); - // Add this set to the set list - hsl = append_HomoSetList(hsl, hs); - } - } - return hsl; -} - -void print_HomoSetList(HomoSetList* hsl){ - while(hsl->prev){ hsl = hsl->prev; } - fprintf(stderr, "Homogenous Sets\n"); - for(; hsl; hsl = hsl->next){ - fprintf(stderr, " - "); - print_HomoSet(hsl->set); - } -} diff --git a/frontend/type_HomoSetList.h b/frontend/type_HomoSetList.h deleted file mode 100644 index 728b33e8..00000000 --- a/frontend/type_HomoSetList.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __TYPE_HOMOSETLIST_H__ -#define __TYPE_HOMOSETLIST_H__ - -#include "type_HomoSet.h" -#include "type_ManifoldList.h" - - -typedef struct HomoSetList{ - HomoSet* set; - struct HomoSetList* next; - struct HomoSetList* prev; -} HomoSetList; - -HomoSetList* append_HomoSetList(HomoSetList* hsl, HomoSet* hs); -HomoSetList* create_HomoSetList(ManifoldList*); - -void print_HomoSetList(HomoSetList* hsl); - -#endif diff --git a/frontend/type_ManifoldList.c b/frontend/type_ManifoldList.c deleted file mode 100644 index 8fc73238..00000000 --- a/frontend/type_ManifoldList.c +++ /dev/null @@ -1,48 +0,0 @@ -#include "type_ManifoldList.h" - -W* r_wws_add(W* m, W* ms){ - // This is an add function that does not copy the value It is important to - // use reference semantics here, so that the changes I make in the type - // inferrence data structure are reflected in the original. - return wws_add_val(ms, P_MANIFOLD, g_manifold(g_rhs(m))); -} -ManifoldList* create_ManifoldList(Ws* ws_top){ - W* ms = ws_scrap( - ws_top, - NULL, - ws_recurse_most, - w_is_manifold, - r_wws_add - ); - - ManifoldList* ml = (ManifoldList*)malloc(1 * sizeof(ManifoldList)); - ml->size = wws_length(ms); - ml->list = (Manifold**)calloc(ml->size, sizeof(Manifold*)); - for(W* w = wws_head(ms); w; w = w->next){ - Manifold* m = g_manifold(w); - if(m->uid < ml->size){ - ml->list[m->uid] = m; - } else { - fprintf(stderr, "Aww, shucks, that shouldn't have happened"); - } - } - - return ml; -} - -void print_ManifoldList(ManifoldList* ml){ - fprintf(stderr, "Manifold List\n"); - for(size_t i = 0; i < ml->size; i++){ - fprintf(stderr, " - "); - manifold_print(ml->list[i]); - } -} - -size_t get_max_uid(ManifoldList* ml){ - size_t id = 0; - for(size_t i = 0; i < ml->size; i++){ - size_t this_id = ml->list[i]->uid; - id = this_id > id ? this_id : id; - } - return id; -} diff --git a/frontend/type_ManifoldList.h b/frontend/type_ManifoldList.h deleted file mode 100644 index 336ba805..00000000 --- a/frontend/type_ManifoldList.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __TYPE_MANIFOLDLIST_H__ -#define __TYPE_MANIFOLDLIST_H__ - -#include "ws_access.h" - -typedef struct ManifoldList{ - size_t size; - Manifold ** list; -} ManifoldList; - -ManifoldList* create_ManifoldList(Ws* ws_top); - -void print_ManifoldList(ManifoldList*); - -size_t get_max_uid(ManifoldList* ml); - -#endif diff --git a/frontend/type_macros.h b/frontend/type_macros.h deleted file mode 100644 index e13aeb04..00000000 --- a/frontend/type_macros.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __TYPE_MACROS_H__ -#define __TYPE_MACROS_H__ - -#define __IO__ "Void" -#define __MULTI__ "?" -#define __WILD__ "*" - -#define MAX_TYPE_LENGTH 1024 - -#endif diff --git a/frontend/type_util.c b/frontend/type_util.c deleted file mode 100644 index bf1b917a..00000000 --- a/frontend/type_util.c +++ /dev/null @@ -1,146 +0,0 @@ -#include "type_util.h" - -bool cmp_type(char* a, char* b){ - return - ( strcmp(a, b ) == 0 ) || - ( strcmp(a, __WILD__) == 0 ) || - ( strcmp(b, __WILD__) == 0 ); -} - -bool type_is_io(W* w){ - return - w->cls == FT_ATOMIC && - strcmp(g_string(w), __IO__) == 0; -} - -bool type_is_well(Ws* type){ - return type_is_io(type->head) && !type_is_io(type->last); -} - -bool type_is_pipe(Ws* type){ - return !type_is_io(type->head) && !type_is_io(type->last); -} - -bool type_is_sink(Ws* type){ - return !type_is_io(type->head) && type_is_io(type->last); -} - -size_t get_generic_id_from_uid(size_t uid, char c){ - return uid * ('z'-'a'+1) + (c - 'a'); -} - -size_t get_generic_size(int max_uid){ - return max_uid * ('z'-'a'+1); -} - -size_t get_generic_id(W* w, char c){ - Manifold* m = g_manifold(g_rhs(w)); - return get_generic_id_from_uid(m->uid, c); -} - -size_t get_generic_id_offset(size_t uid){ - return get_generic_id_from_uid(uid, 0); -} - -int type_str_r(W* w, char* s, int p){ -#define CHK(x) \ -if((p + x) >= MAX_TYPE_LENGTH) { \ - warn("Type buffer exceeded, truncating type string\n"); \ - return p; \ -} - - switch(w->cls){ - case FT_FUNCTION: - { - int i = 0; - CHK(1) - s[p++] = '('; - for(W* wt = wws_head(w); wt != NULL; wt = wt->next){ - if(i > 0){ - CHK(2) - s[p++] = '-'; - s[p++] = '>'; - } - p = type_str_r(wt, s, p); - i++; - } - CHK(1) - s[p++] = ')'; - } - break; - case FT_TUPLE: - { - int i = 0; - s[p++] = '('; - for(W* wt = wws_head(w); wt != NULL; wt = wt->next){ - if(i > 0){ - CHK(1) - s[p++] = ','; - } - p = type_str_r(wt, s, p); - i++; - } - s[p++] = ')'; - } - break; - case FT_ARRAY: - { - CHK(1) - s[p++] = '['; - p = type_str_r(wws_head(w), s, p); - CHK(1) - s[p++] = ']'; - } - break; - case FT_GENERIC: - // - The lhs holds the generic label (e.g. 'a') - // - The rhs of a generic holds the inferred type it will be of type - // FT_*, so can be thrown into the next cycle - p = type_str_r(g_rhs(w), s, p); - break; - case FT_ATOMIC: - { - char* atom = g_string(w); - size_t atom_size = strlen(atom); - CHK(atom_size) - strcpy(s + p, atom); - p += atom_size; - break; - } - case C_POSITIONAL: - { - char* atom = g_string(g_lhs(w)); - size_t atom_size = strlen(atom); - CHK(atom_size) - strcpy(s + p, atom); - p += atom_size; - break; - } - case C_ARGREF: - { - CHK(1) - s[p++] = '*'; - break; - } - case C_REFER: - { - w = ws_last(g_manifold(g_rhs(w))->type); - p = type_str_r(w, s, p); - break; - } - default: - warn("Expected FT_* at (%s:%d), got %s", __func__, __LINE__, w_str(w)); - break; - } - return p; -#undef CHK -} - -char* type_str(W* w){ - char* s = (char*)malloc(MAX_TYPE_LENGTH * sizeof(char)); - int p = type_str_r(w, s, 0); - s[p] = '\0'; - char* ss = strdup(s); - free(s); - return ss; -} diff --git a/frontend/type_util.h b/frontend/type_util.h deleted file mode 100644 index 12b97c51..00000000 --- a/frontend/type_util.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __TYPE_UTIL_H__ -#define __TYPE_UTIL_H__ - -#include "ws_access.h" -#include "type_macros.h" - - -bool cmp_type(char* a, char* b); - -char* type_str(W* w); - -bool type_is_io(W* w); -bool type_is_well(Ws* type); -bool type_is_pipe(Ws* type); -bool type_is_sink(Ws* type); -bool type_is_effectful(Ws* type); - -size_t get_generic_id_from_uid(size_t uid, char c); -size_t get_generic_size(int max_uid); -size_t get_generic_id(W* w, char c); -size_t get_generic_id_offset(size_t uid); - -#endif diff --git a/frontend/w.c b/frontend/w.c deleted file mode 100644 index 063fbb26..00000000 --- a/frontend/w.c +++ /dev/null @@ -1,401 +0,0 @@ -#include "w.h" - -VType get_value_type(Class cls){ - VType vtype; - switch(cls){ - case C_COMPOSON: - case C_NEST: - case C_DEREF: - case K_LIST: - case K_PATH: - case P_WS: - case FT_FUNCTION: - case FT_TUPLE: - case FT_ARRAY: - vtype = V_WS; - break; - case C_GRPREF: - case C_ARGREF: - case P_STRING: - case K_NAME: - case FT_ATOMIC: - vtype = V_STRING; - break; - case T_PATH: - case T_H0: - case T_H1: - case T_H2: - case T_H3: - case T_H4: - case T_H5: - case T_H6: - case T_H7: - case T_H8: - case T_H9: - case C_POSITIONAL: // Couplet - case T_ASSERT: - case T_FAIL: - case T_ALIAS: - case T_LANG: - case T_DOC: - case T_CACHE: - case C_MANIFOLD: - case T_SECTION: - case C_REFER: - case P_COUPLET: - case T_SOURCE: - case T_ARGUMENT: - case P_ARGUMENT: - case T_TYPE: - case T_ONTOLOGY: - case T_EXPORT: - case FT_GENERIC: // Couplet> - vtype = V_COUPLET; - break; - case K_LABEL: - vtype = V_LABEL; - break; - case P_MANIFOLD: - vtype = V_MANIFOLD; - break; - case P_SECTION: - vtype = V_SECTION; - break; - case X_NONE: - vtype = V_NONE; - break; - default: - warn("illegal case %d (%s:%d)\n", cls, __func__, __LINE__); - } - return vtype; -} - -int _new_uid(){ - static int uid = 0; - return uid++; -} - -W* w_new(Class cls, void* value){ - W* w = (W*)calloc(1, sizeof(W)); - w->cls = cls; - w->uid = _new_uid(); - w->next = NULL; - - switch(get_value_type(cls)){ - case V_NONE: - w->value.none = NULL; - break; - case V_STRING: - w->value.string = value; - break; - case V_WS: - w->value.ws = value; - break; - case V_COUPLET: - w->value.couplet = value; - break; - case V_LABEL: - w->value.label = value; - break; - case V_MANIFOLD: - w->value.manifold = value; - break; - case V_SECTION: - w->value.section = value; - break; - default: - warn("illegal case (%s:%d)\n", __func__, __LINE__); - } - - return w; -} - -W* w_isolate(W* w){ - if(!w) return NULL; - W* new_w = w_copy(w); - new_w->next = NULL; - return new_w; -} - -W* w_copy(W* w){ - if(!w) return NULL; - W* new_w = (W*)malloc(sizeof(W)); - memcpy(new_w, w, sizeof(W)); - return new_w; -} - -W* w_clone(W* w){ - if(!w) return NULL; - W* clone = w_isolate(w); - clone->uid = _new_uid(); - clone->next = w_clone(w->next); - return clone; -} - -char* w_type_str(VType type){ - char* s = NULL; - switch(type){ - case V_NONE: s = strdup("V_NONE"); break; - case V_STRING: s = strdup("V_STRING"); break; - case V_WS: s = strdup("V_WS"); break; - case V_COUPLET: s = strdup("V_COUPLET"); break; - case V_LABEL: s = strdup("V_LABEL"); break; - case V_MANIFOLD: s = strdup("V_MANIFOLD"); break; - case V_SECTION: s = strdup("V_SECTION"); break; - default: - warn("illegal case (%s:%d)\n", __func__, __LINE__); - } - return s; -} - -char* w_class_str(Class cls){ - char* s = NULL; - switch(cls){ - case C_ARGREF: s = strdup("C_ARGREF") ; break; - case C_COMPOSON: s = strdup("C_COMPOSON") ; break; - case C_DEREF: s = strdup("C_DEREF") ; break; - case C_GRPREF: s = strdup("C_GRPREF") ; break; - case C_MANIFOLD: s = strdup("C_MANIFOLD") ; break; - case C_NEST: s = strdup("C_NEST") ; break; - case C_POSITIONAL: s = strdup("C_POSITIONAL") ; break; - case C_REFER: s = strdup("C_REFER") ; break; - case K_LABEL: s = strdup("K_LABEL") ; break; - case K_LIST: s = strdup("K_LIST") ; break; - case K_NAME: s = strdup("K_NAME") ; break; - case K_PATH: s = strdup("K_PATH") ; break; - case P_ARGUMENT: s = strdup("P_ARGUMENT") ; break; - case P_COUPLET: s = strdup("P_COUPLET") ; break; - case P_MANIFOLD: s = strdup("P_MANIFOLD") ; break; - case P_SECTION: s = strdup("P_SECTION") ; break; - case P_STRING: s = strdup("P_STRING") ; break; - case FT_FUNCTION: s = strdup("FT_FUNCTION") ; break; - case FT_TUPLE: s = strdup("FT_TUPLE") ; break; - case FT_ARRAY: s = strdup("FT_ARRAY") ; break; - case FT_ATOMIC: s = strdup("FT_ATOMIC") ; break; - case FT_GENERIC: s = strdup("FT_GENERIC") ; break; - case P_WS: s = strdup("P_WS") ; break; - case T_ARGUMENT: s = strdup("T_ARGUMENT") ; break; - case T_ALIAS: s = strdup("T_ALIAS") ; break; - case T_CACHE: s = strdup("T_CACHE") ; break; - case T_ASSERT: s = strdup("T_ASSERT") ; break; - case T_DOC: s = strdup("T_DOC") ; break; - case T_EXPORT: s = strdup("T_EXPORT") ; break; - case T_FAIL: s = strdup("T_FAIL") ; break; - case T_H0: s = strdup("T_H0") ; break; - case T_H1: s = strdup("T_H1") ; break; - case T_H2: s = strdup("T_H2") ; break; - case T_H3: s = strdup("T_H3") ; break; - case T_H4: s = strdup("T_H4") ; break; - case T_H5: s = strdup("T_H5") ; break; - case T_H6: s = strdup("T_H6") ; break; - case T_H7: s = strdup("T_H7") ; break; - case T_H8: s = strdup("T_H8") ; break; - case T_H9: s = strdup("T_H9") ; break; - case T_LANG: s = strdup("T_LANG") ; break; - case T_ONTOLOGY: s = strdup("T_ONTOLOGY") ; break; - case T_PATH: s = strdup("T_PATH") ; break; - case T_SECTION: s = strdup("T_SECTION") ; break; - case T_SOURCE: s = strdup("T_SOURCE") ; break; - case T_TYPE: s = strdup("T_TYPE") ; break; - case X_NONE: s = strdup("X_NONE") ; break; - default: - warn("illegal case (%s:%d)\n", __func__, __LINE__); - } - return s; -} - -#define SEGFAULT fflush(stderr);W* x=0;x->next=0; -void w_assert_class(W* w, Class cls){ - if(!w){ - warn( - "Class assertion failed! Got NULL, expected %s.\n", - w_class_str(cls) - ); - SEGFAULT - } else if(w->cls != cls){ - warn( - "Class assertion failed! Got %s, expected %s.\n", - w_class_str(w->cls), - w_class_str(cls) - ); - SEGFAULT - } -} - -void w_assert_type(W* w, VType type){ - if(!w){ - warn( - "Type assertion failed! Got NULL, expected %s.\n", - w_type_str(type) - ); - SEGFAULT - } else { - VType t = get_value_type(w->cls); - if(t != type){ - warn( - "W type error! Got %s, expected %s.\n", - w_type_str(t), - w_type_str(type) - ); - if(get_value_type(w->cls) == V_COUPLET){ - warn("%s\n", w->value.couplet->lhs->value.label->name); - } - SEGFAULT - } - } -} -#undef SEGFAULT - -bool _is_valid_lhs(W* w){ - bool is_valid; - switch(w->cls){ - case K_LIST: - case K_PATH: - case K_LABEL: - case K_NAME: - is_valid = true; - break; - default: - is_valid = false; - break; - } - return is_valid; -} - -char* g_string(W* w) { - if(!w) return NULL; - w_assert_type(w, V_STRING); - return w->value.string; -} -struct Ws* g_ws(W* w) { - if(!w) return NULL; - w_assert_type(w, V_WS); - return w->value.ws; -} -struct Couplet* g_couplet(W* w) { - if(!w) return NULL; - w_assert_type(w, V_COUPLET); - return w->value.couplet; -} -struct Label* g_label(W* w) { - if(!w) return NULL; - w_assert_type(w, V_LABEL); - return w->value.label; -} -struct Manifold* g_manifold(W* w) { - if(!w) return NULL; - w_assert_type(w, V_MANIFOLD); - return w->value.manifold; -} -struct Section* g_section(W* w) { - if(!w) return NULL; - w_assert_type(w, V_SECTION); - return w->value.section; -} -W* g_lhs(W* w) { - if(!w || !w->value.couplet) return NULL; - w_assert_type(w, V_COUPLET); - return w->value.couplet->lhs; -} -W* g_rhs(W* w) { - if(!w || !w->value.couplet) return NULL; - w_assert_type(w, V_COUPLET); - return w->value.couplet->rhs; -} - -void s_none(W* w){ - if(!w) { warn("Cannot set null in s_none\n"); return;} - w_assert_type(w, V_NONE); - w->value.string = NULL; -} -void s_string(W* w, char* v){ - if(!w) { warn("Cannot set null in s_string\n"); return;} - w_assert_type(w, V_STRING); - w->value.string = v; -} -void s_ws(W* w, struct Ws* v){ - if(!w) { warn("Cannot set null in s_ws\n"); return;} - w_assert_type(w, V_WS); - w->value.ws = v; -} -void s_couplet(W* w, Couplet* v){ - if(!w) { warn("Cannot set null in s_couplet\n"); return;} - w_assert_type(w, V_COUPLET); - w->value.couplet = v; -} -void s_label(W* w, Label* v){ - if(!w) { warn("Cannot set null in s_label\n"); return;} - w_assert_type(w, V_LABEL); - w->value.label = v; -} -void s_manifold(W* w, Manifold* v){ - if(!w) { warn("Cannot set null in s_manifold\n"); return;} - w_assert_type(w, V_MANIFOLD); - w->value.manifold = v; -} -void s_section(W* w, Section* v){ - if(!w) { warn("Cannot set null in s_section\n"); return;} - w_assert_type(w, V_SECTION); - w->value.section = v; -} -void s_lhs(W* w, W* v){ - if(!w) { warn("Cannot set null in s_lhs\n"); return;} - w_assert_type(w, V_COUPLET); - w->value.couplet->lhs = v; -} -void s_rhs(W* w, W* v){ - if(!w) { warn("Cannot set null in s_rhs\n"); return;} - w_assert_type(w, V_COUPLET); - w->value.couplet->rhs = v; -} - -void force_set_none(W* w){ - if(!w) { warn("Cannot set null in s_none\n"); return;} - w->cls = X_NONE; - s_none(w); -} -void force_set_string(W* w, Class c, char* v){ - if(!w) { warn("Cannot set null in s_string\n"); return; } - if(get_value_type(c) == V_STRING){ - w->cls = c; - s_string(w, v); - } else { - warn("Invalid type in %s:%d\n", __func__, __LINE__); - } -} -void force_set_ws(W* w, Class c, struct Ws* v){ - if(!w) { warn("Cannot set null in s_ws\n"); return;} - if(get_value_type(c) == V_WS){ - w->cls = c; - s_ws(w, v); - } else { - warn("Invalid type in %s:%d\n", __func__, __LINE__); - } -} -void force_set_couplet(W* w, Class c, Couplet* v){ - if(!w) { warn("Cannot set null in s_couplet\n"); return;} - if(get_value_type(c) == V_COUPLET){ - w->cls = c; - s_couplet(w, v); - } else { - warn("Invalid type in %s:%d\n", __func__, __LINE__); - } -} -void force_set_label(W* w, Class c, Label* v){ - if(!w) { warn("Cannot set null in s_label\n"); return;} - if(get_value_type(c) == V_LABEL){ - w->cls = c; - s_label(w, v); - } else { - warn("Invalid type in %s:%d\n", __func__, __LINE__); - } -} -void force_set_manifold(W* w, Class c, Manifold* v){ - if(!w) { warn("Cannot set null in s_manifold\n"); return;} - if(get_value_type(c) == V_MANIFOLD){ - w->cls = c; - s_manifold(w, v); - } else { - warn("Invalid type in %s:%d\n", __func__, __LINE__); - } -} diff --git a/frontend/w.h b/frontend/w.h deleted file mode 100644 index 03f04496..00000000 --- a/frontend/w.h +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef __W_H__ -#define __W_H__ - -#include -#include -#include -#include - -#include "label.h" -#include "manifold.h" -#include "couplet.h" -#include "section.h" - -typedef enum { - X_NONE=0, - C_ARGREF, - C_COMPOSON, // C for composition - C_DEREF, - C_GRPREF, - C_MANIFOLD, - C_NEST, - C_POSITIONAL, - C_REFER, - K_LABEL, - K_LIST, // K for key - K_NAME, - K_PATH, - P_ARGUMENT, - P_COUPLET, - P_MANIFOLD, - P_SECTION, - P_STRING, // P for primitive - FT_FUNCTION, - FT_ATOMIC, - FT_GENERIC, - FT_ARRAY, - FT_TUPLE, - P_WS, - T_ALIAS, - T_ARGUMENT, - T_CACHE, - T_ASSERT, // T for top level - T_DOC, - T_EXPORT, - T_FAIL, - T_H0, - T_H1, - T_H2, - T_H3, - T_H4, - T_H5, - T_H6, - T_H7, - T_H8, - T_H9, - T_LANG, - T_ONTOLOGY, - T_PATH, - T_SECTION, - T_SOURCE, - T_TYPE -} Class; - -typedef enum { - V_NONE = 0, - V_STRING, - V_WS, - V_COUPLET, - V_LABEL, - V_MANIFOLD, - V_SECTION -} VType; - -typedef struct W{ - Class cls; - int uid; - struct W* next; - union { - void* none; - char* string; - struct Ws* ws; - struct Couplet* couplet; - struct Label* label; - struct Manifold* manifold; - struct Section* section; - } value; -} W; - -W* w_new(Class cls, void* value); - -W* w_isolate(W* w); - -W* w_copy(W* w); - -// clone a W while preserving class and value -// this is recursive, next is cloned as well -W* w_clone(W* w); - -W* w_print(W* w); - -VType get_value_type(Class cls); - -char* w_class_str(Class); - -char* w_type_str(VType); - -void w_assert_class(W*, Class); - -void w_assert_type(W*, VType); - -// Get the vaue of w - char* g_string (W* w); -struct Ws* g_ws (W* w); -struct Couplet* g_couplet (W* w); -struct Label* g_label (W* w); -struct Manifold* g_manifold (W* w); -struct Section* g_section (W* w); - W* g_lhs (W* w); - W* g_rhs (W* w); - -// Set the value of w, fails if v is not compatible with type(w) -void s_none (W* w ); -void s_string (W* w, char* v ); -void s_ws (W* w, struct Ws* v); -void s_couplet (W* w, Couplet* v); -void s_label (W* w, Label* v); -void s_manifold (W* w, Manifold* v); -void s_section (W* w, Section* v); -void s_lhs (W* w, W* v); -void s_rhs (W* w, W* v); - -// Set the value of W and change the class -// The current class of w is ignored -// These do check to ensure Class c is fits type of v -void force_set_none ( W* w ); -void force_set_string ( W* w, Class c, char* v ); -void force_set_ws ( W* w, Class c, struct Ws* v ); -void force_set_couplet ( W* w, Class c, Couplet* v ); -void force_set_label ( W* w, Class c, Label* v ); -void force_set_manifold ( W* w, Class c, Manifold* v ); - -#endif diff --git a/frontend/ws.c b/frontend/ws.c deleted file mode 100644 index b467241b..00000000 --- a/frontend/ws.c +++ /dev/null @@ -1,343 +0,0 @@ -#include "ws.h" - -// ------ local functions ------------------------------------------- -void _join(Ws* a, Ws* b); -Ws* _ws_new(W* w); -void _retail(Ws* ws, W* w); -Ws* _ws_add(Ws* ws, W* w); -void _ws_print_r(Ws* ws, Ws*(*recurse)(W*), int depth); -// ------------------------------------------------------------------ - - -Ws* ws_new(W* w){ - Ws* ws = (Ws*)calloc(1, sizeof(Ws)); - W* w2 = w_isolate(w); - ws->head = w2; - ws->last = w2; - return ws; -} - - -void w_clone_value(W* w){ - if(!w) return; - switch(get_value_type(w->cls)){ - case V_NONE: - s_none(w); - break; - case V_STRING: - s_string(w, strdup(g_string(w))); - break; - case V_WS: - s_ws(w, ws_clone(g_ws(w))); - break; - case V_COUPLET: - { - Couplet* c = couplet_new(w_clone(g_lhs(w)), w_clone(g_rhs(w)), g_couplet(w)->op); - w_clone_value(c->lhs); - w_clone_value(c->rhs); - s_couplet(w, c); - } - break; - case V_LABEL: - s_label(w, label_copy(g_label(w))); - break; - case V_MANIFOLD: - { - Manifold* m = manifold_clone(g_manifold(w)); - m->function = m->function ? strdup(m->function) : NULL; - - m->h0 = ws_clone( m->h0 ); - m->h1 = ws_clone( m->h1 ); - m->h2 = ws_clone( m->h2 ); - m->h3 = ws_clone( m->h3 ); - m->h4 = ws_clone( m->h4 ); - m->h5 = ws_clone( m->h5 ); - m->h6 = ws_clone( m->h6 ); - m->h7 = ws_clone( m->h7 ); - m->h8 = ws_clone( m->h8 ); - m->h9 = ws_clone( m->h9 ); - - m->cache = ws_clone( m->cache ); - m->assert = ws_clone( m->assert ); - m->fail = ws_clone( m->fail ); - m->doc = ws_clone( m->doc ); - m->inputs = ws_clone( m->inputs ); - s_manifold(w, m); - } - break; - case V_SECTION: - s_section(w, section_copy(g_section(w))); - break; - } -} -Ws* ws_clone(Ws* ws){ - Ws* clone = NULL; - if(!ws) return NULL; - for(W* w = w_clone(ws->head); w; w = w->next){ - w_clone_value(w); - clone = ws_add(clone, w); - } - return clone; -} - -Ws* ws_copy(Ws* ws){ - Ws* copy = NULL; - if(!ws) return copy; - for(W* w = ws->head; w; w = w->next){ - copy = ws_add(copy, w_isolate(w)); - } - return copy; -} - -Ws* ws_add(Ws* ws, W* w){ - W* w2 = w_isolate(w); - if(!ws){ - ws = _ws_new(w2); - } else { - if(ws->last){ - _retail(ws, w2); - } else { - warn("WARNING: cannot add to tailless table\n"); - } - } - return ws; -} - -Ws* ws_add_val(Ws* ws, Class cls, void* v){ - W* w = w_new(cls, v); - ws = _ws_add(ws, w); - return ws; -} - -Ws* ws_join(Ws* a, Ws* b){ - if(b && b->head){ - if(a && a->head){ - _join(a, ws_copy(b)); - } else { - a = ws_copy(b); - } - } - return a; -} - -Ws* ws_tail(Ws* ws){ - if(ws_length(ws) < 2) return NULL; - Ws* n = _ws_new(ws->head->next); - n->last = ws->last; - return n; -} - -Ws* ws_init(Ws* ws){ - if(ws_length(ws) < 2) return NULL; - Ws* n = _ws_new(w_clone(ws->head)); - for(W* last = n->head; last->next; last = last->next){ - n->last = last; - } - n->last->next = NULL; - return n; -} - -W* ws_head(Ws* ws){ - if(ws){ - return ws->head; - } else { - return NULL; - } -} - -/* Get last element of a table */ -W* ws_last(Ws* ws){ - if(ws){ - return ws->last; - } else { - return NULL; - } -} - -int ws_length(Ws* ws){ - if(!ws || !ws->head) return 0; - int size = 0; - for(W* w = ws->head; w; w = w->next){ size++; } - return size; -} - -void ws_print(Ws* ws, Ws*(*recurse)(W*)){ - if(!ws){ - fprintf(stderr, "(empty list)\n"); - } else { - _ws_print_r(ws, recurse, 0); - } -} - -void manifold_print(Manifold* m){ - fprintf( - stderr, - "m%lu %s in %s\n", - m->uid, m->function, m->lang - ); -} - -char* w_str(W* w){ - if(!w) return NULL; - char* s = (char*)malloc(1024 * sizeof(char)); - char* c = w_class_str(w->cls); - switch(get_value_type(w->cls)){ - case V_NONE: - sprintf(s, "%s", c); - break; - case V_STRING: - sprintf(s, "%s(%s)", c, g_string(w)); - break; - case V_WS: - { - int n = 0; - for(W* a = g_ws(w)->head; a; a = a->next) { n++; } - sprintf(s, "%s", c, n); - } - break; - case V_COUPLET: - sprintf( - s, "%s :: %s | %s", c, - w_str(g_lhs(w)), - w_str(g_rhs(w)) - ); - break; - case V_LABEL: - sprintf( - s, "%s(name=%s:label=%s:lang=%s)", c, - g_label(w)->name, - g_label(w)->label, - g_label(w)->lang - ); - break; - case V_MANIFOLD: - sprintf(s, "%s", c); - break; - case V_SECTION: - { - Section* sec = g_section(w); - sprintf(s, "%s<%s, %s>", c, sec->name, sec->lang); - } - break; - default: - warn("illegal case (%s:%d)\n", __func__, __LINE__); - } - return s; -} - -// ====== PRIVATE FUNCTIONS ========================================== - -void _join(Ws* a, Ws* b){ - a->last->next = b->head; - a->last = b->last; -} - -/* no copy constructor, no reset */ -Ws* _ws_new(W* w){ - Ws* ws = (Ws*)calloc(1, sizeof(Ws)); - ws->head = w; - ws->last = w; - return ws; -} - -/* checkless attachment */ -void _retail(Ws* ws, W* w){ - ws->last->next = w; - ws->last = w; -} - -Ws* _ws_add(Ws* ws, W* w){ - if(!ws){ - ws = _ws_new(w); - } else { - if(ws->last){ - _retail(ws, w); - } else { - warn("WARNING: cannot add to tailless table\n"); - } - } - return ws; -} - -void _ws_print_r(Ws* ws, Ws*(*recurse)(W*), int depth){ - if(!ws || !ws->head) return; - for(W* w = ws->head; w; w = w->next){ - for(int i = 0; i < depth; i++){ fprintf(stderr, " "); } - fprintf(stderr, "%s\n", w_str(w)); - Ws* rs = recurse(w); - if(!rs) continue; - for(W* r = rs->head; r; r = r->next){ - _ws_print_r(g_ws(r), recurse, depth+1); - } - } -} - - -W* wws_new(W* w){ - return w_new(P_WS, ws_new(w)); -} -W* _wws_new(W* w){ - return w_new(P_WS, _ws_new(w)); -} -W* wws_new_cls(W* w, Class ws_cls){ - if(get_value_type(ws_cls) != V_WS){ - warn("Cannot create Ws with VTYPE != V_WS (%s:%d)", __func__, __LINE__); - return NULL; - } - return w_new(ws_cls, ws_new(w)); -} -W* wws_clone(W* wws){ - if(!wws) return NULL; - s_ws(wws, ws_clone(g_ws(wws))); - return wws; -} -W* wws_add(W* wws, W* w){ - if(!wws){ - wws = wws_new(w); - } else { - s_ws(wws, ws_add(g_ws(wws), w)); - } - return wws; -} -W* _wws_add(W* wws, W* w){ - if(!wws){ - wws = _wws_new(w); - } else { - s_ws(wws, _ws_add(g_ws(wws), w)); - } - return wws; -} -W* wws_add_val(W* wws, Class cls, void* v){ - Ws* ws = wws ? g_ws(wws): NULL; - ws = ws_add_val(ws, cls, v); - if(!wws){ - wws = w_new(P_WS, ws); - } else { - s_ws(wws, ws); - } - return wws; -} -W* wws_join(W* a, W* b){ - s_ws(a, ws_join(g_ws(a), g_ws(b))); - return a; -} -W* wws_tail(W* w){ - Class cls = w ? w->cls : P_WS; - return w_new(cls, ws_tail(g_ws(w))); -} -W* wws_init(W* w){ - Class cls = w ? w->cls : P_WS; - return w_new(cls, ws_init(g_ws(w))); -} -W* wws_head(W* w){ - return ws_head(g_ws(w)); -} -W* wws_last(W* w){ - return ws_last(g_ws(w)); -} -int wws_length(W* w){ - return ws_length(g_ws(w)); -} -void wws_print(W* w, Ws*(*recurse)(W*)){ - ws_print(g_ws(w), recurse); -} diff --git a/frontend/ws.h b/frontend/ws.h deleted file mode 100644 index 583407b4..00000000 --- a/frontend/ws.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef __WS_H__ -#define __WS_H__ - -#include -#include - -#include "w.h" - -typedef struct Ws{ - W* head; - W* last; -} Ws; - -/* Copies entry and removes its link */ -Ws* ws_new(W* w); - -/* Creates new W containers, but preserves content */ -Ws* ws_copy(Ws* ws); - -/* Clone ws calling clone on each element. Elements with uid fields will have - * unique uids, all pointers will be to new objects. Any changes to the clone, - * any of its elements or sub-elements, will not affect the original. - */ -Ws* ws_clone(Ws* ws); -// clone the value of a W, this will recurse into and Ws -void w_clone_value(W* w); - -/* If ws is NULL, this will create a new Ws. This basically renders ws_new - * unnecessary, although I keep it around for symmetry. Also, I do not allow - * empty Ws. Having this default constructor take an element argument will - * prevent me from coming in later ad breaking everything by added a empty - * default constructor. - */ -Ws* ws_add(Ws* ws, W* w); -// add without copy -Ws* _ws_add(Ws* ws, W* w); - -Ws* ws_add_val(Ws* ws, Class cls, void* v); - -/* copies b (see ws_copy) and links it to a */ -Ws* ws_join(Ws* a, Ws* b); - -/* Make table xs[2..k], drop first element */ -Ws* ws_tail(Ws* ws); -/* Make table xs[1..k-1], drop last element */ -Ws* ws_init(Ws* ws); -/* Get first element of a table */ -W* ws_head(Ws* ws); -/* Get last element of a table */ -W* ws_last(Ws* ws); - -int ws_length(Ws* ws); - -void ws_print(Ws* ws, Ws*(*recurse)(W*)); - -/* This function is in ws.h instead of manifold.h because it - * contains many Ws and W structures, but manifold.h does not - * import the respective headers */ -void manifold_print(Manifold* m); - -char* w_str(W* w); - - -// The following functions are wrappers for Ws that are wrapped in a W. They -// act on Ws in a W container. A Ws might be wrapped in a W when complete -// polymorphism is required. As in some of the higher-order functions. -W* wws_new(W*); -// Create new W->Ws but with Class other than P_WS -W* wws_new_cls(W*, Class ws_cls); -W* wws_clone(W*); -W* wws_add(W*, W*); -// add without copy -W* _wws_add(W*, W*); -W* wws_add_val(W*, Class cls, void* v); -W* wws_join(W*, W*); -W* wws_tail(W*); -W* wws_init(W*); -W* wws_head(W*); -W* wws_last(W*); -int wws_length(W*); -void wws_print(W*, Ws*(*recurse)(W*)); - - -#endif diff --git a/frontend/ws_access.c b/frontend/ws_access.c deleted file mode 100644 index e65aa95b..00000000 --- a/frontend/ws_access.c +++ /dev/null @@ -1,398 +0,0 @@ -#include "ws_access.h" - -Ws* ws_flatten( Ws* ws, Ws*(*recurse)(W*) ){ - return ws_rfilter(ws, recurse, w_keep_all); -} - -Ws* ws_filter(Ws* ws, bool(*criterion)(W*)){ - return ws_rfilter(ws, ws_recurse_none, criterion); -} - -// Find all {label,manifold} couplets -Ws* get_manifolds(Ws* ws){ - return ws_rfilter(ws, ws_recurse_most, w_is_manifold); -} - -Ws* get_refers(Ws* ws){ - return ws_rfilter(ws, ws_recurse_most, w_is_refer); -} - -Ws* get_tpaths(Ws* ws){ - return ws_rfilter(ws, ws_recurse_none, w_is_tpath); -} - -bool _manifold_match(W* w, W* p){ - return w_is_manifold(w) && w_equal_lhs(w, p); -} -Ws* get_by_name(Ws* ws, W* p){ - W* p_; - switch(p->cls){ - case K_LABEL: - case K_LIST: - case K_PATH: - case K_NAME: - p_ = w_new(P_COUPLET, couplet_new(p, NULL, '=')); - break; - default: - p_ = w_isolate(p); - break; - } - return ws_prfilter( - ws, - p_, - ws_recurse_path, - _manifold_match, - w_nextval_ifpath - ); -} - -bool w_is_lang ( W* w ){ return w ? w->cls == T_LANG : false; } -bool w_is_type ( W* w ){ return w ? w->cls == T_TYPE : false; } -bool w_is_grpref ( W* w ){ return w ? w->cls == C_GRPREF : false; } -bool w_is_argref ( W* w ){ return w ? w->cls == C_ARGREF : false; } -bool w_is_refer ( W* w ){ return w ? w->cls == C_REFER : false; } -bool w_is_deref ( W* w ){ return w ? w->cls == C_DEREF : false; } -bool w_is_tpath ( W* w ){ return w ? w->cls == T_PATH : false; } -bool w_is_label ( W* w ){ return w ? w->cls == K_LABEL : false; } -bool w_is_manifold ( W* w ){ return w ? w->cls == C_MANIFOLD : false; } -bool w_is_export ( W* w ){ return w ? w->cls == T_EXPORT : false; } -bool w_is_source ( W* w ){ return w ? w->cls == T_SOURCE : false; } -bool w_is_composon ( W* w ){ return w ? w->cls == C_COMPOSON : false; } - -bool w_is_ptype ( W* w ){ - switch(w->cls){ - case FT_FUNCTION: - case FT_ATOMIC: - case FT_GENERIC: - case FT_ARRAY: - case FT_TUPLE: - return true; - default: - return false; - } -} - -bool w_is_recursive(W* w){ return w ? get_value_type(w->cls) == V_WS : false; } - -bool w_is_named_composition(W* w){ - if(!w) return false; - switch(w->cls){ - case T_PATH: - case T_H0: - case T_H1: - case T_H2: - case T_H3: - case T_H4: - case T_H5: - case T_H6: - case T_H7: - case T_H8: - case T_H9: - case T_ASSERT: - case T_FAIL: - return true; - default: - return false; - } -} - -Ws* ws_split_couplet(W* c){ - if(!c || !g_couplet(c)) return NULL; - Ws* result = NULL; - W* paths = g_lhs(c); - switch(paths->cls){ - case K_LIST: - { - for(W* p = g_ws(paths)->head; p; p = p->next){ - W* nc = w_isolate(c); - // This section has caused some tricky bugs - // - // I do not want to change the input W 'c'. So I need to - // copy 'c'. I need to alter the left-hand side (the selection) - // in the copy, but not in the original, so I need to clone - // the left-hand side. - // - // Cloning creates new things, manifolds gain new uids, for - // instance. This function should NOT alter the right-hand - // sides. So I must not clone both sides, e.g. this is not - // OK: `w_clone_value(nc)` - - Couplet* cnew = couplet_new(p, g_rhs(c), g_couplet(c)->op); - - s_couplet(nc, cnew); - - result = ws_add(result, nc); - } - } - break; - case K_PATH: - case K_LABEL: - case K_NAME: - result = ws_add(result, c); - break; - default: - warn("ERROR: invalid lhs type in couplet (%s:%d)", __func__, __LINE__); - break; - } - return result; -} - -// === nextval functions ============================================ - -W* w_nextval_always(W* w, W* p){ return p->next; } - -W* w_nextval_never(W* w, W* p){ return p; } - -/* p a modifier (e.g. check). - * w a node into which we are recursing - * - * if w is a path, we need to pop the top level of p's lhs. - */ -W* w_nextval_ifpath(W* w, W* p) { - W* next = p; - if(w_is_named_composition(w) && ws_length(g_ws(g_lhs(p))) > 1){ - switch(g_lhs(p)->cls){ - case K_PATH: - { - // Gah, this is a real pain - // 1) I mustn't modify the original p - // 2) I mustn't clone the manifold (that changes the uid) - next = w_isolate(p); - s_couplet(next, couplet_copy(g_couplet(next))); - s_lhs(next, w_new(K_PATH, ws_tail(ws_clone(g_ws(g_lhs(next)))))); - s_rhs(next, w_copy(g_rhs(next))); - } - break; - case K_LIST: - next = NULL; - // Not supported - break; - default: - next = NULL; - break; - } - } - return next; -} - -// === filter criteria ============================================== -// ------------------------------------------------------------------ - -bool w_keep_all(W* w){ - return true; -} - -// === recursion rules ============================================== -// NOTE: recursion rules are splits -// ------------------------------------------------------------------ - -Ws* ws_recurse_most(W* w){ - if(!w) return NULL; - Ws* rs = NULL; - switch(get_value_type(w->cls)){ - case V_WS: - rs = ws_add_val(rs, P_WS, g_ws(w)); - break; - case V_COUPLET: - { - W* lhs = g_lhs(w); - if(w_is_recursive(lhs)){ - rs = ws_add_val(rs, P_WS, g_ws(lhs)); - } - W* rhs = g_rhs(w); - if(w_is_recursive(rhs)){ - rs = ws_add_val(rs, P_WS, g_ws(rhs)); - } - } - default: - break; - } - return rs; -} - -Ws* ws_recurse_ws(W* w){ - if(!w) return NULL; - Ws* rs = NULL; - switch(get_value_type(w->cls)){ - case V_WS: - rs = ws_add_val(rs, P_WS, g_ws(w)); - break; - default: - break; - } - return rs; -} - -Ws* ws_recurse_section(W* w){ - Ws* rs = NULL; - if(w->cls == T_SECTION){ - rs = ws_add_val(rs, P_WS, g_ws(g_rhs(w))); - } - return rs; -} - -Ws* ws_recurse_type(W* w){ - if(!w) return NULL; - Ws* rs = NULL; - switch(w->cls){ - case FT_FUNCTION: - case FT_TUPLE: - case FT_ARRAY: - rs = ws_add_val(rs, P_WS, g_ws(w)); - break; - default: - rs = NULL; - } - return rs; -} - -Ws* ws_recurse_none(W* w){ - return NULL; -} - -Ws* ws_recurse_composition(W* w){ - if(!w) return NULL; - Ws* rs = NULL; - switch(w->cls){ - case C_COMPOSON: - case C_NEST: - case C_DEREF: - rs = ws_add_val(rs, C_NEST, g_ws(w)); - break; - case T_SECTION: - rs = ws_add_val(rs, P_WS, g_ws(g_rhs(w))); - break; - case T_PATH: - case T_H0: - case T_H1: - case T_H2: - case T_H3: - case T_H4: - case T_H5: - case T_H6: - case T_H7: - case T_H8: - case T_H9: - case T_ASSERT: - case T_FAIL: - rs = ws_add_val(rs, C_NEST, g_ws(g_rhs(w))); - break; - default: - rs = NULL; - } - return rs; -} - -Label* _ws_get_label_from_lhs(W* a){ - if(!a) return NULL; - Label* label = NULL; - switch(a->cls){ - case K_NAME: - label = label_new_set(strdup(g_string(a)), NULL, NULL); - break; - case K_LABEL: - label = g_label(a); - break; - case K_PATH: - label = g_ws(a) ? g_label(g_ws(a)->head) : NULL; - break; - case K_LIST: - label = NULL; - // Recursion into K_LIST not supported - break; - default: - label = NULL; - warn("Illegal left hand side (%s:%d)", __func__, __LINE__); - break; - } - return label; -} - -bool w_equal_lhs(W* a, W* b){ - Label* a_label = _ws_get_label_from_lhs(g_lhs(a)); - Label* b_label = _ws_get_label_from_lhs(g_lhs(b)); - bool is_equal = label_cmp(a_label, b_label); - return is_equal; -} - -char* _ws_get_name(W* w){ - if(!w) return NULL; - char* name = NULL; - switch(get_value_type(w->cls)){ - case V_STRING: - name = g_string(w); - break; - case V_COUPLET: - name = _ws_get_name(g_lhs(w)); - break; - case V_LABEL: - name = g_label(w)->name; - break; - case V_MANIFOLD: - name = g_manifold(w)->function; - break; - case V_SECTION: - name = g_section(w)->name; - break; - case V_NONE: - name = NULL; - warn("Cannot get name from V_NONE (%s:%d)", __func__, __LINE__); - break; - case V_WS: - if(wws_length(w) == 1){ - name = _ws_get_name(wws_head(w)); - } else { - name = NULL; - warn( - "Cannot get name from V_WS of length > 1 (%s:%d)", - __func__, __LINE__ - ); - } - break; - } - return name; -} - -bool w_string_equal(W* a, W* b){ - char* a_str = _ws_get_name(a); - char* b_str = _ws_get_name(b); - bool is_equal = false; - if(a_str && b_str) - is_equal = strcmp(a_str, b_str) == 0; - return is_equal; -} - -Ws* ws_recurse_path(W* w, W* p){ - Ws* rs = NULL; - switch(w->cls){ - case C_NEST: - case C_DEREF: - case C_COMPOSON: - rs = g_ws(w); - break; - case T_SECTION: - rs = ws_new(w_new(P_WS, g_ws(g_rhs(w)))); - break; - case T_PATH: - case T_H0: - case T_H1: - case T_H2: - case T_H3: - case T_H4: - case T_H5: - case T_H6: - case T_H7: - case T_H8: - case T_H9: - case T_ASSERT: - case T_FAIL: - rs = - (wws_length(g_lhs(p)) == 1 || w_equal_lhs(p, w)) - ? g_ws(g_rhs(w)) - : NULL; - break; - default: - break; - } - return rs; -} diff --git a/frontend/ws_access.h b/frontend/ws_access.h deleted file mode 100644 index 6b363237..00000000 --- a/frontend/ws_access.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef __WS_ACCESS_H__ -#define __WS_ACCESS_H__ - -#include "hof.h" - -// Removing nesting in a list (as specified by the recursion rule). -// This is just a wrapper for ws_rfilter, with criterion := w_keep_all. -Ws* ws_flatten(Ws*, Ws*(*recurse)(W*)); - -Ws* get_manifolds(Ws* ws); -Ws* get_refers(Ws* ws); - -// Get top-level paths, (e.g. the 'A' in `A :: f . g`, which is a list -// containing f and g) -Ws* get_tpaths(Ws* ws); - -Ws* get_by_name(Ws* ws, W* p); - -bool w_is_lang ( W* ); -bool w_is_export ( W* ); -bool w_is_source ( W* ); -bool w_is_manifold ( W* ); -bool w_is_grpref ( W* ); -bool w_is_argref ( W* ); -bool w_is_refer ( W* ); -bool w_is_label ( W* ); -bool w_is_deref ( W* ); -bool w_is_tpath ( W* ); -bool w_is_composon ( W* ); -bool w_is_recursive ( W* ); -bool w_is_type ( W* ); -bool w_is_ptype ( W* ); - -bool w_equal_lhs ( W* a, W* b ); -bool w_string_equal ( W* a, W* b ); - -/* Turns one couplet into a list of couplets, each with a single path (lhs). */ -Ws* ws_split_couplet(W*); - -// recurse rules -Ws* ws_recurse_ws(W*); // recurse into V_WS -Ws* ws_recurse_most(W*); // recurse into V_WS and V_COUPLET (but not manifolds) -Ws* ws_recurse_none(W*); // no recursion -Ws* ws_recurse_composition(W*); // recurse into T_PATH and C_NEST -Ws* ws_recurse_type(W*); // recurse into nested types -Ws* ws_recurse_section(W*); // recurse only into sections -// parameterized recurse rules -Ws* ws_recurse_path(W*, W*); - -// criteria functions -bool w_keep_all(W*); - -// nextval functions -W* w_nextval_always(W* p, W* w); -W* w_nextval_never(W* p, W* w); -W* w_nextval_ifpath(W* p, W* w); - -#endif diff --git a/gdb-scripts/debug.gdb b/gdb-scripts/debug.gdb deleted file mode 100644 index 3739bf53..00000000 --- a/gdb-scripts/debug.gdb +++ /dev/null @@ -1,9 +0,0 @@ -file frontend/morloc - -set print repeats 100 - -set args frontend/test.loc - -source gdb-scripts/print.gdb - -break -function build_manifolds diff --git a/gdb-scripts/print.gdb b/gdb-scripts/print.gdb deleted file mode 100644 index 4e1abf67..00000000 --- a/gdb-scripts/print.gdb +++ /dev/null @@ -1,55 +0,0 @@ -define pw - dont-repeat - call printf("-------------------------------\n") - if $argc == 0 - call printf("%s\n", w_str(w)) - end - if $argc == 1 - call printf("%s\n", w_str($arg0)) - end -end -document pw - Print w, args = [0,1] -end - -define pws - dont-repeat - call printf("-------------------------------\n") - if $argc == 0 - call ws_print(ws, ws_recurse_none) - end - if $argc == 1 - call ws_print($arg0, ws_recurse_none) - end -end -document pws - Print ws, args = [0,1,2] -end - -define pwsv - dont-repeat - call printf("-------------------------------\n") - if $argc == 0 - call ws_print(ws, ws_recurse_ws) - end - if $argc == 1 - call ws_print($arg0, ws_recurse_ws) - end -end -document pwsv - Print ws, args = [0,1,2] -end - -define pwsvv - dont-repeat - call printf("-------------------------------\n") - if $argc == 0 - call ws_print(ws, ws_recurse_most) - end - if $argc == 1 - call ws_print($arg0, ws_recurse_most) - end -end -document pwsvv - Print ws, args = [0,1,2] -end diff --git a/library/Morloc.hs b/library/Morloc.hs new file mode 100644 index 00000000..1a210a0e --- /dev/null +++ b/library/Morloc.hs @@ -0,0 +1,15 @@ +-- Morloc.hs + +-- | A module for pure interpretation of morloc + +module Morloc (interpret) where + +import Morloc.Graph (Graph) +import Morloc.Evaluator (eval) +import Morloc.Data +import Data.Either (either) + +interpret :: String -> Either String (Graph MData) +interpret code = either err res (eval code) where + err = Left . unlines . lines . show + res = Right diff --git a/library/Morloc/Data.hs b/library/Morloc/Data.hs new file mode 100644 index 00000000..b4f631d1 --- /dev/null +++ b/library/Morloc/Data.hs @@ -0,0 +1,13 @@ +module Morloc.Data (MData(..)) where + +data MData + = MInt Integer + | MNum Double + | MString String + | MBool Bool + | MInts [ Integer ] + | MNums [ Double ] + | MStrings [ String ] + | MBools [ Bool ] + | MFunc String -- for now, MFunc is just a function name + deriving (Eq, Ord, Show) diff --git a/library/Morloc/EvalError.hs b/library/Morloc/EvalError.hs new file mode 100644 index 00000000..9f201bdc --- /dev/null +++ b/library/Morloc/EvalError.hs @@ -0,0 +1,25 @@ +module Morloc.EvalError +( + MorlocError(..) + , ThrowsError +) where + +import Text.Parsec (ParseError) + +data MorlocError + = BadApplication String + | BadComposition String + | SyntaxError ParseError + | BadArray String + | UnknownError + +instance Show MorlocError where show = morlocShow + +morlocShow :: MorlocError -> String +morlocShow (BadApplication msg) = "BadApplication: " ++ msg +morlocShow (BadComposition msg) = "BadComposition: " ++ msg +morlocShow (SyntaxError err) = "SyntaxError: " ++ show err +morlocShow (BadArray err) = "BadArray: " ++ show err +morlocShow UnknownError = "Damn, you broke it good" + +type ThrowsError = Either MorlocError diff --git a/library/Morloc/Evaluator.hs b/library/Morloc/Evaluator.hs new file mode 100644 index 00000000..92899d9d --- /dev/null +++ b/library/Morloc/Evaluator.hs @@ -0,0 +1,82 @@ +module Morloc.Evaluator (eval) where + +import Control.Monad.Except (throwError) +import Data.Maybe (mapMaybe) + +import Morloc.Data +import Morloc.Syntax as Syntax +import Morloc.EvalError as Error +import Morloc.Graph as Graph +import Morloc.Parser (parseExpr) + + +eval :: String -> Error.ThrowsError (Graph MData) +eval x = parseExpr x >>= expr2tree + + +expr2tree :: Syntax.Expr -> Error.ThrowsError (Graph MData) + +-- curried nodes outside of compositions +-- e.g. foo x y z +expr2tree (Syntax.Apply (Syntax.Value (MFunc s)) es) = + Graph.Node (MFunc s) <$> traverse expr2tree es + +-- simple nodes, composition without application +-- e.g. foo . bar +expr2tree (Syntax.BinOp Syntax.Dot (Syntax.Value (MFunc s)) e) = + Graph.Node (MFunc s) <$> traverse expr2tree [e] + +-- simple nodes, composition with application +-- e.g. foo x y . bar z +expr2tree (Syntax.BinOp Syntax.Dot (Syntax.Apply (Syntax.Value (MFunc s)) es) e) = + Graph.Node (MFunc s) <$> traverse expr2tree (es ++ [e]) + +-- atomic data - Int, Num, Str, Bool, etc +expr2tree (Syntax.Value d) = return $ Graph.Node d [] + +-- array +-- e.g. [1,1.4,12], [True,False], etc +expr2tree (Syntax.Array xs) + | all (atype "Int") xs = return $ Graph.Node ( MInts $ mapMaybe e2mints xs ) [] + | all (atype "String") xs = return $ Graph.Node ( MStrings $ mapMaybe e2mstrings xs ) [] + | all (atype "Bool") xs = return $ Graph.Node ( MBools $ mapMaybe e2mbools xs ) [] + | all (atype "Num") xs = return $ Graph.Node ( MNums $ mapMaybe e2mnums xs ) [] + | otherwise = throwError $ Error.BadArray msg + where + msg = "Arrays must be homogenous atomic collections" + + e2mints :: Expr -> Maybe Integer + e2mints (Value (MInt x)) = Just x + e2mints _ = Nothing + + e2mstrings :: Expr -> Maybe String + e2mstrings (Value (MString x)) = Just x + e2mstrings _ = Nothing + + e2mbools :: Expr -> Maybe Bool + e2mbools (Value (MBool x)) = Just x + e2mbools _ = Nothing + + e2mnums :: Expr -> Maybe Double + e2mnums (Value (MInt x)) = Just (read $ show x :: Double) + e2mnums (Value (MNum x)) = Just x + e2mnums _ = Nothing + + atype :: String -> Expr -> Bool + atype "Int" (Value (MInt _)) = True + atype "Num" (Value (MInt _)) = True + atype "Num" (Value (MNum _)) = True + atype "String" (Value (MString _)) = True + atype "Bool" (Value (MBool _)) = True + atype _ _ = False + + +-- throw error on all kinds of compositions not handled above +-- e.g. foo . 1 +expr2tree (Syntax.BinOp Syntax.Dot _ _) = throwError $ Error.BadComposition msg where + msg = "Primitives cannot be on the left side of a composition" + +-- throw error on all kinds of applications not handled above +-- e.g. 12 foo +expr2tree (Syntax.Apply _ _) = throwError $ Error.BadApplication msg where + msg = "Primitives cannot take arguments" diff --git a/library/Morloc/Generator.hs b/library/Morloc/Generator.hs new file mode 100644 index 00000000..6ab0a1be --- /dev/null +++ b/library/Morloc/Generator.hs @@ -0,0 +1,181 @@ +-- Generator.hs + +{-| Generate target code + +The role of the generator is the reverse of the role of the parser. A +parser takes a string and builds a data structure. The generator takes a +data structure and builds a string. + +Around statements - wrap the function, can be nested to arbitrary depth. +assertions, effects, caches, filters -- all these are subsets of the +Around statement. + * assert - determine whether to run the funtion + * before - do something before running the function + * after - do something after + * cache - output is cached ? return cache : run function + * filter - perform a function on the output +Since these wrap the function, they can be applied seperately +-} + +module Morloc.Generator (generate) where + +import Data.List (intercalate) + +import Morloc.Graph +import Morloc.Data + +-- These types are mostly for readability +type Code = String +type Nexus = Code +type UniqName = String +type Pool = (UniqName, Code) + +data Arg = Positional String | Keyword String String + +generate :: Graph MData -> (Nexus, [Pool]) +generate g = (generateNexus g, generatePools g) + +-- | Create a script that calls the root node +generateNexus :: Graph MData -> Nexus +generateNexus _ = unlines [ + "#!/usr/bin/env bash" + , "" + , "./pool.R m1" + ] + +-- | Create the code for each function pool +generatePools :: Graph MData -> [Pool] +generatePools g = [("pool.R", collapse g)] where + + collapse :: Graph MData -> String + collapse node = unlines [prologue, extractFunctions node, epilogue] + + prologue = "#!/usr/bin/Rscript --vanilla\n" + + epilogue = unlines + [ + "args <- commandArgs(TRUE)" + , "m <- args[1]" + , "if(exists(m)){" + , " print(get(m)())" + , "} else {" + , " quit(status=1)" + , "}" + ] + + extractFunctions :: Graph MData -> String + extractFunctions = unlines . toList . encodeNodes + + -- | Transform each node into a funtion in the target language + encodeNodes :: Graph MData -> Graph Code + encodeNodes = familyMap translate . suczip (+ 1) 1 where + translate :: (Int, MData) -> [(Int, MData)] -> Code + translate (i, MFunc name) inputs = code where + code = generateFunction (generateNode i) [] body + body = generateFunctionCall name (map callNode inputs) + translate _ _ = [] + +generateFunction :: String -> [Arg] -> Code -> Code +generateFunction name args body = concat [name, " <- function(", generateArgs args, ") {", body, "}"] + +-- | Generate a function call. For example, `foo(bar(),1)`. +generateFunctionCall :: String -> [String] -> Code +generateFunctionCall s ss = concat [s, "(", intercalate "," ss, ")"] + +generateArgs :: [Arg] -> String +generateArgs = intercalate "," . map (argstr "=") where + argstr :: String -> Arg -> String + argstr sep (Keyword k v) = k ++ sep ++ v + argstr _ (Positional v) = v + +-- | This is a wrapper for generateValue, only MFunc needs the node id +callNode :: (Int, MData) -> String +callNode (i, MFunc _) = generateNode i ++ "()" +callNode (_, x ) = generateValue x + +-- | Make a function name for a node. This name needs to be a valid identifier +-- in the target language. Usually just prefixing the node id with a character +-- works fine. Alternatively I could use a more descriptive name, such as the +-- wrapped function with a suffix. +generateNode :: Int -> String +generateNode i = "m" ++ show i + +generateValue :: MData -> String +generateValue (MInt x) = generateInt x +generateValue (MNum x) = generateNum x +generateValue (MString x) = generateString x +generateValue (MBool x) = generateBool x +generateValue (MInts x) = generateArray $ map MInt x +generateValue (MNums x) = generateArray $ map MNum x +generateValue (MStrings x) = generateArray $ map MString x +generateValue (MBools x) = generateArray $ map MBool x +generateValue _ = "WTF???" -- I'll fix this ... + +generateArray :: [MData] -> String +generateArray xs = "c(" ++ (intercalate ", " . map generateValue) xs ++ ")" + +generateBool :: Bool -> String +generateBool b = if b then "TRUE" else "FALSE" + +generateString :: String -> String +generateString s = "\"" ++ s ++ "\"" + +generateNum :: Double -> String +generateNum = show + +generateInt :: Integer -> String +generateInt = show + + +{- -- see Note 1 -} +{- setid :: Graph NodeAttr -> Graph NodeAttr -} +{- setid g = fst <$> propagate base (zipG zeroed gcount) where -} +{- -} +{- zeroed = fmap (\attr -> attr { nodeID = Just 0 }) g -} +{- -} +{- -- base :: a -> [a] -> [a] -} +{- base (_,i) gs' = zipWith set_child_id gs' child_ids where -} +{- set_child_id (attr,_) j = (attr { nodeID = Just j }, j) -} +{- child_ids = map (+ i) $ scanl1 (+) (map snd gs') -} +{- -} +{- -- gcount :: Graph Int -- graph with descendent counts -} +{- gcount = pullG (+) $ ifelseG (isTerminal g) (const 1) (const 0) g -} + +------- NOTE 1 ------------------------------------------------------ +-- s0 := setid :: Graph NodeAttr -> Graph NodeAttr +-- =============================================== +-- s1 := zipG :: Graph a -> Graph b -> Graph (a,b) +-- > s2 := g :: Graph NodeAttr +-- s3 := gcount :: Graph Int +-- ----------------------------------------------- +-- a :: NodeAttr ; b :: Int +-- ----------------------------------------------- +-- s4 := propagate :: (a -> [a] -> [a]) -> Graph a -> Graph a +-- s5 := base :: a -> [a] -> [a] +-- s6 := s1 s2 s3 :: Graph (NodeAttr, Int) +-- ----------------------------------------------- +-- s7 := s4 s5 s6 :: Graph (NodeAttr, Int) +-- < s8 := fmap fst :: Graph (NodeAttr, Int) -> Graph NodeAttr +-- ----------------------------------------------- +-- s8 s6 :: Graph NodeAttr +-- =============================================== +-- +-- +-- gcount :: Graph Int +-- ========================================================== +-- s9 := pullG :: Monoid a => (a -> a -> a) -> Graph a -> Graph a +-- s10 := ifelseG :: Graph Bool -> (a -> b) -> (a -> b) -> Graph a -> Graph b +-- s11 := isTerminal :: Graph a -> Graph Bool +-- s12 := const :: a -> b -> a +-- ---------------------------------------------------------- +-- s13 := pullG (+) :: Num a => Graph a -> Graph a +-- s14 := isTerminal g :: Bool +-- s15 := const 1 :: b -> Int +-- ---------------------------------------------------------- +-- b :: Int +-- ---------------------------------------------------------- +-- s16 := ifelseG (isTermiminal g) (const 1) (const 0) :: +-- Graph NodeAttr -> Graph Int +-- ---------------------------------------------------------- +-- < s16 g := Graph Int +--------------------------------------------------------------------- diff --git a/library/Morloc/Graph.hs b/library/Morloc/Graph.hs new file mode 100644 index 00000000..9694b54b --- /dev/null +++ b/library/Morloc/Graph.hs @@ -0,0 +1,122 @@ +module Morloc.Graph +( + Graph(..) + , toList + , familyMap + , childMap + , parentChildMap + , parentChildMapI + , isomorphic + , zipWithG + , safeZipWithG + , zipG + , safeZipG + , isTerminal + , ifelseG + , pullG + , propagate + , replaceValue + , suczip +) where + +import Data.List (union) + +data Graph a = Node a [Graph a] deriving(Show, Eq) + +-- utilities ---------------------------------------------- +values :: [Graph a] -> [a] +values = map v where + v (Node x _) = x + +value :: Graph a -> a +value (Node x _) = x + +{- kids :: Graph a -> [a] -} +{- kids (Node _ xs) = values xs -} +----------------------------------------------------------- + + +instance Functor Graph where + fmap f (Node x xs) = Node (f x) (fmap (fmap f) xs) + +instance Foldable Graph where + foldr f z (Node a []) = f a z + foldr f z (Node a (x:xs)) = foldr f (foldr f z x) (Node a xs) + +zipWithG :: (a -> b -> c) -> Graph a -> Graph b -> Graph c +zipWithG f (Node x xs) (Node y ys) = Node (f x y) (zipWith (zipWithG f) xs ys) + +isomorphic :: Graph a -> Graph b -> Bool +isomorphic (Node _ xs) (Node _ ys) = cmp_this && cmp_kids where + cmp_this = length xs == length ys + cmp_kids = and $ zipWith isomorphic xs ys + +safeZipWithG :: (a -> b -> c) -> Graph a -> Graph b -> Maybe (Graph c) +safeZipWithG f a b = + if isomorphic a b then + Just (zipWithG f a b) + else + Nothing + +zipG :: Graph a -> Graph b -> Graph (a,b) +zipG = zipWithG (,) + +safeZipG :: Graph a -> Graph b -> Maybe (Graph (a,b)) +safeZipG = safeZipWithG (,) + +pullG :: (a -> a -> a) -> Graph a -> Graph a +pullG f (Node x xs) = Node (foldr f x (values xs')) xs' where + xs' = map (pullG f) xs + +propagate :: (a -> [a] -> [a]) -> Graph a -> Graph a +propagate f (Node x xs) = Node x (map (propagate f) newkids) where + newkids = zipWith replaceValue (f x (values xs)) xs + +replaceValue :: a -> Graph a -> Graph a +replaceValue x (Node _ xs) = Node x xs + +isTerminal :: Graph a -> Graph Bool +isTerminal (Node _ []) = Node True [] +isTerminal (Node _ xs) = Node False (map isTerminal xs) + +ifelseG :: Graph Bool -> (a -> b) -> (a -> b) -> Graph a -> Graph b +ifelseG gcond fa fb gx = zipWithG ternary' gx gcond where + ternary' x cond = if cond then fa x else fb x + +-- | graph to list, just a list of all a +toList :: Eq a => Graph a -> [a] +toList (Node x xs) = [x] `union` (xs >>= toList) + +-- | modify parent by comparing to children +familyMap :: (a -> [a] -> b) -> Graph a -> Graph b +familyMap f (Node t ts) = Node new_val new_kids where + new_val = f t $ values ts + new_kids = map (familyMap f) ts + +-- | modify parents based only on children +childMap :: ([a] -> b) -> Graph a -> Graph b +childMap f (Node _ ts) = Node new_val new_kids where + new_val = f $ values ts + new_kids = map (childMap f) ts + +-- | replace node values with parent/child relation lists +parentChildMap :: (a -> a -> b) -> Graph a -> Graph [b] +parentChildMap f (Node t ts) = Node new_val new_kids where + new_val = map (f t) (values ts) + new_kids = map (parentChildMap f) ts + +-- | like parentChildMap, but includes child order index +parentChildMapI :: (a -> (Int, a) -> b) -> Graph a -> Graph [b] +parentChildMapI f (Node t ts) = Node new_val new_kids where + new_val = map (f t) (zip [1..] (values ts)) + new_kids = map (parentChildMapI f) ts + +-- | A zip function that zips elements from a series (defined by a successor +-- function and an initial element) to elements of the graph. This function can +-- be used to map unique ids to nodes: `suczip (+ 1) 1 g`. +suczip :: (a -> a) -> a -> Graph b -> Graph (a,b) +suczip f x (Node y kids) = Node (x,y) (mapzip' f (f x) kids) where + mapzip' :: (a -> a) -> a -> [Graph b] -> [Graph (a,b)] + mapzip' _ _ [] = [] + mapzip' f' x' (t:ts) = [top] ++ mapzip' f' (fst . value $ top) ts where + top = suczip f' x' t diff --git a/library/Morloc/Lexer.hs b/library/Morloc/Lexer.hs new file mode 100644 index 00000000..6dc97862 --- /dev/null +++ b/library/Morloc/Lexer.hs @@ -0,0 +1,59 @@ +module Morloc.Lexer ( + lexer + , parseInteger + , parseFloat + , parseString + , parseBoolean + , parseIdentifier + , parseReserved + , parseReservedOp +) where + +import Text.Parsec +import Text.Parsec.String (Parser) +import Text.Parsec.Language +import Text.Parsec.Token as Token + +lexer :: Token.TokenParser () +lexer = Token.makeTokenParser style + where + style = emptyDef { + Token.commentLine = "#" + , Token.commentStart = "" + , Token.commentEnd = "" + , Token.nestedComments = False + , Token.identStart = letter <|> char '_' + , Token.identLetter = alphaNum <|> oneOf "_.'" + , Token.opStart = Token.opLetter emptyDef + , Token.opLetter = oneOf ":!#$%&*+./<=>?@\\^|-~" + , Token.reservedOpNames = ["."] + , Token.reservedNames = [] + , Token.caseSensitive = True + } + +parseInteger :: Parser Integer +parseInteger = Token.integer lexer + +parseFloat :: Parser Double +parseFloat = Token.float lexer + +parseString :: Parser String +parseString = do + _ <- char '"' + s <- many ((char '\\' >> char '"' ) <|> noneOf "\"") + _ <- char '"' + return s + +parseIdentifier :: Parser String +parseIdentifier = Token.identifier lexer + +parseBoolean :: Parser Bool +parseBoolean = do + s <- string "True" <|> string "False" + return (read s) + +parseReserved :: String -> Parser () +parseReserved = Token.reserved lexer + +parseReservedOp :: String -> Parser () +parseReservedOp = Token.reservedOp lexer diff --git a/library/Morloc/Parser.hs b/library/Morloc/Parser.hs new file mode 100644 index 00000000..0a379a6d --- /dev/null +++ b/library/Morloc/Parser.hs @@ -0,0 +1,96 @@ +module Morloc.Parser (parseExpr) where + +import Text.Parsec +import qualified Text.Parsec.Combinator as C +import Text.Parsec.String (Parser) + +import Text.Parsec.Expr (Operator(..), Assoc(..), buildExpressionParser) +import Text.Parsec.Token (whiteSpace) +import Control.Monad.Except (throwError) + +import Morloc.Lexer +import Morloc.Syntax +import Morloc.Data +import Morloc.EvalError (ThrowsError, MorlocError(..)) + +-- | Parse a string of Morloc text into an expression that may be passed to +-- Morloc.Evaluator.eval. Catch lexical syntax errors. +parseExpr :: String -> ThrowsError Expr +parseExpr s = + case parse (contents expr) "" s of + Left err -> throwError $ SyntaxError err + Right val -> return val + where + contents :: Parser a -> Parser a + contents p = do + whiteSpace lexer + r <- p + eof + return r + + +node :: Parser Expr +node = fmap ( Value . MFunc ) parseIdentifier + +num :: Parser Expr +num = fmap ( Value . MNum ) parseFloat + +int :: Parser Expr +int = fmap ( Value . MInt ) parseInteger + +str :: Parser Expr +str = fmap ( Value . MString ) parseString + +bool :: Parser Expr +bool = fmap ( Value . MBool ) parseBoolean + +-- Parsers for heterogenous arrays +-- The evaluator will trim the possibilities. Currently only homogenous arrays +-- of primitives are allows. +array :: Parser Expr +array = do + -- TODO I think there is a clean way to neatly tokenize away the whitespace + _ <- whiteSpace lexer + _ <- char '[' + _ <- whiteSpace lexer + m <- C.sepBy element (char ',') + _ <- whiteSpace lexer + _ <- char ']' + _ <- whiteSpace lexer + return $ Array m + +element :: Parser Expr +element = do + _ <- whiteSpace lexer + p <- try bool + <|> try num + <|> try int + <|> try str + _ <- whiteSpace lexer + return p + +factor :: Parser Expr +factor = + try array + <|> try bool + <|> try num -- num before int, else "." parsed as COMPOSE + <|> try int + <|> try str + <|> try node + +-- parse an expression, handles precedence and associativity +expr :: Parser Expr +expr = buildExpressionParser table (try apply <|> factor) + where + -- binary operators, listed in order of precedence + table = + [[binary "." Dot AssocRight]] + where + binary s f = Infix $ parseReservedOp s >> return (BinOp f) + +apply :: Parser Expr +apply = do + name <- factor -- NOTE: I'll allow anything to compose here, + -- I'll catch the errors in the evaluator + args <- many1 factor + return $ Apply name args diff --git a/library/Morloc/Syntax.hs b/library/Morloc/Syntax.hs new file mode 100644 index 00000000..c76d22e4 --- /dev/null +++ b/library/Morloc/Syntax.hs @@ -0,0 +1,14 @@ +module Morloc.Syntax ( Expr(..) , Op(..) ) where + +import Morloc.Data (MData) + +data Expr + = Value MData + | Array [Expr] + | BinOp Op Expr Expr + | Apply Expr [Expr] + deriving (Eq, Ord, Show) + +data Op + = Dot -- "." + deriving (Eq, Ord, Show) diff --git a/morloc.cabal b/morloc.cabal new file mode 100644 index 00000000..02d1dc85 --- /dev/null +++ b/morloc.cabal @@ -0,0 +1,83 @@ +name: morloc +version: 0.11.0 +homepage: https://github.com/arendsee/morloc +synopsis: A multi-lingual, typed, workflow language +description: + + Morloc is a generative, metaprogamming language that composes functions + from other languages (e.g. Bash, R, Python) into multi-lingual workflows. + The central goal of Morloc eliminate the boundaries between the many + languages used for data analysis, unifying all through a common type + system. Each node in the workflow wraps an explicitly typed function (the + type system is a subset of the Haskell's). Based on these types, the + compiler generates linking code, wraps the functions in executable scripts, + and checks the high-level correctness of the program. The Morloc + programmer tells the Morloc compiler the function signature and specifies + the funtion gaph, and the compiler does the rest. + +category: Compiler +license: GPL-3 +license-file: LICENSE +author: Zebulun Arendsee +maintainer: arendsee@iastate.edu +extra-source-files: README.md TODO CONFIG + data/*.json + tests-suite/*.hs +cabal-version: >= 1.10 +bug-reports: https://github.com/arendsee/morloc/issues +build-type: Simple + +flag documentation + default: False + +library + default-language: Haskell2010 + hs-source-dirs: library + exposed-modules: Morloc + Morloc.EvalError + Morloc.Generator + Morloc.Graph + Morloc.Data + Morloc.Evaluator + Morloc.Lexer + Morloc.Parser + Morloc.Syntax + + build-depends: base, + parsec, + mtl + + ghc-options: -Wall + + if flag(documentation) + build-depends: hscolour + +executable morloc + default-language: Haskell2010 + main-is: Main.hs + hs-source-dirs: executable + build-depends: base, + repline, + mtl, + parsec, + process, + directory, + morloc + + ghc-options: -Wall + + +test-suite hspec + build-depends: base, morloc, hspec, QuickCheck + default-language: Haskell2010 + hs-source-dirs: test-suite + main-is: Spec.hs + type: exitcode-stdio-1.0 + + +test-suite hlint + build-depends: base, hlint + default-language: Haskell2010 + hs-source-dirs: test-suite + main-is: HLint.hs + type: exitcode-stdio-1.0 diff --git a/test-suite/HLint.hs b/test-suite/HLint.hs new file mode 100644 index 00000000..1a45fb79 --- /dev/null +++ b/test-suite/HLint.hs @@ -0,0 +1,11 @@ +module Main (main) where +import Language.Haskell.HLint (hlint) +import System.Exit (exitFailure, exitSuccess) + +-- list of libraries to search for source files +arguments :: [String] +arguments = ["executable", "library", "test-suite"] +main :: IO () +main = do + hints <- hlint arguments + if null hints then exitSuccess else exitFailure diff --git a/test-suite/Spec.hs b/test-suite/Spec.hs new file mode 100644 index 00000000..f401456e --- /dev/null +++ b/test-suite/Spec.hs @@ -0,0 +1,39 @@ +-- This stub is from HSpec tutorial (http://hspec.github.io/) +-- I like HSpec, mostly because it is very cleanly documented + +import Test.Hspec +import Test.QuickCheck +import Control.Exception (evaluate) +import Data.List (intercalate) +import Data.Either (either, isLeft) +import Control.Applicative + +import Morloc (interpret) +import Morloc.Evaluator (eval) +{- import MorlocExecutable.Mode (asLIL) -} + +main :: IO () +main = hspec $ do + + describe "parse morloc code" $ do + + it "dies on syntax errors" $ do + (isLeft . eval) "a b . %" `shouldBe` True + (isLeft . eval) ". a" `shouldBe` True + + it "doesn't allow application to primitives" $ do + (isLeft . eval) "1 1" `shouldBe` True + (isLeft . eval) "a . 1 1" `shouldBe` True + + {- describe "interpret asLIL" $ -} + {- -} + {- it "handles node application (a b)" $ -} + {- shouldBe -} + {- (readLIL "a b") -} + {- (Right [["a", "0", "1", "*", "b"]]) -} + {- -} + {- where -} + {- readLIL :: String -> Either String [[String]] -} + {- readLIL s = either l r (interpret asLIL s) where -} + {- l = Left . show -} + {- r = Right . map words . lines -} diff --git a/test.loc b/test.loc new file mode 100644 index 00000000..be14211a --- /dev/null +++ b/test.loc @@ -0,0 +1,75 @@ +foo bar baz . bif + + + .--- (b) + (foo) --- (a) ---- (c) --- (d) --- (e) + `--------------------' + +# old morloc +foo . a . b (c . d . ) e + +# haskell application +foo $ a b (c d ) e + +# function definition +foo = a $ b (c $1) (d $2 $1) 1 + + +# partial application +bar' = bar - 1 - + +bar :: a -> b -> c -> d +bar' :: a -> c -> d + + + + .--- (foo) ---- .--- (b) +(baz) `(a) ---- (c) --- (d) --- (e) + `--- (bar) ----' `--------------------' + +# old morloc +baz . foo bar . a . b (c . d . ) e + +# hask +baz (foo ) (bar $ a b (c d ) e) + + + foo ----. + bar ----- (a) + baz ----' + +# old morloc +foo bar baz . a + +# hask +foo a +bar +baz + +# extended hask +foo , bar , baz $ a + + + + +# allow keyword arguments +foo x y k=1 r=2 . bar a b r=[2,3,4] + +# rather than having the argument section, we can just use partial application +foo' := foo k=1 r=2 + +foo' x y . bar + +# I also want to increase the versatility of the functions by allowing +# promotion of parameters + +foo :: X -> Y {a=1::Int, b=2::Num, c=[1,2]::[Int]} + +bar := foo ^a :: X -> a -> Y + +# This could be used to, for example, perform a parameter sweep + + +# Do I want dependent types? Yes. + +foo :: (Int:x,Int:y) where x < y # hmm, I really can't do this diff --git a/tests/backend-tests/filter/Makefile b/tests/backend-tests/filter/Makefile deleted file mode 100644 index 6cf7d3a9..00000000 --- a/tests/backend-tests/filter/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py R - ./manifold-nexus.py sh - ./manifold-nexus.py py - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/filter/x b/tests/backend-tests/filter/x deleted file mode 100755 index 5266b16d..00000000 --- a/tests/backend-tests/filter/x +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -cat < z -[1,3,5] -[1,3,5] -[1, 3, 5] -EOF -stat=0 -morloc -kx locout x.loc || stat=1 -./manifold-nexus.py R > y -./manifold-nexus.py sh >> y -./manifold-nexus.py py >> y -diff z y &> /dev/null || stat=1 -rm -rf locout z y manifold-nexus.py -exit $stat diff --git a/tests/backend-tests/filter/x.loc b/tests/backend-tests/filter/x.loc deleted file mode 100644 index 515990ea..00000000 --- a/tests/backend-tests/filter/x.loc +++ /dev/null @@ -1,39 +0,0 @@ -@include -core/control - -@type -odd :: Int -> Bool -c :: ? -> [Int] -filter :: * -> * -> [Int] - -@path R -A :: filter . &( odd . $1 ) -B :: filter . &( odd . $1 ) -C :: filter . &( odd . $1 ) - - -X :: c . 1 2 3 4 5 - -@lang -c :: R -A/filter,A/odd :: R -B/filter,B/odd :: sh -C/filter,C/odd :: py - -@export -A/filter as R -B/filter as sh -C/filter as py - -@source R -odd <- function(x){ x %% 2 != 0} - -@source sh -odd (){ - x=$1 - [[ $(( x % 2 )) -ne 0 ]] && echo 'true' || echo 'false' -} - -@source py -def odd(x): - return x % 2 != 0 diff --git a/tests/backend-tests/if/Makefile b/tests/backend-tests/if/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/if/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/if/x b/tests/backend-tests/if/x deleted file mode 100755 index 6689f45a..00000000 --- a/tests/backend-tests/if/x +++ /dev/null @@ -1 +0,0 @@ -echo 4 diff --git a/tests/backend-tests/if/x.loc b/tests/backend-tests/if/x.loc deleted file mode 100644 index e83a287f..00000000 --- a/tests/backend-tests/if/x.loc +++ /dev/null @@ -1,14 +0,0 @@ -@include -core/control -core/atomic - -@type -sqrt :: Int -> Int -id :: a -> a - -@path R -if . - true # Condition block - &( sqrt . $1 ) # if block - &( id . $1 ) # else block - 16 # input diff --git a/tests/backend-tests/nexus-docs/x b/tests/backend-tests/nexus-docs/x deleted file mode 100755 index 6b5fa1c5..00000000 --- a/tests/backend-tests/nexus-docs/x +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -morloc -x tst x.loc -status= -./manifold-nexus.py | grep -q "get unique values" -if [[ $? -eq 0 ]] -then - status=0 -else - status=1 -fi -rm -rf tst - -exit $status diff --git a/tests/backend-tests/nexus-docs/x.loc b/tests/backend-tests/nexus-docs/x.loc deleted file mode 100644 index 4c9b0800..00000000 --- a/tests/backend-tests/nexus-docs/x.loc +++ /dev/null @@ -1,6 +0,0 @@ -@path sh -uniq . sort . ls - -@doc -uniq :: "get unique values" -sort :: "sort (doesn't work on apple)" diff --git a/tests/backend-tests/py-hooks/Makefile b/tests/backend-tests/py-hooks/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/py-hooks/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/py-hooks/x b/tests/backend-tests/py-hooks/x deleted file mode 100755 index a28ba370..00000000 --- a/tests/backend-tests/py-hooks/x +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/bash -cat << EOF -0 -0 -- 2 -. 2 -- - 4 -. . 4 -- - 5 -. . 5 -- 3 -. 3 -1 -1 -null -EOF diff --git a/tests/backend-tests/py-hooks/x.loc b/tests/backend-tests/py-hooks/x.loc deleted file mode 100644 index cb7fd2be..00000000 --- a/tests/backend-tests/py-hooks/x.loc +++ /dev/null @@ -1,78 +0,0 @@ -@type -foo :: Int -> Void -bar :: Void -> Int -print :: * -> Void - -@path -foo . bar - -@arg -bar :: x=1 y=2 - -@lang -* :: py - -@cache -foo :: memcache - -@assert -foo :+ true -foo :+ true - -@0 -foo :+ print . "0" -foo :+ print . "0" - -@1 -foo :+ print . "1" -foo :+ print . "1" - -@2 -foo :+ print . "- 2" -foo :+ print . ". 2" - -@3 -foo :+ print . "- 3" -foo :+ print . ". 3" - -@4 -foo :+ print . "- - 4" -foo :+ print . ". . 4" - -@5 -foo :+ print . "- - 5" -foo :+ print . ". . 5" - -@6 -foo :+ print . "- - 6" -foo :+ print . ". . 6" - -@7 -foo :+ print . "- - 7" -foo :+ print . ". . 7" - -@8 -foo :+ print . "- 8" -foo :+ print . ". 8" - -@9 -foo :+ print . "- 9" -foo :+ print . ". 9" - -@arg -print :: file=sys.stderr - - -@include -core/memcache - -@source py - -def true(): - return True - -def foo(x): - pass - -def bar(x=None, y=None): - return x + y diff --git a/tests/backend-tests/py-logical/Makefile b/tests/backend-tests/py-logical/Makefile deleted file mode 100644 index 98e1b5cb..00000000 --- a/tests/backend-tests/py-logical/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py a - ./manifold-nexus.py b - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/py-logical/x b/tests/backend-tests/py-logical/x deleted file mode 100755 index 4634a15d..00000000 --- a/tests/backend-tests/py-logical/x +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -morloc -x zzz x.loc -./manifold-nexus.py a &> a -./manifold-nexus.py b &> b -cat a b | diff /dev/stdin <(echo -e "true\nfalse") &> /dev/null -stat=$? -rm -rf zzz manifold-nexus.py a b -exit $stat diff --git a/tests/backend-tests/py-logical/x.loc b/tests/backend-tests/py-logical/x.loc deleted file mode 100644 index 0d5d00a4..00000000 --- a/tests/backend-tests/py-logical/x.loc +++ /dev/null @@ -1,24 +0,0 @@ -@include -core/atomic - -@export -A/and as a -B/not as b - -@source py - -def is_a(): - return True - -def is_b(): - return True - -def is_c(): - return False - -def is_d(): - return False - -@path py -A :: and . is_a (any . is_b is_c (not . is_d)) -B :: not . and . is_a (any . is_b is_c (not . is_d)) diff --git a/tests/backend-tests/py-positionals/Makefile b/tests/backend-tests/py-positionals/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/py-positionals/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/py-positionals/x b/tests/backend-tests/py-positionals/x deleted file mode 100755 index e6480ce6..00000000 --- a/tests/backend-tests/py-positionals/x +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo '"12|hi there|-2.3|True|False"' diff --git a/tests/backend-tests/py-positionals/x.loc b/tests/backend-tests/py-positionals/x.loc deleted file mode 100644 index d54a2614..00000000 --- a/tests/backend-tests/py-positionals/x.loc +++ /dev/null @@ -1,9 +0,0 @@ -@type -foo :: ? -> String - -@path py -foo . 12 "hi there" -2.3 TRUE FALSE - -@source py -def foo(*args): - return("|".join(str(s) for s in args)) diff --git a/tests/backend-tests/py-sh/Makefile b/tests/backend-tests/py-sh/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/py-sh/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/py-sh/x b/tests/backend-tests/py-sh/x deleted file mode 100755 index 70e1856e..00000000 --- a/tests/backend-tests/py-sh/x +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -cat < [[Int]] -sort :: [[Int]] -> [[Int]] -topthree :: [[Int]] -> [[Int]] - -@path -topthree . sort . gentab - -@lang -sort :: sh -gentab,topthree :: py - -@arg -sort :: -r - -@source py - -def gentab(): - d = [] - for i in range(5): - d.append(tuple(range(i, i+3))) - return d - -def topthree(x): - return x[0:3] diff --git a/tests/backend-tests/py-table/Makefile b/tests/backend-tests/py-table/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/py-table/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/py-table/x b/tests/backend-tests/py-table/x deleted file mode 100755 index 21488384..00000000 --- a/tests/backend-tests/py-table/x +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -cat < [[Int]] - -@path py -gentab - -@source py - -def gentab(): - d = [] - for i in range(5): - d.append(tuple(range(i, i+3))) - return d diff --git a/tests/backend-tests/r-all/Makefile b/tests/backend-tests/r-all/Makefile deleted file mode 100644 index 78ae3a98..00000000 --- a/tests/backend-tests/r-all/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout z.pdf diff --git a/tests/backend-tests/r-all/x b/tests/backend-tests/r-all/x deleted file mode 100755 index 327e6643..00000000 --- a/tests/backend-tests/r-all/x +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -morloc -x tst x.loc -./manifold-nexus.py main -status= -if [[ -f z.pdf ]] -then - status=0 -else - status=1 -fi -rm -rf tst manifold-nexus.py z.pdf - -exit $status diff --git a/tests/backend-tests/r-all/x.loc b/tests/backend-tests/r-all/x.loc deleted file mode 100644 index 6b1e82a3..00000000 --- a/tests/backend-tests/r-all/x.loc +++ /dev/null @@ -1,45 +0,0 @@ -@source R - -# Load a builtin R dataset and return -load_data <- function() { - data(iris, envir=environment()) - iris$Species <- NULL - iris -} - -# Normalize numeric columns -normalize <- function(x) { - as.data.frame(lapply(x, function(x) (x - mean(x)) / sd(x))) -} - -columns_are_numeric <- function(x) { - all(sapply(x, is.numeric)) -} - -plot_pdf <- function(x, path){ - pdf(path) - plot(x) - dev.off() -} - -@include -core/datcache -core/atomic - -@path -null . hclust . dist . normalize . load_data - -@lang -* :: R - -@cache -hclust,dist,normalize :: datcache - -@assert -normalize := columns_are_numeric . - -@fail -normalize :: warning . "Invalid input to _normalize_" - -@3 -null := plot_pdf . "z.pdf" diff --git a/tests/backend-tests/r-branch/Makefile b/tests/backend-tests/r-branch/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/r-branch/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/r-branch/x b/tests/backend-tests/r-branch/x deleted file mode 100755 index 3d7d47d8..00000000 --- a/tests/backend-tests/r-branch/x +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -morloc -x zzz x.loc - -diff <(./manifold-nexus.py main) \ - <(echo '["Sepal.Length","Sepal.Width","Petal.Width","Species"]') \ - &> /dev/null -stat=$? - -rm -rf zzz manifold-nexus.py - -if [[ $stat == 0 ]] -then - exit 0 -else - exit 1 -fi diff --git a/tests/backend-tests/r-branch/x.loc b/tests/backend-tests/r-branch/x.loc deleted file mode 100644 index baaa51b5..00000000 --- a/tests/backend-tests/r-branch/x.loc +++ /dev/null @@ -1,54 +0,0 @@ -@include -core/atomic - -# @type -# colnames :: -# gelse -# foo -# bar -# baz :: [String] -# get_species :: Tab -> [String] -# load_iris :: NULL -> Tab - -@source R - -load_iris <- function() { iris } - -get_species <- function(x, species) { subset(x, Species == species) } - -foo <- function(x) { x$Sepal.Length = NULL; x } -bar <- function(x) { x$Sepal.Width = NULL; x } -baz <- function(x) { x$Petal.Length = NULL; x } - -is_bazable <- function(x) all(x$Species == "setosa") -is_barable <- function(x) all(x$Species == "versicolor") -is_fooable <- function(x) all(x$Species == "virginica") - -gelse <- function(...) { - for(x in list(...)){ - if(!is.null(x)){ - break; - } - } - x -} - -@export -colnames as main - -@path -colnames . gelse . foo bar baz null . get_species . load_iris - -@lang -* :: R - -@assert -baz :: is_bazable . -bar :: is_barable . -foo :: is_fooable . - -@arg -get_species :: species="setosa" - -@fail -baz,bar,foo :: null diff --git a/tests/backend-tests/r-cached/Makefile b/tests/backend-tests/r-cached/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/r-cached/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/r-cached/x b/tests/backend-tests/r-cached/x deleted file mode 100755 index 0d3d8186..00000000 --- a/tests/backend-tests/r-cached/x +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo 3 diff --git a/tests/backend-tests/r-cached/x.loc b/tests/backend-tests/r-cached/x.loc deleted file mode 100644 index 48ea5cb4..00000000 --- a/tests/backend-tests/r-cached/x.loc +++ /dev/null @@ -1,19 +0,0 @@ -@comment - -Same as - -R> sqrt(max(seq(1,9))) - -@include -core/datcache - -@type -seq :: Int -> Int -> [Int] -max :: [Int] -> Int -sqrt :: Int -> Num - -@path R -sqrt . max . seq . 1 9 - -@cache -seq :: datcache diff --git a/tests/backend-tests/r-check/Makefile b/tests/backend-tests/r-check/Makefile deleted file mode 100644 index c002ca9f..00000000 --- a/tests/backend-tests/r-check/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -tkx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py sqrt - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/r-check/x b/tests/backend-tests/r-check/x deleted file mode 100755 index 10af21e1..00000000 --- a/tests/backend-tests/r-check/x +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -cat << EOF > z -"na" -EOF - -stat=0 -morloc -kx locout x.loc || stat=1 -./manifold-nexus.py main > y 2> /dev/null -diff z y || stat=1 -&> /dev/null -rm -rf locout z y manifold-nexus.py -exit $stat diff --git a/tests/backend-tests/r-check/x.loc b/tests/backend-tests/r-check/x.loc deleted file mode 100644 index 6ea31cc3..00000000 --- a/tests/backend-tests/r-check/x.loc +++ /dev/null @@ -1,23 +0,0 @@ -@type -seq :: Int -> Int -> [Int] -max :: [Int] -> Int -sqrt :: Int -> Int # TODO get real -print_na :: ? -> String -is_positive :: Int -> Bool - -@source R - -is_positive <- function(x){ all(x >= 0) } -print_na <- function(...){ "na" } - -@path -sqrt . max . seq . -1 -10 - -@lang -* :: R - -@assert -sqrt := is_positive . - -@fail -sqrt :: print_na diff --git a/tests/backend-tests/r-grpref-deref/x b/tests/backend-tests/r-grpref-deref/x deleted file mode 100755 index 819987ef..00000000 --- a/tests/backend-tests/r-grpref-deref/x +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -morloc -x tst x.loc &> /dev/null -./manifold-nexus.py map &> /dev/null -status= -if [[ -f f-cars.pdf && -f f-mtcars.pdf ]] -then - status=0 -else - status=1 -fi -rm -rf tst *pdf manifold-nexus.py - -exit $status diff --git a/tests/backend-tests/r-grpref-deref/x.loc b/tests/backend-tests/r-grpref-deref/x.loc deleted file mode 100644 index d089ebfa..00000000 --- a/tests/backend-tests/r-grpref-deref/x.loc +++ /dev/null @@ -1,54 +0,0 @@ -@include -core/datcache -core/atomic - -@source R - -# Load a builtin R dataset and return -load_data <- function(x) { - eval(parse(text=x)) -} - -# Normalize numeric columns -normalize <- function(x) { - as.data.frame(lapply(x, function(x) (x - mean(x)) / sd(x))) -} - -columns_are_numeric <- function(x) { - all(sapply(x, is.numeric)) -} - -plot_pdf <- function(x, name){ - path <- paste0("f-", name, ".pdf") - pdf(path) - plot(x) - dev.off() -} - -map <- function(f, x){ - lapply(x, f) -} - -@export -map - -@path -map . - *Cluster - (c . "cars" "mtcars") - -Cluster :: &( null . hclust . dist . normalize . load_data . $1 ) - -@lang -* :: R - -@cache -hclust,dist,normalize,load_data :: datcache - -@assert -normalize :: columns_are_numeric . -dist :: not . is.null . -hclust :: not . is.null . - -@3 -hclust := plot_pdf . $1 diff --git a/tests/backend-tests/r-hooks/Makefile b/tests/backend-tests/r-hooks/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/r-hooks/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/r-hooks/exp.txt b/tests/backend-tests/r-hooks/exp.txt deleted file mode 100644 index f2081f56..00000000 --- a/tests/backend-tests/r-hooks/exp.txt +++ /dev/null @@ -1,7 +0,0 @@ -0 -- 2 -- - 4 -- - 5 -- 3 -1 -null diff --git a/tests/backend-tests/r-hooks/x b/tests/backend-tests/r-hooks/x deleted file mode 100755 index 68a2e7f7..00000000 --- a/tests/backend-tests/r-hooks/x +++ /dev/null @@ -1 +0,0 @@ -cat exp.txt diff --git a/tests/backend-tests/r-hooks/x.loc b/tests/backend-tests/r-hooks/x.loc deleted file mode 100644 index af665307..00000000 --- a/tests/backend-tests/r-hooks/x.loc +++ /dev/null @@ -1,58 +0,0 @@ -@include -core/memcache -core/atomic - -@type -bar :: Void -> Int -foo :: Int -> Void -cat :: String -> Void - -@path -foo . bar - -@source R -foo <- function(x, y=0) { NULL } -bar <- function() { 1 } - -@arg -foo :: y=1 -cat :: file="/dev/stderr" - -@lang -* :: R - -@cache -foo :: memcache - -@assert -foo :: true - -@0 -foo :: cat . "0\n" - -@1 -foo :: cat . "1\n" - -@2 -foo :: cat . "- 2\n" - -@3 -foo :: cat . "- 3\n" - -@4 -foo :: cat . "- - 4\n" - -@5 -foo :: cat . "- - 5\n" - -@6 -foo :: cat . "- - 6\n" - -@7 -foo :: cat . "- - 7\n" - -@8 -foo :: cat . "- 8\n" - -@9 -foo :: cat . "- 9\n" diff --git a/tests/backend-tests/r-import/x b/tests/backend-tests/r-import/x deleted file mode 100755 index 64240d3d..00000000 --- a/tests/backend-tests/r-import/x +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo 7 diff --git a/tests/backend-tests/r-import/x-foo-1.loc b/tests/backend-tests/r-import/x-foo-1.loc deleted file mode 100644 index 54a0f852..00000000 --- a/tests/backend-tests/r-import/x-foo-1.loc +++ /dev/null @@ -1,13 +0,0 @@ -@source R -foo <- function() { 1 } -baz <- function(x) { x * 3 } - -@export -Foo1 as baz - -@type -baz :: Number -> Number -foo :: void -> Number - -@path -Foo1 :: baz . foo diff --git a/tests/backend-tests/r-import/x-foo-2.loc b/tests/backend-tests/r-import/x-foo-2.loc deleted file mode 100644 index 768dba1e..00000000 --- a/tests/backend-tests/r-import/x-foo-2.loc +++ /dev/null @@ -1,13 +0,0 @@ -@source R -foo <- function() { 2 } -bar <- function(x) { x * 2 } - -@export -Foo2 as bar - -@type -bar :: Number -> Number -foo :: void -> Number - -@path -Foo2 :: bar . foo diff --git a/tests/backend-tests/r-import/x.loc b/tests/backend-tests/r-import/x.loc deleted file mode 100644 index 979a9722..00000000 --- a/tests/backend-tests/r-import/x.loc +++ /dev/null @@ -1,10 +0,0 @@ -@import -from "x-foo-1.loc" import bar as zzz -import "x-foo-2.loc" - -@source R - -add <- function(a, b){ a + b } - -@path -add . zzz baz diff --git a/tests/backend-tests/r-logical/Makefile b/tests/backend-tests/r-logical/Makefile deleted file mode 100644 index 47ec1f72..00000000 --- a/tests/backend-tests/r-logical/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py say_hi - ./manifold-nexus.py say_bi - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/r-logical/x b/tests/backend-tests/r-logical/x deleted file mode 100755 index ec7c016c..00000000 --- a/tests/backend-tests/r-logical/x +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -morloc -x zzz x.loc -./manifold-nexus.py say_hi > a -./manifold-nexus.py say_bi > b -cat a b | diff /dev/stdin <(echo '"hi"'; echo "null") &> /dev/null -stat=$? -rm -rf zzz manifold-nexus.py a b -exit $stat diff --git a/tests/backend-tests/r-logical/x.loc b/tests/backend-tests/r-logical/x.loc deleted file mode 100644 index 7a3f8930..00000000 --- a/tests/backend-tests/r-logical/x.loc +++ /dev/null @@ -1,34 +0,0 @@ -@include -core/atomic - -@export -say_hi -say_bi - -@type -is_a , -is_b , -is_c , -is_d :: Void -> Bool - -say_hi , -say_bi :: Void -> String - -@path -say_hi say_bi - -@lang -* :: R - -@assert -say_hi :: and . is_a (any . is_b is_c (not . is_d)) -say_bi :: not . and . is_a (any . is_b is_c (not . is_d)) - -@source R -is_a <- function() { TRUE } -is_b <- function() { TRUE } -is_c <- function() { FALSE } -is_d <- function() { FALSE } - -say_hi <- function() { "hi" } -say_bi <- function() { "bi" } diff --git a/tests/backend-tests/r-loop/Makefile b/tests/backend-tests/r-loop/Makefile deleted file mode 100644 index 60d53aed..00000000 --- a/tests/backend-tests/r-loop/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout - rm -f *pdf diff --git a/tests/backend-tests/r-loop/x b/tests/backend-tests/r-loop/x deleted file mode 100755 index f96a4d96..00000000 --- a/tests/backend-tests/r-loop/x +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -morloc -x tst x.loc &> /dev/null -./manifold-nexus.py main &> /dev/null -status= -if [[ -f f-cars.pdf && -f f-iris.pdf && -f f-mtcars.pdf ]] -then - status=0 -else - status=1 -fi -rm -rf tst *pdf manifold-nexus.py - -exit $status diff --git a/tests/backend-tests/r-loop/x.loc b/tests/backend-tests/r-loop/x.loc deleted file mode 100644 index 624b08e5..00000000 --- a/tests/backend-tests/r-loop/x.loc +++ /dev/null @@ -1,57 +0,0 @@ -@path - -null:main . -map . - & (null:loop . hclust $1 . dist . normalize . load_data . $1) - (c . "iris" "cars" "mtcars") - - -@export -null:main as main - -@arg -hclust :: method="average" - - -@lang -* :: R -mv :: sh - - -@cache -hclust :: datcache - - -@5 -hclust :: plot_pdf . $1 - - -@include -core/datcache -core/atomic -core/control -core/R/common - - -@source R - -# Load a builtin R dataset and return -load_data <- function(x) { - eval(parse(text=x)) -} - -# Normalize numeric columns -normalize <- function(x) { - as.data.frame(lapply(x, function(x) (x - mean(x)) / sd(x))) -} - -columns_are_numeric <- function(x) { - all(sapply(x, is.numeric)) -} - -plot_pdf <- function(x, name){ - path <- paste0("f-", name, ".pdf") - pdf(path) - plot(x) - dev.off() -} diff --git a/tests/backend-tests/r-map/Makefile b/tests/backend-tests/r-map/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/r-map/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/r-map/x b/tests/backend-tests/r-map/x deleted file mode 100755 index 331012a2..00000000 --- a/tests/backend-tests/r-map/x +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo [1,2,3,4] diff --git a/tests/backend-tests/r-map/x.loc b/tests/backend-tests/r-map/x.loc deleted file mode 100644 index 9fe6773c..00000000 --- a/tests/backend-tests/r-map/x.loc +++ /dev/null @@ -1,6 +0,0 @@ -@include -core/control - -@path R - -map . & ( sqrt . $1 ) ( c . 1 4 9 16 ) diff --git a/tests/backend-tests/r-memcache/Makefile b/tests/backend-tests/r-memcache/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/r-memcache/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/r-memcache/x b/tests/backend-tests/r-memcache/x deleted file mode 100755 index b246572a..00000000 --- a/tests/backend-tests/r-memcache/x +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -morloc -x zzz x.loc -./manifold-nexus.py main 2>&1 | grep "this is a label" > /dev/null -status=$? -rm -rf zzz manifold-nexus.py -exit $status diff --git a/tests/backend-tests/r-memcache/x.loc b/tests/backend-tests/r-memcache/x.loc deleted file mode 100644 index c36aecf4..00000000 --- a/tests/backend-tests/r-memcache/x.loc +++ /dev/null @@ -1,28 +0,0 @@ -@include -core/memcache -core/atomic - - -@export -null as main - -@source R -require(xtable) - -@path -null . xtable . data.frame . (runif . 5) - -@lang -* :: R - -@cache -* :: memcache - -@3 -xtable :: print . -data.frame :: write . nrow . - -@arg -xtable :: label="hi, this is a label" -runif :: min=2 max=5 -print,write :: file="/dev/stderr" diff --git a/tests/backend-tests/r-open-mod/Makefile b/tests/backend-tests/r-open-mod/Makefile deleted file mode 100644 index 1c8da8c1..00000000 --- a/tests/backend-tests/r-open-mod/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout *pdf diff --git a/tests/backend-tests/r-open-mod/exp.R b/tests/backend-tests/r-open-mod/exp.R deleted file mode 100644 index 246e4224..00000000 --- a/tests/backend-tests/r-open-mod/exp.R +++ /dev/null @@ -1,106 +0,0 @@ -require(readr) - -datcache_path <- function(mid, uid=null) { - if(is.null(uid)){ - file.path("cache", paste0(mid, ".rdat")) - } else { - file.path("cache", paste0(mid, "_", uid, ".rdat")) - } -} - -# string -> bool -datcache_chk <- function(mid, uid=null) { - file.exists(datcache_path(mid, uid)) -} - -# null -> text -datcache_get <- function(mid, uid=null) { - read_rds(datcache_path(mid, uid)) -} - -# text -> text -datcache_put <- function(mid, dat, uid=null) { - write_rds(dat, datcache_path(mid, uid)) -} - -datcache_del <- function(mid, uid=null) { - file.remove(datcache_path(mid, uid)) -} - -# Load a builtin R dataset and return -load_data <- function(x) { - eval(parse(text=x)) -} - -# Normalize numeric columns -normalize <- function(x) { - as.data.frame(lapply(x, function(x) (x - mean(x)) / sd(x))) -} - -columns_are_numeric <- function(x) { - all(sapply(x, is.numeric)) -} - -plot_pdf <- function(x, name){ - path <- paste0("f-", name, ".pdf") - pdf(path) - plot(x) - dev.off() -} - -map <- function(f, x){ - lapply(x, f) -} - - - -doit_uid <- 0 - -doit <- function() { - map(wrap_m2, m7()) -} - -wrap_m2 <- function(x){ - doit_uid <<- doit_uid + 1 - m2(x, doit_uid) -} - -m2 <- function(x, uid){ - if(datcache_chk("m2", uid)){ - b <- datcache_get("m2", uid) - } else { - b <- hclust( m3(x, uid) ) - datcache_put("m2", b, uid) - m6(x, uid) - } - b -} - -m3 <- function(x, uid){ - dist(m4(x, uid)) -} - -m4 <- function(x, uid){ - if(m8(x, uid)){ - normalize( m5(x, uid) ) - } else { - warning("check failed") - NULL - } -} - -m5 <- function(x, uid){ - load_data(x) -} - -m6 <- function(x, uid){ - plot_pdf(m2(x, uid), x) -} - -m7 <- function(){ - c("cars", "mtcars") -} - -m8 <- function(x, uid){ - columns_are_numeric(m5(x, uid)) -} diff --git a/tests/backend-tests/r-open-mod/x b/tests/backend-tests/r-open-mod/x deleted file mode 100755 index 1e174459..00000000 --- a/tests/backend-tests/r-open-mod/x +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -morloc -x tst x.loc &> /dev/null -./manifold-nexus.py main &> /dev/null -status= -if [[ -f f-cars.pdf && -f f-mtcars.pdf ]] -then - status=0 -else - status=1 -fi -rm -rf tst manifold-nexus.py *pdf - -exit $status diff --git a/tests/backend-tests/r-open-mod/x.loc b/tests/backend-tests/r-open-mod/x.loc deleted file mode 100644 index 2df6f162..00000000 --- a/tests/backend-tests/r-open-mod/x.loc +++ /dev/null @@ -1,49 +0,0 @@ -@include -core/datcache -core/atomic - -@source R - -# Load a builtin R dataset and return -load_data <- function(x) { - eval(parse(text=x)) -} - -# Normalize numeric columns -normalize <- function(x) { - as.data.frame(lapply(x, function(x) (x - mean(x)) / sd(x))) -} - -columns_are_numeric <- function(x) { - all(sapply(x, is.numeric)) -} - -plot_pdf <- function(x, name){ - path <- paste0("f-", name, ".pdf") - pdf(path) - plot(x) - dev.off() -} - -map <- function(f, x){ - lapply(x, f) -} - -@path -map . - & ( null . hclust . dist . normalize . load_data . $1 ) - (c . "cars" "mtcars") - -@lang -* :: R - -@cache -hclust,dist,normalize,load_data :: datcache - -@assert -normalize :: columns_are_numeric . -dist :: not . is.null . -hclust :: not . is.null . - -@3 -hclust := plot_pdf . $1 diff --git a/tests/backend-tests/r-refer/Makefile b/tests/backend-tests/r-refer/Makefile deleted file mode 100644 index 54e737fb..00000000 --- a/tests/backend-tests/r-refer/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py max - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/r-refer/x b/tests/backend-tests/r-refer/x deleted file mode 100755 index 0add9b2e..00000000 --- a/tests/backend-tests/r-refer/x +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -locstat=0 -morloc -x zzz x.loc || locstat=1 -./manifold-nexus.py min > a || locstat=1 -./manifold-nexus.py max > b || locstat=1 - -diff a b &> /dev/null -stat=$? - -rm -rf zzz manifold-nexus.py a b - -exit $(( stat + locstat )) diff --git a/tests/backend-tests/r-refer/x.loc b/tests/backend-tests/r-refer/x.loc deleted file mode 100644 index 84bae181..00000000 --- a/tests/backend-tests/r-refer/x.loc +++ /dev/null @@ -1,21 +0,0 @@ -@comment - -The Max and Min paths should get the max and min of the same random sample - -@include -core/datcache - -@export -max -min - -@path -Well :: runif . 1 -Max :: max . -Min :: min . - -@lang -* :: R - -@cache -runif :: datcache diff --git a/tests/backend-tests/r-self-reference/x b/tests/backend-tests/r-self-reference/x deleted file mode 100755 index f4ce0c7f..00000000 --- a/tests/backend-tests/r-self-reference/x +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -morloc -x tst x.loc -./manifold-nexus.py main -status= -if [[ -f z.pdf ]] -then - status=0 -else - status=1 -fi -rm -rf tst manifold-nexus.py *pdf - -exit $status diff --git a/tests/backend-tests/r-self-reference/x.loc b/tests/backend-tests/r-self-reference/x.loc deleted file mode 100644 index 249e4eca..00000000 --- a/tests/backend-tests/r-self-reference/x.loc +++ /dev/null @@ -1,25 +0,0 @@ -@include -core/datcache -core/atomic - -@source R -pdf_hist <- function(x, path){ - pdf(path) - hist(x) - dev.off() -} - -@export -null as main - -@path -null . runif . 100 - -@lang -* :: R - -@3 -runif := pdf_hist . "z.pdf" - -@cache -runif :: datcache diff --git a/tests/backend-tests/r-sh-parallel/Makefile b/tests/backend-tests/r-sh-parallel/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/r-sh-parallel/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/r-sh-parallel/x b/tests/backend-tests/r-sh-parallel/x deleted file mode 100755 index de6b20cc..00000000 --- a/tests/backend-tests/r-sh-parallel/x +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -cat < Num -> String -mean :: [Num] -> Num -rnorm :: Int -> Num -> Num -> [Num] -seq :: Int -> Int -> [Int] - -@path -# OK, so this isn't actually parallel ... -# But just replace `map` with somthing that runs things in the background, -# and you are pure gold. -map . &( paste . $1 (mean . rnorm . 10 0 1) ) (seq . 1 3) - -@lang -* :: R -map :: sh - -@0 -paste :: set.seed . 42 - -@include -core/control diff --git a/tests/backend-tests/r-simple/Makefile b/tests/backend-tests/r-simple/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/r-simple/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/r-simple/x b/tests/backend-tests/r-simple/x deleted file mode 100755 index 0d3d8186..00000000 --- a/tests/backend-tests/r-simple/x +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo 3 diff --git a/tests/backend-tests/r-simple/x.loc b/tests/backend-tests/r-simple/x.loc deleted file mode 100644 index ba5c44b3..00000000 --- a/tests/backend-tests/r-simple/x.loc +++ /dev/null @@ -1,8 +0,0 @@ -@comment - -Same as - -R> sqrt(max(seq(1,9))) - -@path R -sqrt . max . seq . 1 9 diff --git a/tests/backend-tests/r-single-quotes/Makefile b/tests/backend-tests/r-single-quotes/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/r-single-quotes/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/r-single-quotes/x b/tests/backend-tests/r-single-quotes/x deleted file mode 100755 index d0ead07d..00000000 --- a/tests/backend-tests/r-single-quotes/x +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo '"'"''hi'"'"' diff --git a/tests/backend-tests/r-single-quotes/x.loc b/tests/backend-tests/r-single-quotes/x.loc deleted file mode 100644 index 67a2b9ab..00000000 --- a/tests/backend-tests/r-single-quotes/x.loc +++ /dev/null @@ -1,5 +0,0 @@ -@source R -say <- function(x){ x } - -@path R -say . "''hi'" diff --git a/tests/backend-tests/record/Makefile b/tests/backend-tests/record/Makefile deleted file mode 100644 index 66e1e784..00000000 --- a/tests/backend-tests/record/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout obs diff --git a/tests/backend-tests/record/x b/tests/backend-tests/record/x deleted file mode 100755 index 0aeb5247..00000000 --- a/tests/backend-tests/record/x +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -cat < exp -hi from sh -hi from py -hi from R -EOF -stat=0 -morloc -kx locout x.loc || stat=1 -./manifold-nexus.py main -diff exp obs || stat=1 - -rm -rf locout exp obs manifold-nexus.py -exit $stat diff --git a/tests/backend-tests/record/x.loc b/tests/backend-tests/record/x.loc deleted file mode 100644 index 59c66ad2..00000000 --- a/tests/backend-tests/record/x.loc +++ /dev/null @@ -1,16 +0,0 @@ -@path sh -null - -@after -null :+ record:R . 'obs' 'hi from R' -null :+ record:sh . 'obs' 'hi from sh' -null :+ record:py . 'obs' 'hi from py' - -@lang -record:R :: R -record:sh :: sh -record:py :: py - -@include -core/io -core/atomic diff --git a/tests/backend-tests/sh-all/Makefile b/tests/backend-tests/sh-all/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/sh-all/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/sh-all/x b/tests/backend-tests/sh-all/x deleted file mode 100755 index f903fd7f..00000000 --- a/tests/backend-tests/sh-all/x +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -cat << END -["allocated","augmented","connected","designed","dired","disabled","implied","interpreted","listed","omitted","permitted","prefixed","red","separated","specified"] -END diff --git a/tests/backend-tests/sh-all/x.loc b/tests/backend-tests/sh-all/x.loc deleted file mode 100644 index e21627a8..00000000 --- a/tests/backend-tests/sh-all/x.loc +++ /dev/null @@ -1,38 +0,0 @@ -@comment - -This code is equivalent to - -man ls | grep -Po "[a-z]+ed" | sort | uniq - -@type -has_man :: String -> Bool -man :: String -> [String] -grep :: [String] -> [String] -sort :: [String] -> [String] -uniq :: [String] -> [String] - -@path -uniq . sort . grep . man . "ls" - -@arg -grep := -Po -e "[a-z]+ed" -man := --no-hyphenation - -@lang -* :: sh - -@cache -sort :: datcache -man :: datcache - -@assert -man := has_man . "ls" - -@include -core/datcache - -@source sh - -has_man () { - man $1 &> /dev/null && echo true || echo false -} diff --git a/tests/backend-tests/sh-and-r/Makefile b/tests/backend-tests/sh-and-r/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/sh-and-r/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/sh-and-r/x b/tests/backend-tests/sh-and-r/x deleted file mode 100755 index 5e933b23..00000000 --- a/tests/backend-tests/sh-and-r/x +++ /dev/null @@ -1 +0,0 @@ -echo '["42"]' diff --git a/tests/backend-tests/sh-and-r/x.loc b/tests/backend-tests/sh-and-r/x.loc deleted file mode 100644 index e31a962a..00000000 --- a/tests/backend-tests/sh-and-r/x.loc +++ /dev/null @@ -1,13 +0,0 @@ -@type -seq :: Void -> [String] -grep :: String -> [String] -> [String] - -@path -grep . "42" seq - -@arg -seq := from=1 to=100 - -@lang -seq :: R -grep :: sh diff --git a/tests/backend-tests/sh-arg-and-pos/x b/tests/backend-tests/sh-arg-and-pos/x deleted file mode 100755 index a10131df..00000000 --- a/tests/backend-tests/sh-arg-and-pos/x +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -stat=0 -morloc -kx tst x.loc || stat=1 -for j in tst/*.sh; do grep -o "a" $j | wc -l | awk '{print $1}'; done -rm -rf tst manifold-nexus.py -exit $stat diff --git a/tests/backend-tests/sh-arg-and-pos/x.loc b/tests/backend-tests/sh-arg-and-pos/x.loc deleted file mode 100644 index 92baa551..00000000 --- a/tests/backend-tests/sh-arg-and-pos/x.loc +++ /dev/null @@ -1,22 +0,0 @@ -@source sh - -map () { - while read arg - do - $1 "$arg" - done < "$2" -} - -@path -map . &(cat . cut . wc . grep . $1 ) ls . `*.sh` - -@lang -* :: sh - -@arg -grep :: "a" -o -wc :: -l -cut :: --delimiter=" " --fields=1 -cat :: - --show-all - --number-nonblank diff --git a/tests/backend-tests/sh-cached/Makefile b/tests/backend-tests/sh-cached/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/sh-cached/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/sh-cached/x b/tests/backend-tests/sh-cached/x deleted file mode 100755 index 866a106b..00000000 --- a/tests/backend-tests/sh-cached/x +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -man ls | grep -Po "[a-z]+ed" | sort | uniq diff --git a/tests/backend-tests/sh-cached/x.loc b/tests/backend-tests/sh-cached/x.loc deleted file mode 100644 index fcb464ce..00000000 --- a/tests/backend-tests/sh-cached/x.loc +++ /dev/null @@ -1,18 +0,0 @@ -@comment - -This code is equivalent to - -man ls | grep -Po "[a-z]+ed" | sort | uniq - -@include -core/datcache - -@path sh -uniq . sort . grep . man - -@arg -grep := -Po "[a-z]+ed" -man := ls - -@cache -sort :: datcache diff --git a/tests/backend-tests/sh-hooks/Makefile b/tests/backend-tests/sh-hooks/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/sh-hooks/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/sh-hooks/exp.txt b/tests/backend-tests/sh-hooks/exp.txt deleted file mode 100644 index 0c64ea48..00000000 --- a/tests/backend-tests/sh-hooks/exp.txt +++ /dev/null @@ -1,6 +0,0 @@ -0 -- 2 -- - 4 -- - 5 -- 3 -1 diff --git a/tests/backend-tests/sh-hooks/x b/tests/backend-tests/sh-hooks/x deleted file mode 100755 index 1e867351..00000000 --- a/tests/backend-tests/sh-hooks/x +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -make clean &> /dev/null -make && make run 2> z -locstat=$? -diff z exp.txt -stat=$? - -make clean -rm z - -exit $(( locstat + stat )) diff --git a/tests/backend-tests/sh-hooks/x.loc b/tests/backend-tests/sh-hooks/x.loc deleted file mode 100644 index 69537e37..00000000 --- a/tests/backend-tests/sh-hooks/x.loc +++ /dev/null @@ -1,60 +0,0 @@ -@include -core/datcache -core/atomic - -@source sh - -foo () { - echo -n -} -bar () { - echo 1 -} -echoerr () { - echo $1 > /dev/stderr -} - -@path -foo . bar - -@arg -foo :: 1 - -@lang -* :: sh - -@cache -foo :: datcache - -@assert -foo :: true - -@0 -foo :: echoerr . "0" - -@1 -foo :: echoerr . "1" - -@2 -foo :: echoerr . "- 2" - -@3 -foo :: echoerr . "- 3" - -@4 -foo :: echoerr . "- - 4" - -@5 -foo :: echoerr . "- - 5" - -@6 -foo :: echoerr . "- - 6" - -@7 -foo :: echoerr . "- - 7" - -@8 -foo :: echoerr . "- 8" - -@9 -foo :: echoerr . "- 9" diff --git a/tests/backend-tests/sh-logical/Makefile b/tests/backend-tests/sh-logical/Makefile deleted file mode 100644 index 47ec1f72..00000000 --- a/tests/backend-tests/sh-logical/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py say_hi - ./manifold-nexus.py say_bi - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/sh-logical/x b/tests/backend-tests/sh-logical/x deleted file mode 100755 index 1431ccd2..00000000 --- a/tests/backend-tests/sh-logical/x +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -morloc -x zzz x.loc -./manifold-nexus.py say_hi 2> a > /dev/null -./manifold-nexus.py say_bi 2> b > /dev/null -cat a b | diff /dev/stdin <(echo hi) &> /dev/null -stat=$? -rm -rf zzz manifold-nexus.py a b -exit $stat diff --git a/tests/backend-tests/sh-logical/x.loc b/tests/backend-tests/sh-logical/x.loc deleted file mode 100644 index 36866e3f..00000000 --- a/tests/backend-tests/sh-logical/x.loc +++ /dev/null @@ -1,46 +0,0 @@ -@include -core/atomic - -@type -is_a :: Void -> Bool -is_b :: Void -> Bool -is_c :: Void -> Bool -is_d :: Void -> Bool -say_hi :: Void -> String -say_bi :: Void -> String - -@export -say_hi -say_bi - -@source sh - -is_a () { - echo true -} -is_b () { - echo true -} -is_c () { - echo false -} -is_d () { - echo false -} - -say_hi () { - echo "hi" > /dev/stderr -} -say_bi () { - echo "bi" > /dev/stderr -} - -@lang -* :: sh - -@path -say_hi say_bi - -@assert -say_hi :: and . is_a (any . is_b is_c (not . is_d)) -say_bi :: not . and . is_a (any . is_b is_c (not . is_d)) diff --git a/tests/backend-tests/sh-loop/Makefile b/tests/backend-tests/sh-loop/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/sh-loop/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/sh-loop/x b/tests/backend-tests/sh-loop/x deleted file mode 100755 index 34f27390..00000000 --- a/tests/backend-tests/sh-loop/x +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -morloc -kx tst x.loc - -for j in manifold-nexus.py x.loc -do - grep -o "a" $j | wc -l | cut --delimiter=" " --fields=1 -done diff --git a/tests/backend-tests/sh-loop/x.loc b/tests/backend-tests/sh-loop/x.loc deleted file mode 100644 index 9a89e9e7..00000000 --- a/tests/backend-tests/sh-loop/x.loc +++ /dev/null @@ -1,19 +0,0 @@ -@source sh - -map () { - while read arg - do - $1 "$arg" - done < "$2" -} - -@path -map . &(cat . cut . wc . grep . $1 ) ls . `*loc` `*py` - -@lang -* :: sh - -@arg -grep :: "a" -o -wc :: -l -cut :: --delimiter=" " --fields=1 diff --git a/tests/backend-tests/sh-map/Makefile b/tests/backend-tests/sh-map/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/sh-map/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/sh-map/x b/tests/backend-tests/sh-map/x deleted file mode 100755 index c6a708eb..00000000 --- a/tests/backend-tests/sh-map/x +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo '["1 1","2 2","3 3","4 4","5 5"]' diff --git a/tests/backend-tests/sh-map/x.loc b/tests/backend-tests/sh-map/x.loc deleted file mode 100644 index d78cd1d5..00000000 --- a/tests/backend-tests/sh-map/x.loc +++ /dev/null @@ -1,11 +0,0 @@ -@include -core/control - -@type -echo :: ? -> String -seq :: Int -> Int -> [Int] -map :: (Int -> String) -> [Int] -> [String] - -@path sh - -map . & ( echo . $1 $1 ) ( seq . 1 5 ) diff --git a/tests/backend-tests/sh-open-mod/Makefile b/tests/backend-tests/sh-open-mod/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/sh-open-mod/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/sh-open-mod/books-1.xml b/tests/backend-tests/sh-open-mod/books-1.xml deleted file mode 100644 index 88da5022..00000000 --- a/tests/backend-tests/sh-open-mod/books-1.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - -Corets, Eva -The Sundered Grail -Fantasy -5.95 -2001-09-10 -The two daughters of Maeve, half-sisters, -battle one another for control of England. Sequel to -Oberon's Legacy. - - -Randall, Cynthia -Lover Birds -Romance -4.95 -2000-09-02 -When Carla meets Paul at an ornithology -conference, tempers fly as feathers get ruffled. - - -Thurman, Paula -Splish Splash -Romance -4.95 -2000-11-02 -A deep sea diver finds true love twenty -thousand leagues beneath the sea. - - -Knorr, Stefan -Creepy Crawlies -Horror -4.95 -2000-12-06 -An anthology of horror stories about roaches, -centipedes, scorpions and other insects. - - -Kress, Peter -Paradox Lost -Science Fiction -6.95 -2000-11-02 -After an inadvertant trip through a Heisenberg -Uncertainty Device, James Salway discovers the problems -of being quantum. - - -O'Brien, Tim -Microsoft .NET: The Programming Bible -Computer -36.95 -2000-12-09 -Microsoft's .NET initiative is explored in -detail in this deep programmer's reference. - - -O'Brien, Tim -MSXML3: A Comprehensive Guide -Computer -36.95 -2000-12-01 -The Microsoft MSXML3 parser is covered in -detail, with attention to XML DOM interfaces, XSLT processing, -SAX and more. - - -Galos, Mike -Visual Studio 7: A Comprehensive Guide -Computer -49.95 -2001-04-16 -Microsoft Visual Studio 7 is explored in depth, -looking at how Visual Basic, Visual C++, C#, and ASP+ are -integrated into a comprehensive development -environment. - - diff --git a/tests/backend-tests/sh-open-mod/books-2.xml b/tests/backend-tests/sh-open-mod/books-2.xml deleted file mode 100644 index db1dd1d4..00000000 --- a/tests/backend-tests/sh-open-mod/books-2.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - -Gambardella, Matthew -XML Developer's Guide -Computer -44.95 -2000-10-01 -An in-depth look at creating applications -with XML. - - -Ralls, Kim -Midnight Rain -Fantasy -5.95 -2000-12-16 -A former architect battles corporate zombies, -an evil sorceress, and her own childhood to become queen -of the world. - - -Corets, Eva -Maeve Ascendant -Fantasy -5.95 -2000-11-17 -After the collapse of a nanotechnology -society in England, the young survivors lay the -foundation for a new society. - - -Corets, Eva -Oberon's Legacy -Fantasy -5.95 -2001-03-10 -In post-apocalypse England, the mysterious -agent known only as Oberon helps to create a new life -for the inhabitants of London. Sequel to Maeve -Ascendant. - - -Corets, Eva -The Sundered Grail -Fantasy -5.95 -2001-09-10 -The two daughters of Maeve, half-sisters, -battle one another for control of England. Sequel to -Oberon's Legacy. - - diff --git a/tests/backend-tests/sh-open-mod/exp.txt b/tests/backend-tests/sh-open-mod/exp.txt deleted file mode 100644 index 23598e46..00000000 --- a/tests/backend-tests/sh-open-mod/exp.txt +++ /dev/null @@ -1,14 +0,0 @@ - - 0 - - - 2 - - - - 4 - - - 3 - - 1 -8 - - 0 - - - 2 - - - - 4 - - - 3 - - 1 -5 -8 -5 diff --git a/tests/backend-tests/sh-open-mod/x b/tests/backend-tests/sh-open-mod/x deleted file mode 100755 index d85db553..00000000 --- a/tests/backend-tests/sh-open-mod/x +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -morloc -x zzz x.loc -./manifold-nexus.py main 2> obs.txt - -diff obs.txt exp.txt -stat=$? - -rm -rf zzz obs.txt manifold-nexus.py -exit $stat diff --git a/tests/backend-tests/sh-open-mod/x.loc b/tests/backend-tests/sh-open-mod/x.loc deleted file mode 100644 index ca1af684..00000000 --- a/tests/backend-tests/sh-open-mod/x.loc +++ /dev/null @@ -1,50 +0,0 @@ -@include -core/control -core/atomic -core/datcache - -@path - -null . map . & ( cat . wc . grep . $1 ) ls . `*.xml` - - -@export -null as main -map - -@arg -grep :: "author" -wc :: -l -cut:wc :: -d=' ' -f=1 -cut:map :: -d=' ' -f=1 - -@cache -map,grep,wc :: datcache - -@0 -grep :: echo . " - 0" - -@8 -grep :: echo . " - - 8" - -@9 -grep :: echo . " - - 9" - -@2 -grep :: echo . " - - 2" - -@4 -grep :: echo . " - - - 4" - -@5 -wc :: cut:wc . cat . -map :: cut:map . cat . - -@3 -grep :: echo . " - - 3" - -@1 -grep :: echo . " - 1" - -@lang -* :: sh diff --git a/tests/backend-tests/sh-race/x b/tests/backend-tests/sh-race/x deleted file mode 100755 index 1bfb4b67..00000000 --- a/tests/backend-tests/sh-race/x +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -tst/manifold-nexus.sh cat diff --git a/tests/backend-tests/sh-race/x.loc b/tests/backend-tests/sh-race/x.loc deleted file mode 100644 index 1bef2929..00000000 --- a/tests/backend-tests/sh-race/x.loc +++ /dev/null @@ -1,18 +0,0 @@ -@source sh - -random () { - echo $RANDOM -} - -@include -core/datcache - -@export -cat - -@path sh -R :: random -A :: cat . - -@cache -random :: datcache diff --git a/tests/backend-tests/sh-refer/x b/tests/backend-tests/sh-refer/x deleted file mode 100755 index 211bfc8b..00000000 --- a/tests/backend-tests/sh-refer/x +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -locstat=0 -morloc -x zzz x.loc || locstat=1 -./manifold-nexus.py tail > a || locstat=1 -./manifold-nexus.py head > b || locstat=1 - -diff a b &> /dev/null -stat=$? - -rm -rf zzz manifold-nexus.py a b - -exit $(( stat + locstat )) diff --git a/tests/backend-tests/sh-refer/x.loc b/tests/backend-tests/sh-refer/x.loc deleted file mode 100644 index fdacac88..00000000 --- a/tests/backend-tests/sh-refer/x.loc +++ /dev/null @@ -1,25 +0,0 @@ -@source sh - -random () { - echo $RANDOM -} - -@include -core/datcache - -@export -tail -head - -@path -random - -# These both give the same output, since is one-line long -A :: head . -B :: tail . - -@lang -* :: sh - -@cache -random :: datcache diff --git a/tests/backend-tests/sh-simple/Makefile b/tests/backend-tests/sh-simple/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/backend-tests/sh-simple/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/sh-simple/x b/tests/backend-tests/sh-simple/x deleted file mode 100755 index f903fd7f..00000000 --- a/tests/backend-tests/sh-simple/x +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -cat << END -["allocated","augmented","connected","designed","dired","disabled","implied","interpreted","listed","omitted","permitted","prefixed","red","separated","specified"] -END diff --git a/tests/backend-tests/sh-simple/x.loc b/tests/backend-tests/sh-simple/x.loc deleted file mode 100644 index 2bbd41dc..00000000 --- a/tests/backend-tests/sh-simple/x.loc +++ /dev/null @@ -1,18 +0,0 @@ -@comment - -This code is equivalent to - -man ls | grep -Po "[a-z]+ed" | sort | uniq - -@type -man :: String -> [String] -uniq , -sort , -grep :: [String] -> [String] - -@path sh -uniq . sort . grep . man . "ls" - -@arg -grep := -Po "[a-z]+ed" -man := --no-hyphenation diff --git a/tests/backend-tests/table-ops/Makefile b/tests/backend-tests/table-ops/Makefile deleted file mode 100644 index ec97b971..00000000 --- a/tests/backend-tests/table-ops/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py R - ./manifold-nexus.py py - ./manifold-nexus.py sh - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/backend-tests/table-ops/data.tab b/tests/backend-tests/table-ops/data.tab deleted file mode 100644 index 14c2e9dc..00000000 --- a/tests/backend-tests/table-ops/data.tab +++ /dev/null @@ -1,3 +0,0 @@ -1 a -2 b -3 c diff --git a/tests/backend-tests/table-ops/x b/tests/backend-tests/table-ops/x deleted file mode 100755 index 4b5e62af..00000000 --- a/tests/backend-tests/table-ops/x +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -cat < z -[1,2,3] -1 -2 -3 -[1, 2, 3] -EOF -stat=0 -morloc -kx locout x.loc || stat=1 -./manifold-nexus.py R > y -./manifold-nexus.py sh >> y -./manifold-nexus.py py >> y -diff z y || stat=1 -rm -rf locout z y manifold-nexus.py -exit $stat diff --git a/tests/backend-tests/table-ops/x.loc b/tests/backend-tests/table-ops/x.loc deleted file mode 100644 index a14d7ff9..00000000 --- a/tests/backend-tests/table-ops/x.loc +++ /dev/null @@ -1,18 +0,0 @@ -@path -nthcol:R -nthcol:py -nthcol:sh . 1 read_table . 'data.tab' - -@export -nthcol:R as R -nthcol:py as py -nthcol:sh as sh - -@lang -nthcol:sh :: sh -nthcol:R :: R -nthcol:py :: py -read_table :: R - -@include -core/table diff --git a/tests/bugs/star-effects/README.md b/tests/bugs/star-effects/README.md deleted file mode 100644 index e6107b11..00000000 --- a/tests/bugs/star-effects/README.md +++ /dev/null @@ -1,18 +0,0 @@ -Stars lead to self-reference. - -For example: - -``` -@path -foo - -@hook -* :: hahaha -``` - -The hook `hahaha` calls the hook `hahaha`, forever - -Possible solutions: - 1. only apply the rhs to manifolds in @path section. - 2. apply to all manifolds other than self - 3. allow infinite loops: it's a feature, not a bug diff --git a/tests/bugs/star-effects/x.loc b/tests/bugs/star-effects/x.loc deleted file mode 100644 index ee476d98..00000000 --- a/tests/bugs/star-effects/x.loc +++ /dev/null @@ -1,5 +0,0 @@ -@path -foo - -@3 -* :: hahaha diff --git a/tests/cases/sh-open-mod/Makefile b/tests/cases/sh-open-mod/Makefile deleted file mode 100644 index d804521d..00000000 --- a/tests/cases/sh-open-mod/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - loc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/cases/sh-open-mod/books-1.xml b/tests/cases/sh-open-mod/books-1.xml deleted file mode 100644 index 88da5022..00000000 --- a/tests/cases/sh-open-mod/books-1.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - -Corets, Eva -The Sundered Grail -Fantasy -5.95 -2001-09-10 -The two daughters of Maeve, half-sisters, -battle one another for control of England. Sequel to -Oberon's Legacy. - - -Randall, Cynthia -Lover Birds -Romance -4.95 -2000-09-02 -When Carla meets Paul at an ornithology -conference, tempers fly as feathers get ruffled. - - -Thurman, Paula -Splish Splash -Romance -4.95 -2000-11-02 -A deep sea diver finds true love twenty -thousand leagues beneath the sea. - - -Knorr, Stefan -Creepy Crawlies -Horror -4.95 -2000-12-06 -An anthology of horror stories about roaches, -centipedes, scorpions and other insects. - - -Kress, Peter -Paradox Lost -Science Fiction -6.95 -2000-11-02 -After an inadvertant trip through a Heisenberg -Uncertainty Device, James Salway discovers the problems -of being quantum. - - -O'Brien, Tim -Microsoft .NET: The Programming Bible -Computer -36.95 -2000-12-09 -Microsoft's .NET initiative is explored in -detail in this deep programmer's reference. - - -O'Brien, Tim -MSXML3: A Comprehensive Guide -Computer -36.95 -2000-12-01 -The Microsoft MSXML3 parser is covered in -detail, with attention to XML DOM interfaces, XSLT processing, -SAX and more. - - -Galos, Mike -Visual Studio 7: A Comprehensive Guide -Computer -49.95 -2001-04-16 -Microsoft Visual Studio 7 is explored in depth, -looking at how Visual Basic, Visual C++, C#, and ASP+ are -integrated into a comprehensive development -environment. - - diff --git a/tests/cases/sh-open-mod/books-2.xml b/tests/cases/sh-open-mod/books-2.xml deleted file mode 100644 index db1dd1d4..00000000 --- a/tests/cases/sh-open-mod/books-2.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - -Gambardella, Matthew -XML Developer's Guide -Computer -44.95 -2000-10-01 -An in-depth look at creating applications -with XML. - - -Ralls, Kim -Midnight Rain -Fantasy -5.95 -2000-12-16 -A former architect battles corporate zombies, -an evil sorceress, and her own childhood to become queen -of the world. - - -Corets, Eva -Maeve Ascendant -Fantasy -5.95 -2000-11-17 -After the collapse of a nanotechnology -society in England, the young survivors lay the -foundation for a new society. - - -Corets, Eva -Oberon's Legacy -Fantasy -5.95 -2001-03-10 -In post-apocalypse England, the mysterious -agent known only as Oberon helps to create a new life -for the inhabitants of London. Sequel to Maeve -Ascendant. - - -Corets, Eva -The Sundered Grail -Fantasy -5.95 -2001-09-10 -The two daughters of Maeve, half-sisters, -battle one another for control of England. Sequel to -Oberon's Legacy. - - diff --git a/tests/cases/sh-open-mod/x b/tests/cases/sh-open-mod/x deleted file mode 100755 index 3e5ddcbc..00000000 --- a/tests/cases/sh-open-mod/x +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -xmlstarlet sel -t -m "catalog/book" -v "author" -n -b *xml diff --git a/tests/cases/sh-open-mod/x.loc b/tests/cases/sh-open-mod/x.loc deleted file mode 100644 index f9b88170..00000000 --- a/tests/cases/sh-open-mod/x.loc +++ /dev/null @@ -1,39 +0,0 @@ -@include -core/control -core/atomic -core/datcache - -@path -null . map . & ( xmlstarlet:sel . xmlstarlet:fo . $1 ) ls . `*.xml` - -@arg -xmlstarlet:sel :: - sel - --template - --match="catalog/book" - --value-of="author" - --nl - --break - -xmlstarlet:fo :: fo - -ponysay:1 :: --pony=twilight - -@cache -map,ls :: datcache - -@0 -null :: cp . `../*.xml` `.` - -@4 -xmlstarlet:f0 :: echo . "Reading" $1 - -@5 -map :: cat . - -@1 -null :: rm . `-f` `*.xml` -null :: ponysay:1 . "all done" - -@lang -* :: sh diff --git a/tests/error-tests/missing-reference/README.md b/tests/error-tests/missing-reference/README.md deleted file mode 100644 index c9884ac9..00000000 --- a/tests/error-tests/missing-reference/README.md +++ /dev/null @@ -1,2 +0,0 @@ -I currently have several holes in error handling. One of them is that when -a deref matches nothing, the program segfaults without comment. diff --git a/tests/error-tests/missing-reference/x b/tests/error-tests/missing-reference/x deleted file mode 100755 index 0a2a6509..00000000 --- a/tests/error-tests/missing-reference/x +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/bash - -morloc -l x.loc diff --git a/tests/error-tests/missing-reference/x.loc b/tests/error-tests/missing-reference/x.loc deleted file mode 100644 index 01f06a53..00000000 --- a/tests/error-tests/missing-reference/x.loc +++ /dev/null @@ -1,2 +0,0 @@ -@path -foo . diff --git a/tests/frontend-tests/advice/x.lil b/tests/frontend-tests/advice/x.lil deleted file mode 100644 index d5cb704c..00000000 --- a/tests/frontend-tests/advice/x.lil +++ /dev/null @@ -1,11 +0,0 @@ -EMIT m0 * -FUNC m0 foo -TYPE m0 * -HOOK m0 4 m1 -HOOK m0 5 m2 -EMIT m1 * -FUNC m1 before_effect -TYPE m1 * -EMIT m2 * -FUNC m2 after_effect -TYPE m2 * diff --git a/tests/frontend-tests/advice/x.loc b/tests/frontend-tests/advice/x.loc deleted file mode 100644 index 1a995001..00000000 --- a/tests/frontend-tests/advice/x.loc +++ /dev/null @@ -1,8 +0,0 @@ -@path -foo - -@before -foo :: before_effect - -@after -foo :: after_effect diff --git a/tests/frontend-tests/args/x.lil b/tests/frontend-tests/args/x.lil deleted file mode 100644 index d2a3b455..00000000 --- a/tests/frontend-tests/args/x.lil +++ /dev/null @@ -1,12 +0,0 @@ -EMIT m0 * -FUNC m0 g -TYPE m0 Void -INPM m0 0 m1 A -FARG m0 0 b -FARG m0 1 bar -FARG m0 2 -f -FARG m0 3 --far "out in the boonies" -FARG m0 4 x 1 2 'three and a half' -EMIT m1 * -FUNC m1 f -TYPE m1 A diff --git a/tests/frontend-tests/args/x.loc b/tests/frontend-tests/args/x.loc deleted file mode 100644 index 7a7123ba..00000000 --- a/tests/frontend-tests/args/x.loc +++ /dev/null @@ -1,14 +0,0 @@ -@type -f :: Void -> A -g :: A -> Void - -@path -foo :: g . f - -@arg -g := a=0 -g := b # this overwrites a=0 -g :+ bar -g :+ -f -g :+ --far="out in the boonies" -g :+ x=[1,2,'three and a half'] diff --git a/tests/frontend-tests/complex-types/x.lil b/tests/frontend-tests/complex-types/x.lil deleted file mode 100644 index 99d2e706..00000000 --- a/tests/frontend-tests/complex-types/x.lil +++ /dev/null @@ -1,19 +0,0 @@ -EMIT m0 * -FUNC m0 map -TYPE m0 [Num] -INPF m0 0 m1 (Int->Num) -INPM m0 1 m2 [Int] -EMIT m1 * -FUNC m1 squ -TYPE m1 Num -NARG m1 1 -INPA m1 0 1 Int -EMIT m2 * -FUNC m2 yolo -TYPE m2 [Int] -INPM m2 0 m3 [Int] -EMIT m3 * -FUNC m3 seq -TYPE m3 [Int] -INPP m3 0 1 Int -INPP m3 1 5 Int diff --git a/tests/frontend-tests/complex-types/x.loc b/tests/frontend-tests/complex-types/x.loc deleted file mode 100644 index 50165fb9..00000000 --- a/tests/frontend-tests/complex-types/x.loc +++ /dev/null @@ -1,8 +0,0 @@ -@type -map :: (a -> b) -> [a] -> [b] -squ :: Int -> Num -yolo :: a -> [a] -seq :: Int -> Int -> [Int] - -@path -map . &( squ . $1 ) (yolo . seq . 1 5) diff --git a/tests/frontend-tests/deep-path/x.lil b/tests/frontend-tests/deep-path/x.lil deleted file mode 100644 index fd4eff57..00000000 --- a/tests/frontend-tests/deep-path/x.lil +++ /dev/null @@ -1,22 +0,0 @@ -EMIT m0 * -FUNC m0 foo -TYPE m0 * -INPM m0 0 m4 * -EMIT m4 * -FUNC m4 fifi -TYPE m4 * -INPM m4 0 m5 * -EMIT m5 * -FUNC m5 foo -TYPE m5 * -HOOK m5 5 m3 -EMIT m1 * -FUNC m1 fifi -TYPE m1 * -INPM m1 0 m2 * -EMIT m2 * -FUNC m2 foo -TYPE m2 * -EMIT m3 * -FUNC m3 a_foo -TYPE m3 * diff --git a/tests/frontend-tests/deep-path/x.loc b/tests/frontend-tests/deep-path/x.loc deleted file mode 100644 index 41956d19..00000000 --- a/tests/frontend-tests/deep-path/x.loc +++ /dev/null @@ -1,6 +0,0 @@ -@path -A :: foo:1 . *B -B :: fifi:2 . foo:2 - -@5 -A/B/foo := a_foo diff --git a/tests/frontend-tests/deref-mod/x.lil b/tests/frontend-tests/deref-mod/x.lil deleted file mode 100644 index 2e79f9ae..00000000 --- a/tests/frontend-tests/deref-mod/x.lil +++ /dev/null @@ -1,36 +0,0 @@ -EMIT m0 igpay -FUNC m0 map -TYPE m0 * -INPF m0 0 m1 * -INPM m0 1 m3 * -HOOK m0 5 m6 -EMIT m1 igpay -FUNC m1 f -TYPE m1 * -NARG m1 1 -INPM m1 0 m2 * -HOOK m1 5 m4 -EMIT m2 igpay -FUNC m2 g -TYPE m2 * -NARG m2 1 -INPA m2 0 1 * -EMIT m3 igpay -FUNC m3 foo -TYPE m3 * -EMIT m4 igpay -FUNC m4 a -TYPE m4 * -NARG m4 1 -INPM m4 0 m5 * -EMIT m5 igpay -FUNC m5 b -TYPE m5 * -NARG m5 1 -EMIT m6 igpay -FUNC m6 c -TYPE m6 * -INPM m6 0 m7 * -EMIT m7 igpay -FUNC m7 d -TYPE m7 * diff --git a/tests/frontend-tests/deref-mod/x.loc b/tests/frontend-tests/deref-mod/x.loc deleted file mode 100644 index 20ec646b..00000000 --- a/tests/frontend-tests/deref-mod/x.loc +++ /dev/null @@ -1,10 +0,0 @@ -@path - -map . &(f . g . $1) foo - -@lang -* :: igpay - -@5 -f :: a . b -map :: c . d diff --git a/tests/frontend-tests/deref/x.lil b/tests/frontend-tests/deref/x.lil deleted file mode 100644 index c2fe1879..00000000 --- a/tests/frontend-tests/deref/x.lil +++ /dev/null @@ -1,18 +0,0 @@ -EMIT m0 igpay -FUNC m0 map -TYPE m0 * -INPF m0 0 m1 * -INPM m0 1 m3 * -EMIT m1 igpay -FUNC m1 f -TYPE m1 * -NARG m1 1 -INPM m1 0 m2 * -EMIT m2 igpay -FUNC m2 g -TYPE m2 * -NARG m2 1 -INPA m2 0 1 * -EMIT m3 igpay -FUNC m3 foo -TYPE m3 * diff --git a/tests/frontend-tests/deref/x.loc b/tests/frontend-tests/deref/x.loc deleted file mode 100644 index 5769feab..00000000 --- a/tests/frontend-tests/deref/x.loc +++ /dev/null @@ -1,6 +0,0 @@ -@path - -map . &(f . g . $1) foo - -@lang -* :: igpay diff --git a/tests/frontend-tests/elements/x.lil b/tests/frontend-tests/elements/x.lil deleted file mode 100644 index ee5ebaf1..00000000 --- a/tests/frontend-tests/elements/x.lil +++ /dev/null @@ -1,54 +0,0 @@ -EMIT m0 * -FUNC m0 _alias -TYPE m0 Void -INPM m0 0 m1 A -CHEK m0 m2 -HOOK m0 0 m3 -HOOK m0 1 m4 -HOOK m0 2 m5 -HOOK m0 3 m6 -HOOK m0 4 m7 -HOOK m0 5 m8 -HOOK m0 6 m9 -HOOK m0 7 m10 -HOOK m0 8 m11 -HOOK m0 9 m12 -CACH m0 _cache -FARG m0 0 x 1 -FARG m0 1 y 2 -EMIT m1 * -FUNC m1 f -TYPE m1 A -EMIT m2 * -FUNC m2 _check -TYPE m2 * -EMIT m3 * -FUNC m3 _hook0 -TYPE m3 * -EMIT m4 * -FUNC m4 _hook1 -TYPE m4 * -EMIT m5 * -FUNC m5 _hook2 -TYPE m5 * -EMIT m6 * -FUNC m6 _hook3 -TYPE m6 * -EMIT m7 * -FUNC m7 _hook4 -TYPE m7 * -EMIT m8 * -FUNC m8 _hook5 -TYPE m8 * -EMIT m9 * -FUNC m9 _hook6 -TYPE m9 * -EMIT m10 * -FUNC m10 _hook7 -TYPE m10 * -EMIT m11 * -FUNC m11 _hook8 -TYPE m11 * -EMIT m12 * -FUNC m12 _hook9 -TYPE m12 * diff --git a/tests/frontend-tests/elements/x.loc b/tests/frontend-tests/elements/x.loc deleted file mode 100644 index 5e247444..00000000 --- a/tests/frontend-tests/elements/x.loc +++ /dev/null @@ -1,56 +0,0 @@ -@comment - -This script is a simple test of to ensure all required simple manifold elements -are present. There are many nuances to the behavior of these modifiers, but -they are not tested here. - -It does not check the compositional sections effect, _hook, and check - -@type -f :: Void -> A -g :: A -> Void - -@path -foo :: g . f - -@cache -g :: _cache - -@assert -g :: _check - -@alias -g :: _alias - -@arg -g :+ x=1 y=2 - -@0 -g :: _hook0 - -@1 -g :: _hook1 - -@2 -g :: _hook2 - -@3 -g :: _hook3 - -@4 -g :: _hook4 - -@5 -g :: _hook5 - -@6 -g :: _hook6 - -@7 -g :: _hook7 - -@8 -g :: _hook8 - -@9 -g :: _hook9 diff --git a/tests/frontend-tests/export-path/x.lil b/tests/frontend-tests/export-path/x.lil deleted file mode 100644 index 2cd9e582..00000000 --- a/tests/frontend-tests/export-path/x.lil +++ /dev/null @@ -1,20 +0,0 @@ -EMIT m0 * -FUNC m0 g -TYPE m0 * -INPM m0 0 m3 * -EMIT m3 * -FUNC m3 g -TYPE m3 * -INPM m3 0 m4 * -EMIT m4 * -FUNC m4 f -TYPE m4 * -EMIT m1 * -FUNC m1 g -TYPE m1 * -INPM m1 0 m2 * -EMIT m2 * -FUNC m2 f -TYPE m2 * -EXPT m0 main -EXPT m2 second diff --git a/tests/frontend-tests/export-path/x.loc b/tests/frontend-tests/export-path/x.loc deleted file mode 100644 index b6badf38..00000000 --- a/tests/frontend-tests/export-path/x.loc +++ /dev/null @@ -1,7 +0,0 @@ -@export -A/g as main -B/f as second - -@path -A :: g . *B -B :: g . f diff --git a/tests/frontend-tests/generics_1/x.lil b/tests/frontend-tests/generics_1/x.lil deleted file mode 100644 index 914564a0..00000000 --- a/tests/frontend-tests/generics_1/x.lil +++ /dev/null @@ -1,7 +0,0 @@ -EMIT m0 * -FUNC m0 foo -TYPE m0 Int -INPM m0 0 m1 Int -EMIT m1 * -FUNC m1 bar -TYPE m1 Int diff --git a/tests/frontend-tests/generics_1/x.loc b/tests/frontend-tests/generics_1/x.loc deleted file mode 100644 index 39376fbb..00000000 --- a/tests/frontend-tests/generics_1/x.loc +++ /dev/null @@ -1,6 +0,0 @@ -@type -foo :: a -> a -bar :: Void -> Int - -@path -foo . bar diff --git a/tests/frontend-tests/generics_2/x.lil b/tests/frontend-tests/generics_2/x.lil deleted file mode 100644 index ff9b3d91..00000000 --- a/tests/frontend-tests/generics_2/x.lil +++ /dev/null @@ -1,7 +0,0 @@ -EMIT m0 * -FUNC m0 foo -TYPE m0 (Int->[Int]) -INPM m0 0 m1 Int -EMIT m1 * -FUNC m1 bar -TYPE m1 Int diff --git a/tests/frontend-tests/generics_2/x.loc b/tests/frontend-tests/generics_2/x.loc deleted file mode 100644 index 432bd795..00000000 --- a/tests/frontend-tests/generics_2/x.loc +++ /dev/null @@ -1,6 +0,0 @@ -@type -foo :: a -> (a -> [a]) -bar :: void -> Int - -@path -foo . bar diff --git a/tests/frontend-tests/generics_3/x.lil b/tests/frontend-tests/generics_3/x.lil deleted file mode 100644 index 38d98795..00000000 --- a/tests/frontend-tests/generics_3/x.lil +++ /dev/null @@ -1,4 +0,0 @@ -EMIT m0 * -FUNC m0 foo -TYPE m0 Int -INPP m0 0 7 Int diff --git a/tests/frontend-tests/generics_3/x.loc b/tests/frontend-tests/generics_3/x.loc deleted file mode 100644 index 98dc433f..00000000 --- a/tests/frontend-tests/generics_3/x.loc +++ /dev/null @@ -1,5 +0,0 @@ -@type -foo :: a -> a - -@path -foo . 7 diff --git a/tests/frontend-tests/generics_4/x.lil b/tests/frontend-tests/generics_4/x.lil deleted file mode 100644 index 0a729486..00000000 --- a/tests/frontend-tests/generics_4/x.lil +++ /dev/null @@ -1,16 +0,0 @@ -EMIT m0 * -FUNC m0 fiz -TYPE m0 (Int,[Int]) -INPM m0 0 m1 Int -EMIT m1 * -FUNC m1 baz -TYPE m1 Int -INPM m1 0 m2 Int -EMIT m2 * -FUNC m2 bar -TYPE m2 Int -INPM m2 0 m3 Int -EMIT m3 * -FUNC m3 foo -TYPE m3 Int -INPP m3 0 7 Int diff --git a/tests/frontend-tests/generics_4/x.loc b/tests/frontend-tests/generics_4/x.loc deleted file mode 100644 index a625a8fd..00000000 --- a/tests/frontend-tests/generics_4/x.loc +++ /dev/null @@ -1,8 +0,0 @@ -@type -foo :: a -> a -bar :: b -> b -baz :: c -> c -fiz :: d -> (d,[d]) - -@path -fiz . baz . bar . foo . 7 diff --git a/tests/frontend-tests/generics_5/x.lil b/tests/frontend-tests/generics_5/x.lil deleted file mode 100644 index 8aad5b7c..00000000 --- a/tests/frontend-tests/generics_5/x.lil +++ /dev/null @@ -1,17 +0,0 @@ -EMIT m0 * -FUNC m0 baz -TYPE m0 [(Int,Int)] -INPM m0 0 m1 (Int,Int) -EMIT m1 * -FUNC m1 bar -TYPE m1 (Int,Int) -INPM m1 0 m2 (Int,Int) -EMIT m2 * -FUNC m2 bad -TYPE m2 (Int,Int) -INPM m2 0 m3 (Int,Int) -EMIT m3 * -FUNC m3 foo -TYPE m3 (Int,Int) -INPP m3 0 1 Int -INPP m3 1 2 Int diff --git a/tests/frontend-tests/generics_5/x.loc b/tests/frontend-tests/generics_5/x.loc deleted file mode 100644 index ee06e6ca..00000000 --- a/tests/frontend-tests/generics_5/x.loc +++ /dev/null @@ -1,21 +0,0 @@ -@type -foo :: a -> b -> (a, a) -bar :: a -> a -baz :: (c, d) -> [(c,d)] - -@path -baz . bar . bad . foo . 1 2 - -@comment -the following should be a type error: - - baz :: (c, d, e) -> void - -since (a,b) !== (a,b,c), the structures are different - -but (a,b) == (a,(b,c)), where b == (b,c) - -In the above, the following resolved signatures should obtain: - foo :: A -> B -> (A, B) - bar :: (A, B) -> (A, B) - baz :: (A, B) -> [(A, B)] diff --git a/tests/frontend-tests/grpref/x.lil b/tests/frontend-tests/grpref/x.lil deleted file mode 100644 index 8bc3df9d..00000000 --- a/tests/frontend-tests/grpref/x.lil +++ /dev/null @@ -1,10 +0,0 @@ -EMIT m0 * -FUNC m0 f -TYPE m0 * -INPM m0 0 m2 * -EMIT m2 * -FUNC m2 g -TYPE m2 * -EMIT m1 * -FUNC m1 g -TYPE m1 * diff --git a/tests/frontend-tests/grpref/x.loc b/tests/frontend-tests/grpref/x.loc deleted file mode 100644 index 97154536..00000000 --- a/tests/frontend-tests/grpref/x.loc +++ /dev/null @@ -1,3 +0,0 @@ -@path -f . *A -A :: g diff --git a/tests/frontend-tests/include/x-lib.loc b/tests/frontend-tests/include/x-lib.loc deleted file mode 100644 index 2c2f82d7..00000000 --- a/tests/frontend-tests/include/x-lib.loc +++ /dev/null @@ -1,3 +0,0 @@ -@type -g :: A -> Void -f :: Void -> A diff --git a/tests/frontend-tests/include/x.lil b/tests/frontend-tests/include/x.lil deleted file mode 100644 index 87e65e21..00000000 --- a/tests/frontend-tests/include/x.lil +++ /dev/null @@ -1,7 +0,0 @@ -EMIT m0 * -FUNC m0 g -TYPE m0 Void -INPM m0 0 m1 A -EMIT m1 * -FUNC m1 f -TYPE m1 A diff --git a/tests/frontend-tests/include/x.loc b/tests/frontend-tests/include/x.loc deleted file mode 100644 index 327991aa..00000000 --- a/tests/frontend-tests/include/x.loc +++ /dev/null @@ -1,5 +0,0 @@ -@include -x-lib - -@path -F :: g . f diff --git a/tests/frontend-tests/infer-star/x.lil b/tests/frontend-tests/infer-star/x.lil deleted file mode 100644 index 3d802778..00000000 --- a/tests/frontend-tests/infer-star/x.lil +++ /dev/null @@ -1,11 +0,0 @@ -EMIT m0 * -FUNC m0 foo -TYPE m0 Void -INPM m0 0 m1 A -EMIT m1 * -FUNC m1 bar -TYPE m1 A -INPM m1 0 m2 B -EMIT m2 * -FUNC m2 baz -TYPE m2 B diff --git a/tests/frontend-tests/infer-star/x.loc b/tests/frontend-tests/infer-star/x.loc deleted file mode 100644 index 9d24949e..00000000 --- a/tests/frontend-tests/infer-star/x.loc +++ /dev/null @@ -1,7 +0,0 @@ -@type -foo :: * -> Void -bar :: B -> A -baz :: Void -> * - -@path -foo . bar . baz diff --git a/tests/frontend-tests/issue-2/x.lil b/tests/frontend-tests/issue-2/x.lil deleted file mode 100644 index 38567234..00000000 --- a/tests/frontend-tests/issue-2/x.lil +++ /dev/null @@ -1,12 +0,0 @@ -NSRC sh - - > x - -EMIT m0 * -FUNC m0 foo -TYPE m0 * -INPM m0 0 m1 * -INPM m0 1 m1 * -EMIT m1 * -FUNC m1 bar -TYPE m1 * diff --git a/tests/frontend-tests/issue-2/x.loc b/tests/frontend-tests/issue-2/x.loc deleted file mode 100644 index 9be525f7..00000000 --- a/tests/frontend-tests/issue-2/x.loc +++ /dev/null @@ -1,6 +0,0 @@ -@path -foo . bar - -@source sh - -> x diff --git a/tests/frontend-tests/labels/x.lil b/tests/frontend-tests/labels/x.lil deleted file mode 100644 index dc68e6b5..00000000 --- a/tests/frontend-tests/labels/x.lil +++ /dev/null @@ -1,25 +0,0 @@ -EMIT m0 * -FUNC m0 f -TYPE m0 * -INPM m0 0 m1 * -CHEK m0 m3 -EMIT m1 * -FUNC m1 f -TYPE m1 * -INPM m1 0 m2 * -CHEK m1 m3 -CHEK m1 m4 -EMIT m2 * -FUNC m2 f -TYPE m2 * -CHEK m2 m3 -CHEK m2 m5 -EMIT m3 * -FUNC m3 has_beasty_arms -TYPE m3 * -EMIT m4 * -FUNC m4 can_burninate -TYPE m4 * -EMIT m5 * -FUNC m5 is_secretly_vegan -TYPE m5 * diff --git a/tests/frontend-tests/labels/x.loc b/tests/frontend-tests/labels/x.loc deleted file mode 100644 index baa0d35c..00000000 --- a/tests/frontend-tests/labels/x.loc +++ /dev/null @@ -1,7 +0,0 @@ -@path -f . f:trogdor . f:1_minotaur - -@assert -f :: has_beasty_arms -f:trogdor :+ can_burninate -f:1_minotaur :+ is_secretly_vegan diff --git a/tests/frontend-tests/lang-spec/x.lil b/tests/frontend-tests/lang-spec/x.lil deleted file mode 100644 index c664673c..00000000 --- a/tests/frontend-tests/lang-spec/x.lil +++ /dev/null @@ -1,7 +0,0 @@ -EMIT m0 sh -FUNC m0 sh_foo -TYPE m0 * -INPM m0 0 m1 * -EMIT m1 R -FUNC m1 r_bar -TYPE m1 * diff --git a/tests/frontend-tests/lang-spec/x.loc b/tests/frontend-tests/lang-spec/x.loc deleted file mode 100644 index 27de108b..00000000 --- a/tests/frontend-tests/lang-spec/x.loc +++ /dev/null @@ -1,15 +0,0 @@ -@path - -foo . bar - -@alias sh -foo :: sh_foo -bar :: sh_bar - -@alias R -foo :: r_foo -bar :: r_bar - -@lang -foo :: sh -bar :: R diff --git a/tests/frontend-tests/list-select/x.lil b/tests/frontend-tests/list-select/x.lil deleted file mode 100644 index e8de4336..00000000 --- a/tests/frontend-tests/list-select/x.lil +++ /dev/null @@ -1,12 +0,0 @@ -EMIT m0 * -FUNC m0 g -TYPE m0 * -INPM m0 0 m1 * -HOOK m0 5 m2 -EMIT m1 * -FUNC m1 f -TYPE m1 * -HOOK m1 5 m2 -EMIT m2 * -FUNC m2 e -TYPE m2 * diff --git a/tests/frontend-tests/list-select/x.loc b/tests/frontend-tests/list-select/x.loc deleted file mode 100644 index 64255a07..00000000 --- a/tests/frontend-tests/list-select/x.loc +++ /dev/null @@ -1,5 +0,0 @@ -@path -A :: g . f - -@5 -g,f := e diff --git a/tests/frontend-tests/multi/x.lil b/tests/frontend-tests/multi/x.lil deleted file mode 100644 index 70f87dfa..00000000 --- a/tests/frontend-tests/multi/x.lil +++ /dev/null @@ -1,11 +0,0 @@ -EMIT m0 * -FUNC m0 foo -TYPE m0 A -INPM m0 0 m1 G -INPM m0 1 m2 H -EMIT m1 * -FUNC m1 bar -TYPE m1 G -EMIT m2 * -FUNC m2 baz -TYPE m2 H diff --git a/tests/frontend-tests/multi/x.loc b/tests/frontend-tests/multi/x.loc deleted file mode 100644 index 8b6e9ffd..00000000 --- a/tests/frontend-tests/multi/x.loc +++ /dev/null @@ -1,7 +0,0 @@ -@type -foo :: ? -> A -bar :: Void -> G -baz :: Void -> H - -@path -foo . bar baz diff --git a/tests/frontend-tests/nested-deref/x.lil b/tests/frontend-tests/nested-deref/x.lil deleted file mode 100644 index 7395b063..00000000 --- a/tests/frontend-tests/nested-deref/x.lil +++ /dev/null @@ -1,14 +0,0 @@ -EMIT m0 * -FUNC m0 f -TYPE m0 * -INPF m0 0 m1 * -EMIT m1 * -FUNC m1 g -TYPE m1 * -NARG m1 1 -INPM m1 0 m2 * -EMIT m2 * -FUNC m2 h -TYPE m2 * -NARG m2 1 -INPA m2 0 1 * diff --git a/tests/frontend-tests/nested-deref/x.loc b/tests/frontend-tests/nested-deref/x.loc deleted file mode 100644 index cee8481a..00000000 --- a/tests/frontend-tests/nested-deref/x.loc +++ /dev/null @@ -1,2 +0,0 @@ -@path -f . ( &( g . h . $1 ) ) diff --git a/tests/frontend-tests/operator-add/x.lil b/tests/frontend-tests/operator-add/x.lil deleted file mode 100644 index f34186f0..00000000 --- a/tests/frontend-tests/operator-add/x.lil +++ /dev/null @@ -1,39 +0,0 @@ -EMIT m0 * -FUNC m0 d -TYPE m0 * -INPM m0 0 m1 * -EMIT m1 * -FUNC m1 c -TYPE m1 * -INPM m1 0 m2 * -HOOK m1 3 m8 -HOOK m1 3 m9 -EMIT m2 * -FUNC m2 b -TYPE m2 * -INPM m2 0 m3 * -CHEK m2 m6 -CHEK m2 m7 -EMIT m3 * -FUNC m3 a -TYPE m3 * -HOOK m3 5 m4 -HOOK m3 5 m5 -EMIT m4 * -FUNC m4 foo -TYPE m4 * -EMIT m5 * -FUNC m5 bar -TYPE m5 * -EMIT m6 * -FUNC m6 is_orange -TYPE m6 * -EMIT m7 * -FUNC m7 is_susumu -TYPE m7 * -EMIT m8 * -FUNC m8 listen_to_the_music -TYPE m8 * -EMIT m9 * -FUNC m9 sing_the_song -TYPE m9 * diff --git a/tests/frontend-tests/operator-add/x.loc b/tests/frontend-tests/operator-add/x.loc deleted file mode 100644 index 72eb0429..00000000 --- a/tests/frontend-tests/operator-add/x.loc +++ /dev/null @@ -1,14 +0,0 @@ -@path -A :: d . c . b . a - -@5 -a := foo -a :+ bar - -@assert -b := is_orange -b :+ is_susumu - -@3 -c := listen_to_the_music -c :+ sing_the_song diff --git a/tests/frontend-tests/operator-sub/x.lil b/tests/frontend-tests/operator-sub/x.lil deleted file mode 100644 index ca668d7a..00000000 --- a/tests/frontend-tests/operator-sub/x.lil +++ /dev/null @@ -1,36 +0,0 @@ -EMIT m0 * -FUNC m0 d -TYPE m0 * -INPM m0 0 m1 * -EMIT m1 * -FUNC m1 c -TYPE m1 * -INPM m1 0 m2 * -CHEK m1 m8 -EMIT m2 * -FUNC m2 b -TYPE m2 * -INPM m2 0 m3 * -HOOK m2 3 m7 -EMIT m3 * -FUNC m3 a -TYPE m3 * -HOOK m3 5 m5 -EMIT m4 * -FUNC m4 foo -TYPE m4 * -EMIT m5 * -FUNC m5 bar -TYPE m5 * -EMIT m6 * -FUNC m6 wish_i_were_a_geologist -TYPE m6 * -EMIT m7 * -FUNC m7 get_back_to_work -TYPE m7 * -EMIT m8 * -FUNC m8 is_wearing_appropriately_shiny_attire -TYPE m8 * -EMIT m9 * -FUNC m9 is_wearing_the_sanctioned_shoes -TYPE m9 * diff --git a/tests/frontend-tests/operator-sub/x.loc b/tests/frontend-tests/operator-sub/x.loc deleted file mode 100644 index 24b61d62..00000000 --- a/tests/frontend-tests/operator-sub/x.loc +++ /dev/null @@ -1,17 +0,0 @@ -@path -A :: d . c . b . a - -@5 -a := foo -a :+ bar -a :- - -@3 -b := wish_i_were_a_geologist -b :+ get_back_to_work -b :- - -@assert -c := is_wearing_appropriately_shiny_attire -c :+ is_wearing_the_sanctioned_shoes -c :- diff --git a/tests/frontend-tests/path-lang/x.lil b/tests/frontend-tests/path-lang/x.lil deleted file mode 100644 index 301c42ce..00000000 --- a/tests/frontend-tests/path-lang/x.lil +++ /dev/null @@ -1,7 +0,0 @@ -EMIT m0 lollipop -FUNC m0 foo -TYPE m0 * -INPM m0 0 m1 * -EMIT m1 french -FUNC m1 bar -TYPE m1 * diff --git a/tests/frontend-tests/path-lang/x.loc b/tests/frontend-tests/path-lang/x.loc deleted file mode 100644 index 71ae98b3..00000000 --- a/tests/frontend-tests/path-lang/x.loc +++ /dev/null @@ -1,5 +0,0 @@ -@path lollipop -foo . bar - -@lang -bar :: french diff --git a/tests/frontend-tests/positional-types/x.lil b/tests/frontend-tests/positional-types/x.lil deleted file mode 100644 index b6f90742..00000000 --- a/tests/frontend-tests/positional-types/x.lil +++ /dev/null @@ -1,8 +0,0 @@ -EMIT m0 py -FUNC m0 foo -TYPE m0 String -INPP m0 0 12 Int -INPP m0 1 "hi there" String -INPP m0 2 -2.3 Num -INPP m0 3 true Bool -INPP m0 4 false Bool diff --git a/tests/frontend-tests/positional-types/x.loc b/tests/frontend-tests/positional-types/x.loc deleted file mode 100644 index bbeeeb04..00000000 --- a/tests/frontend-tests/positional-types/x.loc +++ /dev/null @@ -1,5 +0,0 @@ -@type -foo :: ? -> String - -@path py -foo . 12 "hi there" -2.3 TRUE FALSE diff --git a/tests/frontend-tests/reset/x.lil b/tests/frontend-tests/reset/x.lil deleted file mode 100644 index 87e65e21..00000000 --- a/tests/frontend-tests/reset/x.lil +++ /dev/null @@ -1,7 +0,0 @@ -EMIT m0 * -FUNC m0 g -TYPE m0 Void -INPM m0 0 m1 A -EMIT m1 * -FUNC m1 f -TYPE m1 A diff --git a/tests/frontend-tests/reset/x.loc b/tests/frontend-tests/reset/x.loc deleted file mode 100644 index f96be535..00000000 --- a/tests/frontend-tests/reset/x.loc +++ /dev/null @@ -1,26 +0,0 @@ -@comment - -This script is a simple test of to ensure all required simple manifold elements -are present. There are many nuances to the behavior of these modifiers, but -they are not tested here. - -It does not check the compositional sections effect, hook, and check - -@type -f :: Void -> A -g :: A -> Void - -@path -foo :: g . f - -@cache -g :: hey -g :: RESET - -@alias -g :: hey -g :: RESET - -@arg -g := hey -g := RESET diff --git a/tests/frontend-tests/selection/x.lil b/tests/frontend-tests/selection/x.lil deleted file mode 100644 index a59d3d21..00000000 --- a/tests/frontend-tests/selection/x.lil +++ /dev/null @@ -1,33 +0,0 @@ -EMIT m0 * -FUNC m0 foo -TYPE m0 * -INPM m0 0 m6 * -HOOK m0 5 m3 -HOOK m0 5 m5 -EMIT m6 * -FUNC m6 fifi -TYPE m6 * -INPM m6 0 m7 * -EMIT m7 * -FUNC m7 foo -TYPE m7 * -HOOK m7 5 m3 -HOOK m7 5 m5 -EMIT m1 * -FUNC m1 fifi -TYPE m1 * -INPM m1 0 m2 * -EMIT m2 * -FUNC m2 foo -TYPE m2 * -HOOK m2 5 m4 -HOOK m2 5 m5 -EMIT m3 * -FUNC m3 a_foo -TYPE m3 * -EMIT m4 * -FUNC m4 b_foo -TYPE m4 * -EMIT m5 * -FUNC m5 yolo -TYPE m5 * diff --git a/tests/frontend-tests/selection/x.loc b/tests/frontend-tests/selection/x.loc deleted file mode 100644 index bd9d658c..00000000 --- a/tests/frontend-tests/selection/x.loc +++ /dev/null @@ -1,8 +0,0 @@ -@path -A :: foo:1 . *B -B :: fifi:2 . foo:2 - -@5 -A/foo :+ a_foo -B/foo :+ b_foo -foo :+ yolo diff --git a/tests/frontend-tests/stars/x.lil b/tests/frontend-tests/stars/x.lil deleted file mode 100644 index 70cd43d9..00000000 --- a/tests/frontend-tests/stars/x.lil +++ /dev/null @@ -1,17 +0,0 @@ -EMIT m0 cpp -FUNC m0 c -TYPE m0 * -INPM m0 0 m1 * -EMIT m1 ruby -FUNC m1 b -TYPE m1 * -INPM m1 0 m2 * -HOOK m1 5 m3 -EMIT m2 ruby -FUNC m2 a -TYPE m2 * -HOOK m2 5 m3 -EMIT m3 pl -FUNC m3 foo -TYPE m3 * -HOOK m3 5 m3 diff --git a/tests/frontend-tests/stars/x.loc b/tests/frontend-tests/stars/x.loc deleted file mode 100644 index e9380621..00000000 --- a/tests/frontend-tests/stars/x.loc +++ /dev/null @@ -1,13 +0,0 @@ -@path -A :: c . b . a - -@5 -* := foo ------------------------------------- -c :- - -@lang -* :: Haskell -* :: ruby -c :: cpp -foo :: pl diff --git a/tests/frontend-tests/types/x.lil b/tests/frontend-tests/types/x.lil deleted file mode 100644 index 83c1234d..00000000 --- a/tests/frontend-tests/types/x.lil +++ /dev/null @@ -1,15 +0,0 @@ -EMIT m0 * -FUNC m0 foo -TYPE m0 Light -INPM m0 0 m3 Tungsten -EMIT m1 * -FUNC m1 bar -TYPE m1 Light -INPM m1 0 m3 Tungsten -EMIT m2 * -FUNC m2 fifi -TYPE m2 Light -INPM m2 0 m3 Tungsten -EMIT m3 * -FUNC m3 zanzi -TYPE m3 Tungsten diff --git a/tests/frontend-tests/types/x.loc b/tests/frontend-tests/types/x.loc deleted file mode 100644 index f92a90b8..00000000 --- a/tests/frontend-tests/types/x.loc +++ /dev/null @@ -1,6 +0,0 @@ -@type -foo,bar,fifi :: Tungsten -> Light -zanzi :: Void -> Tungsten - -@path -foo bar fifi . zanzi diff --git a/tests/frontend-tests/variable-names/x.lil b/tests/frontend-tests/variable-names/x.lil deleted file mode 100644 index 9e2c0b1b..00000000 --- a/tests/frontend-tests/variable-names/x.lil +++ /dev/null @@ -1,15 +0,0 @@ -EMIT m0 * -FUNC m0 a2 -TYPE m0 * -INPM m0 0 m1 * -EMIT m1 * -FUNC m1 A4 -TYPE m1 * -INPM m1 0 m2 * -INPM m1 1 m3 * -EMIT m2 * -FUNC m2 a-r -TYPE m2 * -EMIT m3 * -FUNC m3 a-14 -TYPE m3 * diff --git a/tests/frontend-tests/variable-names/x.loc b/tests/frontend-tests/variable-names/x.loc deleted file mode 100644 index 5b9a03ed..00000000 --- a/tests/frontend-tests/variable-names/x.loc +++ /dev/null @@ -1,2 +0,0 @@ -@path -a2 . A4 . a-r a-14 diff --git a/tests/json/array/Makefile b/tests/json/array/Makefile deleted file mode 100644 index df2b85ea..00000000 --- a/tests/json/array/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -TARGET=x.loc - -all: - rm -f manifold-nexus.py - rm -rf locout - loc -x locout ${TARGET} - > obs - ./manifold-nexus.py py >> obs - ./manifold-nexus.py sh >> obs - ./manifold-nexus.py r >> obs - diff obs exp - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout - rm -f obs diff --git a/tests/json/array/exp b/tests/json/array/exp deleted file mode 100644 index 6a86e71b..00000000 --- a/tests/json/array/exp +++ /dev/null @@ -1,6 +0,0 @@ -[1, 2] - -[1,2] - -[1,2] - diff --git a/tests/json/array/x.loc b/tests/json/array/x.loc deleted file mode 100644 index 96000b51..00000000 --- a/tests/json/array/x.loc +++ /dev/null @@ -1,33 +0,0 @@ -@type -arr :: Void -> [Int] - - -@path -arr:py arr:sh arr:R - - -@export -arr:py as py -arr:sh as sh -arr:R as r - - -@lang -arr:py :: py -arr:sh :: sh -arr:R :: R - - -@source py -def arr(): - return [1,2] - -@source sh -arr (){ - echo -e "1\n2" -} - -@source R -arr <- function(){ - c(1,2) -} diff --git a/tests/json/atomic/Makefile b/tests/json/atomic/Makefile deleted file mode 100644 index 01f9111c..00000000 --- a/tests/json/atomic/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -TARGET=x.loc - -all: - rm -f manifold-nexus.py - rm -rf locout - loc -kx locout ${TARGET} - > obs - ./manifold-nexus.py int_py >> obs - ./manifold-nexus.py str_py >> obs - ./manifold-nexus.py int_sh >> obs - ./manifold-nexus.py str_sh >> obs - ./manifold-nexus.py int_R >> obs - ./manifold-nexus.py str_R >> obs - diff obs exp - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout - rm -f obs diff --git a/tests/json/atomic/exp b/tests/json/atomic/exp deleted file mode 100644 index 8c94c8dc..00000000 --- a/tests/json/atomic/exp +++ /dev/null @@ -1,12 +0,0 @@ -5 - -"hi" - -5 - -"hi" - -5 - -"hi" - diff --git a/tests/json/atomic/x.loc b/tests/json/atomic/x.loc deleted file mode 100644 index ad8c2f4f..00000000 --- a/tests/json/atomic/x.loc +++ /dev/null @@ -1,50 +0,0 @@ -@type -a_int :: Void -> Int -a_str :: Void -> String - - -@path -a_int:py a_str:py -a_int:sh a_str:sh -a_int:R a_str:R - - -@export -a_int:py as int_py -a_str:py as str_py -a_int:sh as int_sh -a_str:sh as str_sh -a_int:R as int_R -a_str:R as str_R - - -@lang -a_int:py,a_str:py :: py -a_int:sh,a_str:sh :: sh -a_int:R,a_str:R :: R - - -@source py -def a_int(): - return 5 - -def a_str(): - return "hi" - -@source sh -a_int (){ - echo 5 -} - -a_str (){ - echo "hi" -} - -@source R -a_int <- function(){ - 5 -} - -a_str <- function(){ - "hi" -} diff --git a/tests/json/clean.sh b/tests/json/clean.sh deleted file mode 100755 index 99f45ccf..00000000 --- a/tests/json/clean.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -cd array -make clean -cd .. - -cd atomic -make clean -cd .. - -cd tuple -make clean -cd .. diff --git a/tests/json/test.sh b/tests/json/test.sh deleted file mode 100755 index cff43663..00000000 --- a/tests/json/test.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -echo -echo '==============' -echo 'Testing atomic' -echo '==============' -echo - -cd atomic -make -cd .. - - -echo -echo '==============' -echo 'Testing array' -echo '==============' -echo - -cd array -make -cd .. - -echo -echo '==============' -echo 'Testing tuples' -echo '==============' -echo - -cd tuple -make -cd .. diff --git a/tests/json/tuple/Makefile b/tests/json/tuple/Makefile deleted file mode 100644 index df2b85ea..00000000 --- a/tests/json/tuple/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -TARGET=x.loc - -all: - rm -f manifold-nexus.py - rm -rf locout - loc -x locout ${TARGET} - > obs - ./manifold-nexus.py py >> obs - ./manifold-nexus.py sh >> obs - ./manifold-nexus.py r >> obs - diff obs exp - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout - rm -f obs diff --git a/tests/json/tuple/exp b/tests/json/tuple/exp deleted file mode 100644 index 85621a56..00000000 --- a/tests/json/tuple/exp +++ /dev/null @@ -1,6 +0,0 @@ -[1, [2, [3, 4, 5]]] - -ladida - -[1,[2,[3,4,5]]] - diff --git a/tests/json/tuple/x.loc b/tests/json/tuple/x.loc deleted file mode 100644 index 1d68d792..00000000 --- a/tests/json/tuple/x.loc +++ /dev/null @@ -1,33 +0,0 @@ -@type -tup :: Void -> (Int, (Int, [Int])) - - -@path -tup:py tup:sh tup:R - - -@export -tup:py as py -tup:sh as sh -tup:R as r - - -@lang -tup:py :: py -tup:sh :: sh -tup:R :: R - - -@source py -def tup(): - return (1, (2, [3,4,5])) - -@source sh -tup (){ - echo -e "oh poop" -} - -@source R -tup <- function(){ - list(1, list(2, c(3,4,5))) -} diff --git a/tests/runtests.sh b/tests/runtests.sh deleted file mode 100755 index f14b3c47..00000000 --- a/tests/runtests.sh +++ /dev/null @@ -1,306 +0,0 @@ -#!/usr/bin/env bash -set -u - -usage (){ -cat << EOF -Test suite for the Morloc compiler - -h print this help message - -q quiet, print no output - -x stop on first failure - -F skip frontend tests - -B skip backend tests - -T skip type tests - -K skip tests of known problems - -d print diff statements - -e print error messages - -l LANG do test for language L -EOF - exit 0 -} - -morloc_flags= -backend_dir= - -loud=true -instant_death=false -test_frontend=true -test_backend=true -test_types=true -test_known_problems=true -difflog=/dev/null -errlog=/dev/null -lang="all" -while getopts "hqxdeFBKETl:" opt; do - case $opt in - h) - usage ;; - q) - loud=false ;; - x) - instant_death=true ;; - d) - difflog=/dev/stdout ;; - e) - errlog=/dev/stdout ;; - F) - test_frontend=false ;; - B) - test_backend=false ;; - T) - test_types=false ;; - K) - test_known_problems=false ;; - l) - lang=$OPTARG ;; - ?) - warn "Illegal arguments" - exit 1 - esac -done - -n_fail=0 -n_pass=0 - -say(){ - $loud && echo "$@" -} - -say_n(){ - $loud && echo -n "$@" -} - -announce(){ - if $loud - then - [[ -t 1 ]] && o="\e[1;33m$1\e[0m" || o=$1 - echo -e $o - fi -} - -warn(){ - if $loud - then - [[ -t 1 ]] && o="\e[1;31m$1\e[0m" || o=$1 - echo -en $o - fi -} - -frontend_test(){ - dir=$1 - msg=$2 - cd frontend-tests/$dir - - say_n "$msg" - - morloc -l $morloc_flags x.loc &> $errlog - if [[ $? == 0 ]] - then - diff <(morloc -l $morloc_flags x.loc) x.lil &> $difflog - if [[ $? == 0 ]] - then - say OK - n_pass=$(( n_pass + 1 )) - else - warn FAIL - say " - LIL diff" - n_fail=$(( n_fail + 1 )) - fi - else - warn FAIL - say " - runtime" - n_fail=$(( n_fail + 1 )) - $instant_death && exit 1 - fi - cd - &> /dev/null -} - -# Success is determined by exit status of the x function -backend_x_test(){ - dir=$1 - msg=$2 - cd $backend_dir/$dir - - say_n "$msg" - ./x &> $errlog - if [[ $? == 0 ]] - then - say OK - n_pass=$(( n_pass + 1 )) - else - warn FAIL - say " - $?" - n_fail=$(( n_fail + 1 )) - $instant_death && exit 1 - fi - - cd - &> /dev/null -} - -backend_test(){ - dir="$1" - cmd="$2" - msg="$3" - - cd $backend_dir/$dir - - say_n "$msg" - - morloc $morloc_flags -kx tst x.loc &> $errlog - if [[ $? == 0 ]] - then - obs=/tmp/obs_$RANDOM - exp=/tmp/exp_$RANDOM - ./manifold-nexus.py "$cmd" &> $obs - ./x > $exp 2> /dev/null - - diff $obs $exp &> $difflog - if [[ $? == 0 ]] - then - say OK - n_pass=$(( n_pass + 1 )) - else - warn FAIL - say " - diff" - n_fail=$(( n_fail + 1 )) - fi - rm $obs $exp - else - warn FAIL - say " - runtime" - n_fail=$(( n_fail + 1 )) - $instant_death && exit 1 - fi - - rm -rf tst manifold-nexus.py - cd - &> /dev/null -} - -if $test_frontend -then -announce "Frontend tests" -frontend_test generics_1 'generics_1/ -- resolve generics: a -> a ....................... ' -frontend_test generics_2 'generics_2/ -- resolve generics: a -> (a -> [a]) .............. ' -frontend_test generics_3 'generics_3/ -- resolve generics: from positional .............. ' -frontend_test generics_4 'generics_4/ -- resolve generics: propagate horizontal ......... ' -frontend_test advice 'advice/ -- equivalence of (@before, @after) to (@4, @5) ... ' -frontend_test lang-spec 'lang-spec/ -- language specific sections ..................... ' -frontend_test multi 'multi/ -- test multi manifold type inference ............. ' -frontend_test path-lang 'path-lang/ -- @path german ... @lang french .................. ' -frontend_test positional-types 'positional-types/ -- test type inference of positional arguments .... ' -frontend_test types 'types/ -- types and lists of types ....................... ' -frontend_test elements 'elements/ -- basic manifold elements exist .................. ' -frontend_test infer-star 'infer-star/ -- infer type of * generics ....................... ' -frontend_test operator-add 'operator-add/ -- test :=, and :+ ................................ ' -frontend_test operator-sub 'operator-sub/ -- test :=, :+, and :- ............................ ' -frontend_test stars 'stars/ -- test * on modifier lhs ......................... ' -frontend_test include 'include/ -- can include files .............................. ' -frontend_test list-select 'list-select/ -- lists expand on couplet lhs .................... ' -frontend_test args 'args/ -- [+-]lhs, flags, lists .......................... ' -frontend_test reset 'reset/ -- test RESET command ............................. ' -frontend_test deref 'deref/ -- map . & (f . g . $1) . foo ..................... ' -frontend_test grpref 'grpref/ -- f . *A ; A :: g ................................ ' -frontend_test deref-mod 'deref-mod/ -- as above, but with effects on f ................ ' -frontend_test selection 'selection/ -- @3 A/foo :+ a_foo .............................. ' -frontend_test deep-path 'deep-path/ -- @3 A/B/foo :+ a_foo ............................ ' -frontend_test nested-deref 'nested-deref/ -- f . ( &(g . h) ) ............................... ' -frontend_test export-path 'export-path/ -- @export ; A/g as main .......................... ' -frontend_test variable-names 'variable-names/ -- a2 . A4 . a-r a-14 ............................. ' -frontend_test issue-2 'issue-2/ -- github issue #2 ................................ ' -fi - -morloc_flags=" -t " -backend_dir=type-tests -if $test_types -then -announce "Type tests" -backend_test multi main 'multi/ -- types and lists of types ....................... ' -backend_x_test all 'all/ -- pass each atomic type through all language ..... ' -backend_x_test all-vectors 'all-vectors/ -- pass each vector type through all language ..... ' -backend_x_test all-tables 'all-tables/ -- pass each table type through all language ...... ' -backend_x_test table-types 'table-types/ -- test coersion of Table type .................... ' -backend_x_test deref 'deref/ -- send data from each language to sh ............. ' -backend_x_test open-hooks 'open-hooks/ -- combinations of open manifolds with hooks ...... ' -backend_test r-positionals main 'r-positionals/ -- replicate . `20` `sample` `letters` ............ ' -backend_test tuples main 'tuples/ -- pass tuple across all languages ................ ' -fi - - -morloc_flags=" " -backend_dir=backend-tests -if $test_backend -then -announce "Backend tests" - -if [[ $lang == "all" ]]; then -backend_x_test record 'record/ -- foo :: record . "z.txt" "this is a message" .... ' -backend_x_test filter 'filter/ -- filter for all languages ....................... ' -backend_x_test table-ops 'table-ops/ -- test nthcol for all ............................ ' -backend_test 'if' main 'if/ -- if . true &(c . 1) &(c . 2) .................... ' -fi - -if [[ $lang == "all" || $lang == "R" ]] ; then -backend_test r-cached main 'r-cached/ -- sqrt . max . seq ............................... ' -backend_x_test r-check 'r-check/ -- sqrt . max . seq ............................... ' -backend_test r-hooks main 'r-hooks/ -- run with all hooks ............................. ' -backend_test r-map main 'r-map/ -- simple test of lambda functions and map ........ ' -backend_test r-simple main 'r-simple/ -- sqrt . max . seq ............................... ' -backend_test r-single-quotes main 'r-single-quotes/ -- test nested single quotes ...................... ' -backend_x_test r-all 'r-all/ -- sqrt . max . seq ............................... ' -backend_x_test r-branch 'r-branch/ -- make if-elif-else analog with check ............ ' -backend_x_test r-grpref-deref 'r-grpref-deref/ -- *X where X :: &( f . g . $1) ................... ' -backend_x_test r-logical 'r-logical/ -- and . is_a (any . is_b is_c (not . is_d)) ...... ' -backend_x_test r-loop 'r-loop/ -- use open manifolds in map ...................... ' -backend_x_test r-memcache 'r-memcache/ -- null . xtable . data.frame . ... ' -backend_x_test r-open-mod 'r-open-mod/ -- open manifold caching and modification ......... ' -backend_x_test r-refer 'r-refer/ -- max . .................................. ' -backend_x_test r-self-reference 'r-self-reference/ -- cat . ........................ ' -fi - -if [[ $lang == "all" || $lang == "py" ]] ; then -backend_test py-hooks main 'py-hooks/ -- python hello world program ..................... ' -backend_test py-sh main 'py-sh/ -- python [[Int]] to shell `sort` back to python .. ' -backend_test py-table main 'py-table/ -- test printing of type `[[Int]]` ................ ' -backend_test py-positionals main 'py-positionals/ -- test type inference of positionals ............. ' -backend_x_test py-logical 'py-logical/ -- and . is_a (any . is_b is_c (not . is_d)) ...... ' -fi - -if [[ $lang == "all" || $lang == "sh" ]] ; then -backend_test r-sh-parallel main 'r-sh-parallel/ -- feed R composition into a bash map command ..... ' -backend_test sh-all main 'sh-all/ -- uniq . sort . grep . man ....................... ' -backend_test sh-and-r main 'sh-and-r/ -- grep . seq ..................................... ' -backend_test sh-cached main 'sh-cached/ -- uniq . sort . grep . man ....................... ' -backend_test sh-loop main 'sh-loop/ -- map . &( cut . wc . grep . $1 ) ls . `*.sh` .... ' -backend_test sh-map main 'sh-map/ -- simple test of lambda functions and map ........ ' -backend_test sh-simple main 'sh-simple/ -- uniq . sort . grep . man ....................... ' -backend_x_test sh-arg-and-pos 'sh-arg-and-pos/ -- umm, I dont remember why I need this one ....... ' -backend_x_test sh-hooks 'sh-hooks/ -- run with all hooks ............................. ' -backend_x_test sh-logical 'sh-logical/ -- and . is_a (any . is_b is_c (not . is_d)) ...... ' -backend_x_test sh-open-mod 'sh-open-mod/ -- open manifold caching and modification ......... ' -backend_x_test sh-refer 'sh-refer/ -- head . ................................. ' -fi - -fi - -if $test_known_problems -then -if [[ $lang == "all" ]] ; then -announce "Known problems" -backend_test sh-race cat 'sh-race/ -- cat . ........................ ' -backend_test r-import add 'r-import/ -- fanciful import statement ...................... ' -frontend_test generics_5 'generics_5/ -- resolve generics: polytypes .................... ' -frontend_test complex-types 'complex-types/ -- test array, function and type inference ........ ' -fi -fi - - - -say -if [[ $n_fail == 0 ]] -then - say All tests pass - exit 0 -else - warn "FAILURE" - say " - $n_fail out of $(( n_fail + n_pass )) tests failed" - exit 1 -fi diff --git a/tests/type-tests/all-tables/Makefile b/tests/type-tests/all-tables/Makefile deleted file mode 100644 index 655d569a..00000000 --- a/tests/type-tests/all-tables/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py Int - ./manifold-nexus.py Num - ./manifold-nexus.py String - ./manifold-nexus.py Bool - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/type-tests/all-tables/x b/tests/type-tests/all-tables/x deleted file mode 100755 index 224c7950..00000000 --- a/tests/type-tests/all-tables/x +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -cat < z -[[42, 42], [42, 42], [42, 42]] -[[0.42, 0.42], [0.42, 0.42], [0.42, 0.42]] -[["fourty-two", "fourty-two"], ["fourty-two", "fourty-two"], ["fourty-two", "fourty-two"]] -[[true, true], [true, true], [true, true]] -EOF -stat=0 -morloc -kx locout x.loc || stat=1 -./manifold-nexus.py Int >> y -./manifold-nexus.py Num >> y -./manifold-nexus.py String >> y -./manifold-nexus.py Bool >> y -diff z y || stat=1 -&> /dev/null -rm -rf locout z y manifold-nexus.py -exit $stat diff --git a/tests/type-tests/all-tables/x.loc b/tests/type-tests/all-tables/x.loc deleted file mode 100644 index c23bc5d3..00000000 --- a/tests/type-tests/all-tables/x.loc +++ /dev/null @@ -1,92 +0,0 @@ -@include -core/atomic - -@type -iid :: [[Int]] -> [[Int]] -nid :: [[Num]] -> [[Num]] -sid :: [[String]] -> [[String]] -bid :: [[Bool]] -> [[Bool]] - -itov :: Int -> [[Int]] -ntov :: Num -> [[Num]] -stov :: String -> [[String]] -btov :: Bool -> [[Bool]] - -@path -IntTest :: iid:py . iid:sh . iid:R . iid:py . itov . 42 -NumTest :: nid:py . nid:sh . nid:R . nid:py . ntov . 0.42 -StringTest :: sid:py . sid:sh . sid:R . sid:py . stov . "fourty-two" -BoolTest :: bid:py . bid:sh . bid:R . bid:py . btov . TRUE - -@export -IntTest/iid:py as Int -NumTest/nid:py as Num -StringTest/sid:py as String -BoolTest/bid:py as Bool - -@lang -read :: py - - -itov , -ntov , -stov , -btov :: sh - -iid:R :: R -iid:sh :: sh -iid:py :: py - -nid:R :: R -nid:sh :: sh -nid:py :: py - -sid:R :: R -sid:sh :: sh -sid:py :: py - -bid:R :: R -bid:sh :: sh -bid:py :: py - -@alias sh -itov , -ntov , -stov , -btov :: tablate - -@source R -iid <- function(x) { x } -nid <- function(x) { x } -sid <- function(x) { x } -bid <- function(x) { x } - -@source sh -iid(){ - cat "$1" -} -nid(){ - cat "$1" -} -sid(){ - cat "$1" -} -bid(){ - cat "$1" -} - -tablate(){ - echo -e "$1\t$1" - echo -e "$1\t$1" - echo -e "$1\t$1" -} - -@source py -def iid(x): - return x -def nid(x): - return x -def sid(x): - return x -def bid(x): - return x diff --git a/tests/type-tests/all-vectors/Makefile b/tests/type-tests/all-vectors/Makefile deleted file mode 100644 index 655d569a..00000000 --- a/tests/type-tests/all-vectors/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py Int - ./manifold-nexus.py Num - ./manifold-nexus.py String - ./manifold-nexus.py Bool - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/type-tests/all-vectors/x b/tests/type-tests/all-vectors/x deleted file mode 100755 index 2d2f9059..00000000 --- a/tests/type-tests/all-vectors/x +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -cat < z -[42, 42] -[0.42, 0.42] -["fourty-two", "fourty-two"] -[true, true] -EOF -stat=0 -morloc -kx locout x.loc || stat=1 -./manifold-nexus.py Int >> y -./manifold-nexus.py Num >> y -./manifold-nexus.py String >> y -./manifold-nexus.py Bool >> y -diff z y || stat=1 -&> /dev/null -rm -rf locout z y manifold-nexus.py -exit $stat diff --git a/tests/type-tests/all-vectors/x.loc b/tests/type-tests/all-vectors/x.loc deleted file mode 100644 index 36beb6d4..00000000 --- a/tests/type-tests/all-vectors/x.loc +++ /dev/null @@ -1,97 +0,0 @@ -@include -core/atomic - -@type -iid :: [Int] -> [Int] -nid :: [Num] -> [Num] -sid :: [String] -> [String] -bid :: [Bool] -> [Bool] - -itov :: Int -> [Int] -ntov :: Num -> [Num] -stov :: String -> [String] -btov :: Bool -> [Bool] - -@path -IntTest :: iid:py . iid:sh . iid:R . iid:py . itov . 42 -NumTest :: nid:py . nid:sh . nid:R . nid:py . ntov . 0.42 -StringTest :: sid:py . sid:sh . sid:R . sid:py . stov . "fourty-two" -BoolTest :: bid:py . bid:sh . bid:R . bid:py . btov . TRUE - -@export -IntTest/iid:py as Int -NumTest/nid:py as Num -StringTest/sid:py as String -BoolTest/bid:py as Bool - -@lang -read :: py - -itov , -ntov , -stov , -btov :: sh -itov :: sh - -iid:R :: R -iid:sh :: sh -iid:py :: py - -nid:R :: R -nid:sh :: sh -nid:py :: py - -sid:R :: R -sid:sh :: sh -sid:py :: py - -bid:R :: R -bid:sh :: sh -bid:py :: py - -@source R -iid <- function(x) { x } -nid <- function(x) { x } -sid <- function(x) { x } -bid <- function(x) { x } - -@source sh -iid(){ - cat "$1" -} -nid(){ - cat "$1" -} -sid(){ - cat "$1" -} -bid(){ - cat "$1" -} - -itov(){ - echo $1 - echo $1 -} -ntov(){ - echo $1 - echo $1 -} -stov(){ - echo $1 - echo $1 -} -btov(){ - echo $1 - echo $1 -} - -@source py -def iid(x): - return x -def nid(x): - return x -def sid(x): - return x -def bid(x): - return x diff --git a/tests/type-tests/all/Makefile b/tests/type-tests/all/Makefile deleted file mode 100644 index 2361e75d..00000000 --- a/tests/type-tests/all/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py Text - ./manifold-nexus.py Int - ./manifold-nexus.py Num - ./manifold-nexus.py String - ./manifold-nexus.py Bool - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout y z diff --git a/tests/type-tests/all/test.txt b/tests/type-tests/all/test.txt deleted file mode 100644 index 86f591e1..00000000 --- a/tests/type-tests/all/test.txt +++ /dev/null @@ -1,4 +0,0 @@ -this is an example text -that covers -several -lines diff --git a/tests/type-tests/all/x b/tests/type-tests/all/x deleted file mode 100755 index cb9bdaba..00000000 --- a/tests/type-tests/all/x +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -cat < z -["this is an example text", "that covers", "several", "lines"] -42 -0.42 -"fourty-two" -true -EOF -stat=0 -morloc -kx locout x.loc || stat=1 -./manifold-nexus.py Text > y -./manifold-nexus.py Int >> y -./manifold-nexus.py Num >> y -./manifold-nexus.py String >> y -./manifold-nexus.py Bool >> y -diff z y || stat=1 -&> /dev/null -rm -rf locout z y manifold-nexus.py -exit $stat diff --git a/tests/type-tests/all/x.loc b/tests/type-tests/all/x.loc deleted file mode 100644 index 6f8f21c5..00000000 --- a/tests/type-tests/all/x.loc +++ /dev/null @@ -1,87 +0,0 @@ -@include -core/atomic - -@type -iid :: Int -> Int -nid :: Num -> Num -sid :: String -> String -bid :: Bool -> Bool -tid :: Text -> Text -read :: File -> Text - -@path -IntTest :: iid:py . iid:sh . iid:R . iid:py . 42 -NumTest :: nid:py . nid:sh . nid:R . nid:py . 0.42 -StringTest :: sid:py . sid:sh . sid:R . sid:py . "fourty-two" -BoolTest :: bid:py . bid:sh . bid:R . bid:py . TRUE -TextTest :: tid:py . tid:sh . tid:R . tid:py . read . "test.txt" - -@export -IntTest/iid:py as Int -NumTest/nid:py as Num -StringTest/sid:py as String -BoolTest/bid:py as Bool -TextTest/tid:py as Text - -@lang -read :: py - -iid:R :: R -iid:sh :: sh -iid:py :: py - -nid:R :: R -nid:sh :: sh -nid:py :: py - -sid:R :: R -sid:sh :: sh -sid:py :: py - -bid:R :: R -bid:sh :: sh -bid:py :: py - -tid:R :: R -tid:sh :: sh -tid:py :: py - -@source R -iid <- function(x) { x } -nid <- function(x) { x } -sid <- function(x) { x } -bid <- function(x) { x } -tid <- function(x) { x } - -@source sh -iid(){ - echo "$1" -} -nid(){ - echo "$1" -} -sid(){ - echo "$1" -} -bid(){ - echo "$1" -} -tid(){ - cat "$1" -} - -@source py -def read(x): - with open(x, "r") as f: - d = [s.rstrip() for s in f.readlines()] - return d -def iid(x): - return x -def nid(x): - return x -def sid(x): - return x -def bid(x): - return x -def tid(x): - return x diff --git a/tests/type-tests/deref/Makefile b/tests/type-tests/deref/Makefile deleted file mode 100644 index b0237712..00000000 --- a/tests/type-tests/deref/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py py - ./manifold-nexus.py r - ./manifold-nexus.py sh - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/type-tests/deref/x b/tests/type-tests/deref/x deleted file mode 100755 index 280cdcd7..00000000 --- a/tests/type-tests/deref/x +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/bash -stat=0 -make || stat=1 - -diff <(echo -e "7\n7\n7") <(make -s run) || stat=1 - -make clean - -exit $stat diff --git a/tests/type-tests/deref/x.loc b/tests/type-tests/deref/x.loc deleted file mode 100644 index 799b942e..00000000 --- a/tests/type-tests/deref/x.loc +++ /dev/null @@ -1,20 +0,0 @@ -@include -core/control -core/atomic - -@path sh -A :: *Foo -B :: *Foo -C :: *Foo - -Foo :: do . &(id . $1) 7 - -@export -A/do as py -B/do as sh -C/do as r - -@lang -A/do :: py -B/do :: R -C/do :: sh diff --git a/tests/type-tests/multi/Makefile b/tests/type-tests/multi/Makefile deleted file mode 100644 index 410cf847..00000000 --- a/tests/type-tests/multi/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -tkx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/type-tests/multi/x b/tests/type-tests/multi/x deleted file mode 100755 index 767a9f52..00000000 --- a/tests/type-tests/multi/x +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo '[1,3,6,10,15]' diff --git a/tests/type-tests/multi/x.loc b/tests/type-tests/multi/x.loc deleted file mode 100644 index e02db2a6..00000000 --- a/tests/type-tests/multi/x.loc +++ /dev/null @@ -1,16 +0,0 @@ -@type -c :: ? -> [Int] -seq :: Int -> Int -> [Int] -sum :: [Int] -> Int - -@path -map . & ( sum . seq . 1 $1) (c . 1 2 3 4 5) - -@export -map as main - -@lang -* :: R - -@include -core/control diff --git a/tests/type-tests/open-hooks/Makefile b/tests/type-tests/open-hooks/Makefile deleted file mode 100644 index b0237712..00000000 --- a/tests/type-tests/open-hooks/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py py - ./manifold-nexus.py r - ./manifold-nexus.py sh - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/type-tests/open-hooks/x b/tests/type-tests/open-hooks/x deleted file mode 100755 index 1085d044..00000000 --- a/tests/type-tests/open-hooks/x +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -stat=0 - -make || stat=1 - -> a -./manifold-nexus.py py 2>> a -./manifold-nexus.py sh 2>> a -./manifold-nexus.py r 2>> a - -# TODO: The order bash prints is wrong -cat > b << END -py : 7 -sh : 7 -R : 7 -sh : 7 -py : 7 -R : 7 -py : 7 -sh : 7 -R : 7 -END - -make clean - -diff a b || stat=1 - -rm a b - -exit $stat diff --git a/tests/type-tests/open-hooks/x.loc b/tests/type-tests/open-hooks/x.loc deleted file mode 100644 index 606dbff7..00000000 --- a/tests/type-tests/open-hooks/x.loc +++ /dev/null @@ -1,56 +0,0 @@ -@include -core/atomic -core/control - -@type -null :: Int -> Void -do :: * -> Int -> Void -tostderr :: Int -> Void - -@path sh -A :: *Foo -B :: *Foo -C :: *Foo - -Foo :: do . &(null . $1) 7 - -@5 -A/null := tostderr:py . $1 -A/null :+ tostderr:sh . $1 -A/null :+ tostderr:r . $1 - -B/null := tostderr:py . $1 -B/null :+ tostderr:sh . $1 -B/null :+ tostderr:r . $1 - -C/null := tostderr:py . $1 -C/null :+ tostderr:sh . $1 -C/null :+ tostderr:r . $1 - -@export -A/do as py -B/do as r -C/do as sh - -@lang -do :: sh -A/null :: py -B/null :: R -C/null :: sh -tostderr:r :: R -tostderr:sh :: sh -tostderr:py :: py - -@source R -tostderr <- function(x){ - cat(sprintf("R : %s\n", x), file=stderr()) -} - -@source py -def tostderr(x): - print("py : %s" % x, file=sys.stderr) - -@source sh -tostderr (){ - echo "sh : $1" > /dev/stderr -} diff --git a/tests/type-tests/r-positionals/Makefile b/tests/type-tests/r-positionals/Makefile deleted file mode 100644 index 56561292..00000000 --- a/tests/type-tests/r-positionals/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -ktx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/type-tests/r-positionals/x b/tests/type-tests/r-positionals/x deleted file mode 100755 index c8ca9f94..00000000 --- a/tests/type-tests/r-positionals/x +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -cat << EOF -["hbyxxszmddbfrltfglde","unlgsoxtkgldcvqjrzqu","kxrbqprfkmutjvspkxic","wooizhuijgdxhuajuxrm","ylcyrdagdwojvlmccein"] -EOF diff --git a/tests/type-tests/r-positionals/x.loc b/tests/type-tests/r-positionals/x.loc deleted file mode 100644 index 61239883..00000000 --- a/tests/type-tests/r-positionals/x.loc +++ /dev/null @@ -1,50 +0,0 @@ -@comment - -This program should replicate the following R code: - -``` -apply( - replicate( - n=20, - sample(letters, size=5, replace=TRUE) - ), - 2, paste, collapse="" -) -``` - -I had to redefine the replicate function, to bypass the funky non-standard -evaluation it uses. - -@source R - -replicate <- function(n, f, ...){ - out <- list() - for(i in 1:n){ - out[[i]] = f(...) - } - do.call(cbind, out) -} - -@type -apply :: [[Char]] -> Int -> ([Char] -> String) -> [String] -replicate :: Int -> ([Char] -> Int -> [Char]) -> [Char] -> [[Char]] -sample :: [Char] -> Int -> [Char] -paste :: [Char] -> String -letters :: Void -> [Char] -set.seed :: Int -> Void - -@export -apply as main - -@path -apply . (replicate . 20 `sample` `letters`) 1 `paste` - -@0 -apply :: set.seed . 123 - -@lang -* :: R - -@arg -replicate := size=5 replace=TRUE -apply := collapse="" diff --git a/tests/type-tests/table-types/Makefile b/tests/type-tests/table-types/Makefile deleted file mode 100644 index b0237712..00000000 --- a/tests/type-tests/table-types/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py py - ./manifold-nexus.py r - ./manifold-nexus.py sh - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/type-tests/table-types/sample.tab b/tests/type-tests/table-types/sample.tab deleted file mode 100644 index 2852927f..00000000 --- a/tests/type-tests/table-types/sample.tab +++ /dev/null @@ -1,3 +0,0 @@ -123 cats -34 macaws -18 unicorns diff --git a/tests/type-tests/table-types/x b/tests/type-tests/table-types/x deleted file mode 100755 index 0d0aff43..00000000 --- a/tests/type-tests/table-types/x +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -cat < z -123 cats -34 macaws -18 unicorns -123 cats -34 macaws -18 unicorns -123 cats -34 macaws -18 unicorns -EOF - -stat=0 -morloc -kx locout x.loc || stat=1 -./manifold-nexus.py py >> y -./manifold-nexus.py r >> y -./manifold-nexus.py sh >> y -diff z y || stat=1 -&> /dev/null -rm -rf locout z y manifold-nexus.py -exit $stat diff --git a/tests/type-tests/table-types/x.loc b/tests/type-tests/table-types/x.loc deleted file mode 100644 index 0715b656..00000000 --- a/tests/type-tests/table-types/x.loc +++ /dev/null @@ -1,42 +0,0 @@ -@type -load_table :: String -> Table -tid :: Table -> Table - -@export -load_table:py as py -load_table:r as r -load_table:sh as sh - -@path -A :: tid:py . tid:r . tid:sh . load_table:py . *Data -B :: tid:r . tid:sh . tid:py . load_table:r . *Data -C :: tid:sh . tid:py . tid:r . load_table:sh . *Data - -Data :: 'sample.tab' - -@lang -load_table:py,tid:py :: py -load_table:r,tid:r :: R -load_table:sh,tid:sh :: sh - -@source py -def tid(x): - return(x) - -def load_table(x): - with open(x, 'r') as f: - return( [s.rstrip().split('\t') for s in f] ) - -@source R -tid <- function(x) { x } -load_table <- function(x){ - read.table(x, sep="\t", stringsAsFactors=FALSE) -} - -@source sh -tid (){ - cat $1 -} -load_table (){ - cat $1 -} diff --git a/tests/type-tests/tuples/Makefile b/tests/type-tests/tuples/Makefile deleted file mode 100644 index 855531f4..00000000 --- a/tests/type-tests/tuples/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TARGET=x.loc - -all: - morloc -kx locout ${TARGET} - -.PHONY: run -run: - ./manifold-nexus.py main - -.PHONY: clean -clean: - rm -f manifold-nexus.py - rm -rf locout diff --git a/tests/type-tests/tuples/x b/tests/type-tests/tuples/x deleted file mode 100755 index d56fb0f1..00000000 --- a/tests/type-tests/tuples/x +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -echo '[42, true, "give me back my hat", 2.8]' diff --git a/tests/type-tests/tuples/x.loc b/tests/type-tests/tuples/x.loc deleted file mode 100644 index 676046be..00000000 --- a/tests/type-tests/tuples/x.loc +++ /dev/null @@ -1,34 +0,0 @@ -@type -fourple :: (Int,Bool,String,Num) -> (Int,Bool,String,Num) -tuplify :: ? -> * - -@path -fourple:py . -# fourple:sh . -fourple:R . -fourple:py . - tuplify . 42 TRUE "give me back my hat" 2.8 - -@lang -tuplify :: py - -fourple:py :: py -fourple:R :: R -# fourple:sh :: sh - -@source py -def tuplify(*args): - return(args) - -def fourple(x): - return(x) - -@source R -fourple <- function(x){ - x -} - -# @source sh -# fourple (){ -# cat "$1" -# } diff --git a/vim-syntax/loc.vim b/vim-syntax/loc.vim index 3862b0ac..56310093 100644 --- a/vim-syntax/loc.vim +++ b/vim-syntax/loc.vim @@ -1,5 +1,5 @@ " Vim syntax file -" Language: loc +" Language: morloc " Maintainer: Zebulun Arendsee " ----------------------------------------------------------------------------- " INSTALLATION @@ -9,6 +9,11 @@ " $ cp loc.vim ~/.vim/syntax/ " $ echo 'au BufRead,BufNewFile *.loc set filetype=loc' > ~/.vim/ftdetect/loc.vim + + +" ============================================================================= +" P R E A M B L E +" ----------------------------------------------------------------------------- if exists("b:current_syntax") finish endif @@ -29,212 +34,78 @@ let b:current_syntax = '' unlet b:current_syntax syn include @Shell syntax/sh.vim -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Global syntax - shared between all sections - -" all symbols, trailing space, and non-standard sections (^@.*) are illegal by -" default -syn match DEFAULT_ERROR '@\S*' contained -syn match DEFAULT_ERROR '\S\+' contained -syn match DEFAULT_ERROR '\s\+$' contained -" as are all keywords -syn keyword DEFAULT_ERROR id null true false nothing contained -syn keyword DEFAULT_ERROR filter if map contained -syn keyword DEFAULT_ERROR readable writable executable record contained -syn keyword DEFAULT_ERROR and or not any all contained -syn keyword DEFAULT_ERROR memcache datcache nocache contained -syn keyword DEFAULT_ERROR TRUE NULL RESET FALSE ? contained -" syn keyword DEFAULT_ERROR as contained +let b:current_syntax = "loc" -" define todo highlighting -syn keyword s_todo TODO NOTE FIXME XXX contained -syn match s_tag /\(Author\|Email\|Github\|Bugs\|Website\|Maintainer\|Description\):/ contained -" define keywords that will be translated into native equivalents -syn keyword s_logical TRUE NULL RESET FALSE contained -" define comments -" syn match comment '\/\/.*$' contains=tag -" syn region comment start='\/\*' end='\*\/' contains=tag -syn match s_comment '#.*' contains=s_todo,s_tag contained - -syn match s_break '^---\+$' contained -syn match s_break ';\+' contained -syn keyword s_constant __all__ contained - -" section headers -syn match s_section '@alias' contained -syn match s_section '@arg' contained -syn match s_section '@cache' contained -syn match s_section '@assert' contained -syn match s_section '@comment' contained -syn match s_section '@doc' contained -syn match s_section '@[0-9]' contained -syn match s_section '@before' contained -syn match s_section '@after' contained -syn match s_section '@export' contained -syn match s_section '@fail' contained -syn match s_section '@lang' contained -syn match s_section '@include' contained -syn match s_section '@import' contained -syn match s_section '@ontology' contained -syn match s_section '@path' contained -syn match s_section '@type' contained -syn match s_section '@source' contained - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Section specific syntax - -" general default functions -syn keyword s_simple_function id null true false nothing contained -syn keyword s_simple_function filter ternary map contained -syn keyword s_simple_function readable writable executable record contained -syn keyword s_logical_op and or not any all contained - -syn match s_var /\h[\w.0-9-]*/ contained -syn match s_arg /--\?\w*/ contained -syn match s_num '\h\@<]/ contained -syn match s_rarrow /->/ contained -syn match s_pathsep /\// contained -syn match s_couple /::/ contained -syn match s_modify /\(:=\|:-\|:+\)/ contained -syn match s_equal /=/ contained -syn match s_switch /?/ contained -syn match s_sep /,/ contained -syn match s_par /[()]/ contained -syn match s_brk /[\[\]]/ contained -syn match s_bar /|/ contained -syn match s_star /\_\W\*\_\W\|^\*\_W\|^\*$/ contained - -syn match s_positional /`[^`]*`/ contained -syn match s_group /\*\w\+/ contained -syn match s_refer /<[A-Za-z0-9_./:-]\+>/ contained - -" strings -syn region s_string start=/'/ end=/'/ contained -syn region s_string start=/"/ end=/"/ contained - - -" define terms used in types -syn keyword s_type Void contained -syn match s_type /?/ contained - -" keywords -syn keyword s_export_keyword as contained - -syn keyword s_import_keyword from contained -syn keyword s_import_keyword as contained -syn keyword s_import_keyword import contained - -" labels -syn match s_varlabel ':\w\+' contained - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Set a highlighting paradigm for each section - -syn cluster c_subglobal contains=s_comment,s_section,DEFAULT_ERROR -syn cluster c_global contains=@c_subglobal,s_simple_function,s_var,s_constant,s_logical,s_logical_op - -syn cluster c_couple_nl contains=s_couple,s_star -syn cluster c_modify_nl contains=@c_couple_nl,s_modify,s_pathsep -syn cluster c_couple contains=@c_couple_nl,s_varlabel -syn cluster c_modify contains=@c_modify_nl,s_varlabel - -syn cluster c_hasarg contains=s_equal,s_num,s_sep,s_brk,s_par,s_fun,s_string -syn cluster c_path contains=s_compose,s_switch,s_par,s_break,s_super,s_angel,s_positional,s_marg,s_fun,s_group,s_refer -syn cluster c_type contains=@c_subglobal,@c_couple_nl,s_type,s_rarrow,s_sep,s_par,s_brk,s_var,s_simple_function,s_logical_op - -syn region r_top start=/\%^/ end=/@\@=/ skip=/\\@/ contains=s_comment - -syn region r_source start=/@source R$/ end=/@\@=/ skip=/\\@/ contains=s_section,@R -syn region r_source start=/@source py$/ end=/@\@=/ skip=/\\@/ contains=s_section,@Python -syn region r_source start=/@source pl$/ end=/@\@=/ skip=/\\@/ contains=s_section,@Perl -syn region r_source start=/@source sh$/ end=/@\@=/ skip=/\\@/ contains=s_section,@Shell - -syn region r_comment start=/@comment/ end=/@\@=/ skip=/\\@/ - -syn region r_alias start=/@alias/ end=/@\@=/ contains=@c_global,c_equal,@c_hasarg,@c_modify,s_utility - -syn region r_path start=/@path/ end=/@\@=/ contains=@c_global,@c_couple,@c_hasarg,@c_path -syn region r_assert start=/@assert/ end=/@\@=/ contains=@c_global,@c_hasarg,@c_modify,@c_path -syn region r_effect start=/@[0-9]/ end=/@\@=/ contains=@c_global,@c_hasarg,@c_modify,@c_path -syn region r_effect start=/@before/ end=/@\@=/ contains=@c_global,@c_hasarg,@c_modify,@c_path -syn region r_effect start=/@after/ end=/@\@=/ contains=@c_global,@c_hasarg,@c_modify,@c_path -syn region r_fail start=/@fail/ end=/@\@=/ contains=@c_global,@c_hasarg,@c_couple,@c_path - -syn region r_arg start=/@arg/ end=/@\@=/ contains=@c_global,@c_hasarg,s_positional,s_angel,@c_modify,s_arg -syn region r_cache start=/@cache/ end=/@\@=/ contains=@c_global,@c_hasarg,s_cache_function,@c_couple -syn region r_doc start=/@doc/ end=/@\@=/ contains=@c_global,@c_modify,s_string -syn region r_export start=/@export/ end=/@\@=/ contains=@c_global,s_export_keyword,s_pathsep,s_varlabel -syn region r_lang start=/@lang/ end=/@\@=/ contains=@c_global,@c_hasarg,@c_modify -syn region r_include start=/@include/ end=/@\@=/ contains=@c_subglobal,s_file -syn region r_import start=/@import/ end=/@\@=/ contains=@c_subglobal,s_import_keyword,s_var,s_string -syn region r_ontology start=/@ontology/ end=/@\@=/ contains=@c_type,s_bar,s_sep,s_par,s_brk -syn region r_type start=/@type/ end=/@\@=/ contains=@c_type,s_star - - - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Assign colors +" ============================================================================= +" K E Y W O R D S +" ----------------------------------------------------------------------------- +syn keyword reserved type +syn keyword reserved around +syn keyword reserved before +syn keyword reserved after +syn keyword reserved do +syn keyword reserved set +syn keyword reserved from +syn keyword reserved import +syn keyword reserved export +syn keyword reserved as +syn keyword reserved include +syn keyword reserved alias +syn keyword reserved where +syn keyword reserved data +syn keyword reserved typedef +" ----------------------------------------------------------------------------- +hi def link reserved Keyword + + + +" ============================================================================= +" P R I M A T I V E S +" ----------------------------------------------------------------------------- +syn region s_string start=/"/ end=/"/ +syn match s_num '\h\@/ +syn match operator /=/ +" ----------------------------------------------------------------------------- +hi def link operator Operator + -hi def link s_break Underlined + +" ============================================================================= +" M I S C E L L A N I A +" ----------------------------------------------------------------------------- +syn match s_varlabel ':\w\+' +syn match s_varlabel '<\w\+>' +" ----------------------------------------------------------------------------- hi def link s_varlabel Special -hi def link s_section Label - -hi def link s_export_keyword Keyword -hi def link s_import_keyword Keyword - -hi def link s_compose Operator -hi def link s_rarrow Operator -hi def link s_pathsep Operator -hi def link s_couple Operator -hi def link s_modify Operator -hi def link s_equal Operator -hi def link s_depend Operator -hi def link s_switch Operator -hi def link s_sep Operator -hi def link s_super Operator -hi def link s_angel Operator -hi def link s_bar Operator -hi def link s_num Number -hi def link s_string String + + +" ============================================================================= +" C O M M E N T S +" ----------------------------------------------------------------------------- +" define todo highlighting +syn keyword s_todo TODO NOTE FIXME XXX contained +syn match s_tag /\(Author\|Email\|Github\|Bugs\|Website\|Maintainer\|Description\):/ contained +" define comments +" syn match comment '\/\/.*$' contains=tag +" syn region comment start='\/\*' end='\*\/' contains=tag +syn match s_comment '#.*' contains=s_todo,s_tag +" ----------------------------------------------------------------------------- hi def link s_comment Comment -hi def link r_comment Comment hi def link s_todo Todo hi def link s_tag SpecialComment - -hi def link s_positional Identifier -hi def link s_refer Identifier -hi def link s_group Identifier -hi def link s_fun Identifier -hi def link s_marg Identifier - -hi def link DEFAULT_ERROR Error