mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 08:32:50 -06:00
started a grammar for grammatical terms, covering the cats of the RGL
This commit is contained in:
13
examples/grammar-terms/MkTerms.hs
Normal file
13
examples/grammar-terms/MkTerms.hs
Normal file
@@ -0,0 +1,13 @@
|
||||
main = interact (unlines . map (mkTerm . words) . lines)
|
||||
|
||||
mkTerm ws = case ws of
|
||||
"==":cat:"-":expl -> unlines [
|
||||
mkFun "Cat" cat,
|
||||
mkLin "Cat" "mkN" cat (unwords (takeWhile (/= "==") expl))
|
||||
]
|
||||
|
||||
mkFun pref s = unwords ["fun", pref ++ s, ":", pref, ";"]
|
||||
---mkLin pref p s e = unwords ["lin", pref ++ s, "=", p, quoted e, ";"]
|
||||
mkLin pref p s e = unwords ["lin", pref ++ s, "=", quoted s, ";"]
|
||||
|
||||
quoted s = "\"" ++ s ++ "\""
|
||||
Reference in New Issue
Block a user