summaryrefslogtreecommitdiff
path: root/examples/unix/UnixUni.gf
blob: b1b220824da57ea1cd9e7901c8e7cbcd91a1b3d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--# -path=.:prelude

concrete UnixUni of Unix = CharUni ** open Prelude in {

  flags unlexer=bind ;

{-
  lincat
    Line ;
    [Command] {1} ;
    Command ;
    File ;
-}

  lin
    CommWords w = w ;

    Redirect = infixSS ">" ;
    Pipe = infixSS "|" ;
    Comm c = c ;

    WhatTime = ss ["date +%D"] ;
    WhatDate = ss ["date +%T"] ;
    WhereNow = ss ["pwd"] ;
    Remove = prefixSS "rm" ;
    Copy x y = ss ("cp" ++ x.s ++ y.s) ;
    Linecount = prefixSS ["wc -l"] ;
    Wordcount = prefixSS ["wc -w"] ;
    Grep x y = ss ("grep" ++ x.s ++ y.s) ;
    Cat = prefixSS "cat" ;

    It = ss [] ;

    FileChars c = c ;
    WordChars c = c ;

    FileSuffix = prefixSS ["* &+"] ;
    FilePrefix = postfixSS ["&+ *"] ;

    BaseWord w = w ;
    ConsWord = cc2 ;

}