summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-04-12 21:14:32 +0000
committeraarne <aarne@cs.chalmers.se>2006-04-12 21:14:32 +0000
commite07d9dea344e79bfa90def98d965d422b288f600 (patch)
tree61a8b0c4304bca3dc82157197b660b347f3e8953 /examples
parenta42a232c5756593e0681598f940c84f555af09d8 (diff)
unix command grammar started
Diffstat (limited to 'examples')
-rw-r--r--examples/unix/Unix.gf24
-rw-r--r--examples/unix/UnixEng.gf30
-rw-r--r--examples/unix/UnixUni.gf30
3 files changed, 84 insertions, 0 deletions
diff --git a/examples/unix/Unix.gf b/examples/unix/Unix.gf
new file mode 100644
index 000000000..c1ddd742b
--- /dev/null
+++ b/examples/unix/Unix.gf
@@ -0,0 +1,24 @@
+abstract Unix = {
+
+ cat
+ S ;
+ Line ;
+ Command ;
+ File ;
+
+ fun
+ Pipe : Command -> S -> S ;
+ Comm : Command -> S ;
+
+ WhatTime : Command ;
+ WhatDate : Command ;
+ WhereNow : Command ;
+ Remove : File -> Command ;
+ Copy : File -> File -> Command ;
+ Linecount : File -> Command ;
+ Wordcount : File -> Command ;
+
+ Name : String -> File ;
+ It : File ;
+
+}
diff --git a/examples/unix/UnixEng.gf b/examples/unix/UnixEng.gf
new file mode 100644
index 000000000..3bed08bc5
--- /dev/null
+++ b/examples/unix/UnixEng.gf
@@ -0,0 +1,30 @@
+--# -path=.:prelude
+
+concrete UnixEng of Unix = open Prelude in {
+
+ flags unlexer=textlit ; lexer=textlit ;
+
+{-
+ lincat
+ Line ;
+ [Command] {1} ;
+ Command ;
+ File ;
+-}
+
+ lin
+ Pipe = infixSS "then" ;
+ Comm c = c ;
+
+ WhatTime = ss ["what time is it"] ;
+ WhatDate = ss ["what date is it"] ;
+ WhereNow = ss ["where am I now"] ;
+ Remove = prefixSS "remove" ;
+ Copy x y = ss ("copy" ++ x.s ++ "to" ++ y.s) ;
+ Linecount = prefixSS ["how many lines has"] ;
+ Wordcount = prefixSS ["how many words has"] ;
+
+ Name x = x ;
+ It = ss "it" ;
+
+}
diff --git a/examples/unix/UnixUni.gf b/examples/unix/UnixUni.gf
new file mode 100644
index 000000000..e0898853f
--- /dev/null
+++ b/examples/unix/UnixUni.gf
@@ -0,0 +1,30 @@
+--# -path=.:prelude
+
+concrete UnixUni of Unix = open Prelude in {
+
+ flags unlexer=codelit ; lexer=codelit ;
+
+{-
+ lincat
+ Line ;
+ [Command] {1} ;
+ Command ;
+ File ;
+-}
+
+ lin
+ 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"] ;
+
+ Name x = x ;
+ It = ss [] ;
+
+}