Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gilles Coremans
ASTTool
Commits
8332a83d
Commit
8332a83d
authored
Oct 13, 2019
by
marton bognar
Browse files
Remove environments from namespace declarations
parent
ee201fd6
Changes
11
Show whitespace changes
Inline
Side-by-side
README.md
View file @
8332a83d
...
...
@@ -96,18 +96,16 @@ generated functions use its functions.
### Namespace declarations
A namespace declaration consists of the namespace's name, a sort name, and
optionally additional comma separated sort names (the environment of the
namespace).
A namespace declaration consists of the namespace's name and the associated sort
name.
```
namespace NAMESPACENAME: SORTNAME
[, SORTNAME]*
namespace NAMESPACENAME: SORTNAME
```
Example:
```
namespace TermVar: Term, Type
namespace TypeVar: Type
namespace TermVar: Term
```
### Sort declarations
...
...
Specifications/ExEff.txt
View file @
8332a83d
import (Operations)
namespace TermVar: Value
, ValueType
namespace TermVar: Value
namespace SkelTypeVar: SkeletonType
namespace DirtVar: Dirt
namespace TypeVar: ValueType
, SkeletonType
namespace CoVar: Coercion
, SimpleCoercionType
namespace TypeVar: ValueType
namespace CoVar: Coercion
sort Value
inh ctx TermVar
...
...
Specifications/FCo.txt
View file @
8332a83d
namespace TermVar: Term
, Type
namespace TermVar: Term
namespace TypeVar: Type
sort Term
...
...
Specifications/Fi+.txt
View file @
8332a83d
namespace TermVar: FiTerm
, FiType
namespace TypeVar: FiType
, FiType
namespace TermVar: FiTerm
namespace TypeVar: FiType
sort FiTerm
inh ctx TermVar
...
...
Specifications/systemF.txt
View file @
8332a83d
namespace TermVar: Term
, Type
namespace TermVar: Term
namespace TypeVar: Type
sort Term
...
...
Tool/Converter.hs
View file @
8332a83d
...
...
@@ -7,7 +7,6 @@ import GeneralTerms
-- variable representation
data
ConvertFunctions
=
VF
{
variableType
::
Language
->
(
Type
,
[
Constructor
]),
envType
::
Language
->
(
Type
,
[
Constructor
]),
userTypes
::
Language
->
[(
Type
,
[
Constructor
])],
variableInstances
::
(
Type
,
[
Constructor
])
->
[(
Type
,
Type
,
[
Function
])],
variableFunctions
::
Language
->
(
Type
,
[
Constructor
])
->
[
Function
],
...
...
@@ -19,10 +18,9 @@ data ConvertFunctions = VF {
convert
::
Language
->
ConvertFunctions
->
Program
convert
lan
@
(
nsd
,
sd
,
imp
,
cd
)
vf
=
let
var
=
(
variableType
vf
)
lan
env
=
(
envType
vf
)
lan
in
P
{
imports
=
imp
,
types
=
var
:
env
:
(
userTypes
vf
)
lan
,
types
=
var
:
(
userTypes
vf
)
lan
,
instances
=
(
variableInstances
vf
)
var
,
functions
=
(
variableFunctions
vf
)
lan
var
++
(
envFunctions
vf
)
lan
,
...
...
Tool/GeneralTerms.hs
View file @
8332a83d
...
...
@@ -42,8 +42,7 @@ type AttributeDef = (LeftExpr, RightExpr)
data
NamespaceDef
=
MkNameSpace
{
nname
::
NamespaceName
,
nsort
::
SortName
,
nenv
::
[
String
]
nsort
::
SortName
}
deriving
(
Show
,
Eq
)
...
...
Tool/Parser.hs
View file @
8332a83d
...
...
@@ -100,8 +100,7 @@ pImportChoose = try (pParens $ many pIdentifier) <|> return []
pNameSpaceDecl
::
Parser
NamespaceDef
pNameSpaceDecl
=
MkNameSpace
<$
pReserved
"namespace"
<*>
pNameSpaceName
<*
pReservedOp
":"
<*>
pSortName
<*>
pEnvAdd
pSortName
-- | Parse a namespace's name
pNameSpaceName
::
Parser
NamespaceName
...
...
@@ -111,13 +110,6 @@ pNameSpaceName = pIdentifier
pSortName
::
Parser
SortName
pSortName
=
pIdentifier
pEnvAdd
::
Parser
[
String
]
pEnvAdd
=
many
$
do
pReservedOp
","
pIdentifier
-- * Sort declarations
-- ----------------------------------------------------------------------------
...
...
Tool/Variable/Common.hs
View file @
8332a83d
{-# OPTIONS_GHC -Wall #-}
module
Variable.Common
(
getEnvType
,
getEnvFunctions
,
freeVarFunctions
,
mappingFunctions
,
sortNameForIden
,
firstToVarParams
,
dropFold
,
ExternalFunctions
(
..
),
applyInhCtxsToAttrs
,
inhCtxsForSortName
)
where
module
Variable.Common
(
getEnvFunctions
,
freeVarFunctions
,
mappingFunctions
,
sortNameForIden
,
firstToVarParams
,
dropFold
,
ExternalFunctions
(
..
),
applyInhCtxsToAttrs
,
inhCtxsForSortName
)
where
import
Data.List
import
Data.Maybe
...
...
@@ -19,15 +19,6 @@ data ExternalFunctions = EF {
-- * Types
-- ----------------------------------------------------------------------------
-- | Generate the data type definition for Env
getEnvType
::
Language
->
(
Type
,
[
Constructor
])
getEnvType
(
nsd
,
_
,
_
,
_
)
=
(
"Env"
,
Constr
"Nil"
[]
:
map
(
\
(
MkNameSpace
name
_
env
)
->
Constr
(
'E'
:
name
)
(
env
++
[
"Env"
])
)
nsd
)
-- | ??
getEnvFunctions
::
Language
->
[
Function
]
getEnvFunctions
(
nsd
,
sd
,
_
,
_
)
...
...
Tool/Variable/DeBruijn.hs
View file @
8332a83d
...
...
@@ -13,7 +13,6 @@ getFunctions :: ConvertFunctions
getFunctions
=
VF
{
variableType
=
getVariableType
,
envType
=
getEnvType
,
userTypes
=
getTypes
,
variableInstances
=
getVariableInstances
,
variableFunctions
=
getVariableFunctions
,
...
...
Tool/Variable/String.hs
View file @
8332a83d
...
...
@@ -14,7 +14,6 @@ getFunctions :: ConvertFunctions
getFunctions
=
VF
{
variableType
=
getVariableType
,
envType
=
getEnvType
,
userTypes
=
getTypes
,
variableInstances
=
getVariableInstances
,
variableFunctions
=
getVariableFunctions
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment