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
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
8332a83d
...
@@ -96,18 +96,16 @@ generated functions use its functions.
...
@@ -96,18 +96,16 @@ generated functions use its functions.
### Namespace declarations
### Namespace declarations
A namespace declaration consists of the namespace's name, a sort name, and
A namespace declaration consists of the namespace's name and the associated sort
optionally additional comma separated sort names (the environment of the
name.
namespace).
```
```
namespace NAMESPACENAME: SORTNAME
[, SORTNAME]*
namespace NAMESPACENAME: SORTNAME
```
```
Example:
Example:
```
```
namespace TermVar: Term, Type
namespace TermVar: Term
namespace TypeVar: Type
```
```
### Sort declarations
### Sort declarations
...
...
Specifications/ExEff.txt
View file @
8332a83d
import (Operations)
import (Operations)
namespace TermVar: Value
, ValueType
namespace TermVar: Value
namespace SkelTypeVar: SkeletonType
namespace SkelTypeVar: SkeletonType
namespace DirtVar: Dirt
namespace DirtVar: Dirt
namespace TypeVar: ValueType
, SkeletonType
namespace TypeVar: ValueType
namespace CoVar: Coercion
, SimpleCoercionType
namespace CoVar: Coercion
sort Value
sort Value
inh ctx TermVar
inh ctx TermVar
...
...
Specifications/FCo.txt
View file @
8332a83d
namespace TermVar: Term
, Type
namespace TermVar: Term
namespace TypeVar: Type
namespace TypeVar: Type
sort Term
sort Term
...
...
Specifications/Fi+.txt
View file @
8332a83d
namespace TermVar: FiTerm
, FiType
namespace TermVar: FiTerm
namespace TypeVar: FiType
, FiType
namespace TypeVar: FiType
sort FiTerm
sort FiTerm
inh ctx TermVar
inh ctx TermVar
...
...
Specifications/systemF.txt
View file @
8332a83d
namespace TermVar: Term
, Type
namespace TermVar: Term
namespace TypeVar: Type
namespace TypeVar: Type
sort Term
sort Term
...
...
Tool/Converter.hs
View file @
8332a83d
...
@@ -7,7 +7,6 @@ import GeneralTerms
...
@@ -7,7 +7,6 @@ import GeneralTerms
-- variable representation
-- variable representation
data
ConvertFunctions
=
VF
{
data
ConvertFunctions
=
VF
{
variableType
::
Language
->
(
Type
,
[
Constructor
]),
variableType
::
Language
->
(
Type
,
[
Constructor
]),
envType
::
Language
->
(
Type
,
[
Constructor
]),
userTypes
::
Language
->
[(
Type
,
[
Constructor
])],
userTypes
::
Language
->
[(
Type
,
[
Constructor
])],
variableInstances
::
(
Type
,
[
Constructor
])
->
[(
Type
,
Type
,
[
Function
])],
variableInstances
::
(
Type
,
[
Constructor
])
->
[(
Type
,
Type
,
[
Function
])],
variableFunctions
::
Language
->
(
Type
,
[
Constructor
])
->
[
Function
],
variableFunctions
::
Language
->
(
Type
,
[
Constructor
])
->
[
Function
],
...
@@ -19,10 +18,9 @@ data ConvertFunctions = VF {
...
@@ -19,10 +18,9 @@ data ConvertFunctions = VF {
convert
::
Language
->
ConvertFunctions
->
Program
convert
::
Language
->
ConvertFunctions
->
Program
convert
lan
@
(
nsd
,
sd
,
imp
,
cd
)
vf
=
convert
lan
@
(
nsd
,
sd
,
imp
,
cd
)
vf
=
let
var
=
(
variableType
vf
)
lan
let
var
=
(
variableType
vf
)
lan
env
=
(
envType
vf
)
lan
in
P
{
in
P
{
imports
=
imp
,
imports
=
imp
,
types
=
var
:
env
:
(
userTypes
vf
)
lan
,
types
=
var
:
(
userTypes
vf
)
lan
,
instances
=
(
variableInstances
vf
)
var
,
instances
=
(
variableInstances
vf
)
var
,
functions
=
(
variableFunctions
vf
)
lan
var
++
functions
=
(
variableFunctions
vf
)
lan
var
++
(
envFunctions
vf
)
lan
,
(
envFunctions
vf
)
lan
,
...
...
Tool/GeneralTerms.hs
View file @
8332a83d
...
@@ -42,8 +42,7 @@ type AttributeDef = (LeftExpr, RightExpr)
...
@@ -42,8 +42,7 @@ type AttributeDef = (LeftExpr, RightExpr)
data
NamespaceDef
data
NamespaceDef
=
MkNameSpace
{
=
MkNameSpace
{
nname
::
NamespaceName
,
nname
::
NamespaceName
,
nsort
::
SortName
,
nsort
::
SortName
nenv
::
[
String
]
}
}
deriving
(
Show
,
Eq
)
deriving
(
Show
,
Eq
)
...
...
Tool/Parser.hs
View file @
8332a83d
...
@@ -100,8 +100,7 @@ pImportChoose = try (pParens $ many pIdentifier) <|> return []
...
@@ -100,8 +100,7 @@ pImportChoose = try (pParens $ many pIdentifier) <|> return []
pNameSpaceDecl
::
Parser
NamespaceDef
pNameSpaceDecl
::
Parser
NamespaceDef
pNameSpaceDecl
=
pNameSpaceDecl
=
MkNameSpace
<$
pReserved
"namespace"
<*>
pNameSpaceName
<*
pReservedOp
":"
<*>
MkNameSpace
<$
pReserved
"namespace"
<*>
pNameSpaceName
<*
pReservedOp
":"
<*>
pSortName
<*>
pSortName
pEnvAdd
-- | Parse a namespace's name
-- | Parse a namespace's name
pNameSpaceName
::
Parser
NamespaceName
pNameSpaceName
::
Parser
NamespaceName
...
@@ -111,13 +110,6 @@ pNameSpaceName = pIdentifier
...
@@ -111,13 +110,6 @@ pNameSpaceName = pIdentifier
pSortName
::
Parser
SortName
pSortName
::
Parser
SortName
pSortName
=
pIdentifier
pSortName
=
pIdentifier
pEnvAdd
::
Parser
[
String
]
pEnvAdd
=
many
$
do
pReservedOp
","
pIdentifier
-- * Sort declarations
-- * Sort declarations
-- ----------------------------------------------------------------------------
-- ----------------------------------------------------------------------------
...
...
Tool/Variable/Common.hs
View file @
8332a83d
{-# OPTIONS_GHC -Wall #-}
{-# 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.List
import
Data.Maybe
import
Data.Maybe
...
@@ -19,15 +19,6 @@ data ExternalFunctions = EF {
...
@@ -19,15 +19,6 @@ data ExternalFunctions = EF {
-- * Types
-- * 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
::
Language
->
[
Function
]
getEnvFunctions
(
nsd
,
sd
,
_
,
_
)
getEnvFunctions
(
nsd
,
sd
,
_
,
_
)
...
...
Tool/Variable/DeBruijn.hs
View file @
8332a83d
...
@@ -13,7 +13,6 @@ getFunctions :: ConvertFunctions
...
@@ -13,7 +13,6 @@ getFunctions :: ConvertFunctions
getFunctions
getFunctions
=
VF
{
=
VF
{
variableType
=
getVariableType
,
variableType
=
getVariableType
,
envType
=
getEnvType
,
userTypes
=
getTypes
,
userTypes
=
getTypes
,
variableInstances
=
getVariableInstances
,
variableInstances
=
getVariableInstances
,
variableFunctions
=
getVariableFunctions
,
variableFunctions
=
getVariableFunctions
,
...
...
Tool/Variable/String.hs
View file @
8332a83d
...
@@ -14,7 +14,6 @@ getFunctions :: ConvertFunctions
...
@@ -14,7 +14,6 @@ getFunctions :: ConvertFunctions
getFunctions
getFunctions
=
VF
{
=
VF
{
variableType
=
getVariableType
,
variableType
=
getVariableType
,
envType
=
getEnvType
,
userTypes
=
getTypes
,
userTypes
=
getTypes
,
variableInstances
=
getVariableInstances
,
variableInstances
=
getVariableInstances
,
variableFunctions
=
getVariableFunctions
,
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