mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
documented the ss command
This commit is contained in:
@@ -859,10 +859,13 @@ allCommands env@(pgf, mos) = Map.fromList [
|
|||||||
"Show compiled source code, i.e. as it is included in GF object files.",
|
"Show compiled source code, i.e. as it is included in GF object files.",
|
||||||
"This command requires a source grammar to be in scope, imported with 'import -retain'.",
|
"This command requires a source grammar to be in scope, imported with 'import -retain'.",
|
||||||
"The optional MODULE arguments cause just these modules to be shown.",
|
"The optional MODULE arguments cause just these modules to be shown.",
|
||||||
|
"The -size and -detailedsize options show code size as the number of constructor nodes.",
|
||||||
"This command must be a line of its own, and thus cannot be a part of a pipe."
|
"This command must be a line of its own, and thus cannot be a part of a pipe."
|
||||||
],
|
],
|
||||||
options = [
|
options = [
|
||||||
|
("detailedsize", "instead of code, show the sizes of all judgements and modules"),
|
||||||
("save", "save each MODULE in file MODULE.gfh instead of printing it on terminal"),
|
("save", "save each MODULE in file MODULE.gfh instead of printing it on terminal"),
|
||||||
|
("size", "instead of code, show the sizes of all modules"),
|
||||||
("strip","show only type signatures of oper's and lin's, not their definitions")
|
("strip","show only type signatures of oper's and lin's, not their definitions")
|
||||||
],
|
],
|
||||||
examples = [
|
examples = [
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ sizeInfo i = case i of
|
|||||||
ResOverload is fs -> 1 + sum [sizeTerm ty + sizeTerm tr | (L _ ty, L _ tr) <- fs]
|
ResOverload is fs -> 1 + sum [sizeTerm ty + sizeTerm tr | (L _ ty, L _ tr) <- fs]
|
||||||
CncCat mty mte mtf -> 1 + msize mty -- ignoring lindef and printname
|
CncCat mty mte mtf -> 1 + msize mty -- ignoring lindef and printname
|
||||||
CncFun mict mte mtf -> 1 + msize mte -- ignoring type and printname
|
CncFun mict mte mtf -> 1 + msize mte -- ignoring type and printname
|
||||||
AnyInd b f -> 0
|
AnyInd b f -> -1 -- just to ignore these in the size
|
||||||
_ -> 0
|
_ -> 0
|
||||||
where
|
where
|
||||||
msize mt = case mt of
|
msize mt = case mt of
|
||||||
@@ -121,7 +121,7 @@ sizesModule :: SourceModule -> (Int, [(Ident,Int)])
|
|||||||
sizesModule (_,m) =
|
sizesModule (_,m) =
|
||||||
let
|
let
|
||||||
js = Map.toList (jments m)
|
js = Map.toList (jments m)
|
||||||
tb = [(i,sizeInfo j) | (i,j) <- js]
|
tb = [(i,k) | (i,j) <- js, let k = sizeInfo j, k >= 0]
|
||||||
in (length tb + sum (map snd tb),tb)
|
in (length tb + sum (map snd tb),tb)
|
||||||
|
|
||||||
-- the size of a grammar
|
-- the size of a grammar
|
||||||
|
|||||||
Reference in New Issue
Block a user