forked from GitHub/gf-rgl
a script for counting lines of code in RGL implementations
This commit is contained in:
98
doc/CountLines.hs
Normal file
98
doc/CountLines.hs
Normal file
@@ -0,0 +1,98 @@
|
||||
import System.Directory
|
||||
import Data.Char
|
||||
import Data.List
|
||||
|
||||
-- counting modules and lines in RGL implementations
|
||||
-- leaving out Lexicon, Structural, dictionaries, Extra, Extend,... (see below the list of prefixes)
|
||||
|
||||
main = do
|
||||
mapM_ getCounts allLanguages
|
||||
|
||||
getCounts (lan,language) = do
|
||||
cs <- mapM (getCount language lan) prefixes
|
||||
let (ms,ls) = unzip cs
|
||||
putStrLn $ unwords [language, show (sum ms), show (sum ls)]
|
||||
|
||||
getCount language lan pref = do
|
||||
let file = concat ["../src/",language,"/",pref,lan,".gf"]
|
||||
--- putStrLn file
|
||||
ms <- readFileIf file
|
||||
case ms of
|
||||
Nothing -> return (0,0)
|
||||
Just s -> return (1,length (codeLines (lines s)))
|
||||
|
||||
codeLines ls = filter (\l -> not (all isSpace l || isPrefixOf "--" l)) ls
|
||||
|
||||
readFileIf name = do
|
||||
b <- doesFileExist name
|
||||
case b of
|
||||
True -> readFile name >>= return . Just
|
||||
False -> return Nothing
|
||||
|
||||
|
||||
prefixes = [
|
||||
"Adjective"
|
||||
,"Adverb"
|
||||
,"Cat"
|
||||
,"Common"
|
||||
,"Conjunction"
|
||||
,"Diff"
|
||||
,"Grammar"
|
||||
,"Lang"
|
||||
-- ,"Lexicon"
|
||||
,"Noun"
|
||||
,"Numeral"
|
||||
,"Phrase"
|
||||
,"Question"
|
||||
,"Relative"
|
||||
,"Sentence"
|
||||
-- ,"Structural"
|
||||
,"Tense"
|
||||
,"Text"
|
||||
,"Verb"
|
||||
,"Res"
|
||||
,"Morpho"
|
||||
,"Phono"
|
||||
,"Paradigms"
|
||||
]
|
||||
|
||||
allLanguages = [
|
||||
("Afr","afrikaans")
|
||||
,("Ara","arabic")
|
||||
--- ,("Bul","bulgarian") ---- todo convert to utf8
|
||||
,("Cat","catalan")
|
||||
,("Chi","chinese")
|
||||
,("Dan","danish")
|
||||
,("Dut","dutch")
|
||||
,("Eng","english")
|
||||
,("Est","estonian")
|
||||
,("Eus","basque")
|
||||
,("Fin","finnish")
|
||||
,("Fre","french")
|
||||
,("Ger","german")
|
||||
,("Gre","greek")
|
||||
,("Hin","hindi")
|
||||
,("Ice","icelandic")
|
||||
,("Ita","italian")
|
||||
,("Jpn","japanese")
|
||||
,("Lav","latvian")
|
||||
,("Mlt","maltese")
|
||||
,("Mon","mongolian")
|
||||
,("Nep","nepali")
|
||||
,("Nno","nynorsk")
|
||||
,("Nor","norwegian")
|
||||
,("Pes","persian")
|
||||
,("Pnb","punjabi")
|
||||
,("Pol","polish")
|
||||
,("Por","portuguese")
|
||||
---- ,("Ron","romanian")
|
||||
,("Rus","russian")
|
||||
,("Snd","sindhi")
|
||||
,("Spa","spanish")
|
||||
,("Swe","swedish")
|
||||
,("Tha","thai")
|
||||
,("Urd","urdu")
|
||||
,("Romance","romance")
|
||||
,("Scand","scandinavian")
|
||||
,("Hindustani","hindustani")
|
||||
]
|
||||
@@ -15,17 +15,18 @@ that are currently available via http://grammaticalframework.org
|
||||
are marked in the table
|
||||
|
||||
|
||||
|| ISO | Language | Darcs | Mini | Parad | Lex | Lang | API | Symb | Irreg | Dict | Trans | tested | publ | authors ||
|
||||
|| ISO | Language | Git | Mini | Parad | Lex | Lang | API | Symb | Irreg | Dict | Trans | tested | publ | authors ||
|
||||
| Afr | Afrikaans | + | - | ++ | + | + | + | - | - | - | - | - | - | *LP,LM
|
||||
| Amh | Amharic | + | + | ++ | + | + | - | - | - | - | - | - | + | *MK
|
||||
| Ara | Arabic | + | + | + | + | - | - | - | - | - | - | - | + | AD
|
||||
| Ara | Arabic | + | + | + | + | + | + | + | - | - | - | + | + | AD,*IL
|
||||
| Bul | Bulgarian | + | + | + | + | + | + | + | + | + | + | ++ | + | *KA
|
||||
| Cat | Catalan | + | + | ++ | + | + | + | + | + | - | + | ++ | - | *JS,*IL
|
||||
| Chi | Chinese | + | - | ++ | + | + | + | - | - | + | + | - | + | ZL,*AR,*CP,QH
|
||||
| Dan | Danish | + | + | ++ | + | + | + | + | + | - | - | + | - | *AR
|
||||
| Dut | Dutch | + | + | ++ | + | + | + | + | + | - | + | + | - | *AR,FJ
|
||||
| Eng | English | + | + | ++ | + | + | + | + | + | + | + | ++ | + | *AR,BB,KA
|
||||
| Est | Estonian | + | - | ++ | + | + | + | - | - | - | - | + | + | *KK,*IL
|
||||
| Est | Estonian | + | - | ++ | + | + | + | - | - | + | + | + | + | *KK,*IL
|
||||
| Eus | Basquw | + | - | ++ | + | + | + | - | - | - | - | - | + | *IL
|
||||
| Fin | Finnish | + | + | ++ | + | + | + | + | - | + | + | ++ | + | *AR,*IL
|
||||
| Fre | French | + | + | ++ | + | + | + | + | + | + | + | ++ | - | *AR,RE
|
||||
| Ger | German | + | + | ++ | + | + | + | + | + | + | + | ++ | - | *AR,HH,EG
|
||||
@@ -44,9 +45,10 @@ are marked in the table
|
||||
| Nep | Nepali | + | + | ++ | + | + | - | - | - | - | - | - | + | *DS
|
||||
| Nno | Norwegian(n) | + | + | ++ | + | + | + | + | + | - | - | - | - | *SRE
|
||||
| Nor | Norwegian(b) | + | + | ++ | + | + | + | + | + | - | - | + | - | *AR
|
||||
| Pes | Persian | + | - | + | + | + | + | - | - | - | - | + | + | *SV,*EA,SM
|
||||
| Pes | Persian | + | - | + | + | + | + | - | - | - | - | + | + | SV,EA,SM,*IL
|
||||
| Pnb | Punjabi | + | + | + | + | + | + | + | - | - | - | - | + | *SV,MH
|
||||
| Pol | Polish | + | + | + | + | + | + | + | - | - | - | + | + | IN,*AS
|
||||
| Por | Portuguese | + | + | ++ | + | + | + | + | + | - | + | + | - | *BC
|
||||
| Ron | Romanian | + | + | ++ | + | + | + | + | - | - | - | + | + | *RE
|
||||
| Rus | Russian | + | + | ++ | + | + | + | - | - | + | + | - | + | JK,*NF
|
||||
| Snd | Sindhi | + | + | ++ | + | + | + | + | - | - | - | - | + | *SV,*JD
|
||||
@@ -61,9 +63,7 @@ are marked in the table
|
||||
ISO = 3-letter ISO language code, used in library file names
|
||||
(mostly ISO 639-2 B (bibliographic))
|
||||
|
||||
Darcs = available in the darcs repository of --http://code.haskell.org/gf-- http://www.grammaticalframework.org/
|
||||
|
||||
Mini = minimal resource, compiles with ``make minimal`` (obsolete)
|
||||
Git = available in the gf-rgl Git repository
|
||||
|
||||
Parad = ``Paradigms`` file complete for major POS, ++ means with smart paradigms
|
||||
|
||||
@@ -73,7 +73,7 @@ Lang = the resource ``Syntax`` (nearly) complete
|
||||
|
||||
API = the ``Syntax`` compiles
|
||||
|
||||
API = the ``Symbolic`` API compiles
|
||||
Symb = the ``Symbolic`` API compiles
|
||||
|
||||
Irreg = the ``Irreg`` module with irregular verbs exists
|
||||
|
||||
@@ -95,6 +95,7 @@ AB Ansu Berg,
|
||||
AD Ali El Dada,
|
||||
AR Aarne Ranta,
|
||||
AS Adam Slaski,
|
||||
BC Bruno Cuconato,
|
||||
BB Björn Bringert,
|
||||
BT Bjarki Traustason,
|
||||
CK Chotiros Kairoje,
|
||||
|
||||
Reference in New Issue
Block a user