Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cool
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hans-Peter Deifel
cool
Commits
77644d14
Commit
77644d14
authored
10 years ago
by
Thorsten Wißmann
Browse files
Options
Downloads
Patches
Plain Diff
Allow functors to get parameters in the syntax
parent
c49eea11
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/coalg/coalg.ml
+3
-0
3 additions, 0 deletions
src/coalg/coalg.ml
src/lib/FunctorParsing.ml
+22
-6
22 additions, 6 deletions
src/lib/FunctorParsing.ml
src/lib/FunctorParsing.mli
+1
-1
1 addition, 1 deletion
src/lib/FunctorParsing.mli
with
26 additions
and
7 deletions
src/coalg/coalg.ml
+
3
−
0
View file @
77644d14
...
...
@@ -38,6 +38,9 @@ let nomTable name =
let
_
=
Gc
.
set
{
(
Gc
.
get
()
)
with
Gc
.
minor_heap_size
=
4194304
;
major_heap_increment
=
67108864
;
space_overhead
=
120
}
let
_
=
let
str
=
"A . B C"
in
print_endline
(
FE
.
stringFromFunctorExp
(
FE
.
functorExpFromString
str
))
let
printUsage
()
=
print_endline
"Usage:
\"
alc <task> <functor> [<flags>]
\"
where"
;
...
...
This diff is collapsed.
Click to expand it.
src/lib/FunctorParsing.ml
+
22
−
6
View file @
77644d14
...
...
@@ -5,16 +5,16 @@ type functorExp =
|
Choice
of
functorExp
*
functorExp
|
Fusion
of
functorExp
*
functorExp
|
Composition
of
functorExp
*
functorExp
|
Unary
of
string
|
Unary
of
string
list
(* a non-empty list of identifiers *)
let
rec
stringFromFunctorExp
=
function
|
Unary
str
->
str
|
Unary
str
->
String
.
concat
" "
str
|
Composition
(
a
,
b
)
->
"("
^
(
stringFromFunctorExp
a
)
^
" . "
^
(
stringFromFunctorExp
b
)
^
")"
|
Choice
(
a
,
b
)
->
"("
^
(
stringFromFunctorExp
a
)
^
" + "
^
(
stringFromFunctorExp
b
)
^
")"
|
Fusion
(
a
,
b
)
->
"("
^
(
stringFromFunctorExp
a
)
^
" * "
^
(
stringFromFunctorExp
b
)
^
")"
(* example
Choice (Unary "K", Fusion (Unary "KD", Unary "GML"))
Choice (Unary
[
"K"
]
, Fusion (Unary
[
"KD"
]
, Unary
[
"GML"
]
))
*)
...
...
@@ -49,6 +49,7 @@ let functorExpFromString str : functorExp =
|
Some
'
'
->
(
Stream
.
junk
stream
;
dropWhitespace
()
)
|
_
->
()
in
(* try to parse an identifier as long as possible *)
let
identifier
()
=
let
rec
ident
()
=
match
(
Stream
.
peek
stream
)
with
...
...
@@ -60,6 +61,20 @@ let functorExpFromString str : functorExp =
in
implode
(
ident
()
)
in
(* try to parse as many identifiers, separated by whitespace, as possible *)
let
rec
identifier_list
()
=
dropWhitespace
()
;
let
i
=
identifier
()
in
(* get the next identifier *)
if
(
String
.
length
i
<>
0
)
then
i
::
(
identifier_list
()
)
else
[]
in
let
nonempty_identifier_list
()
=
let
idlist
=
identifier_list
()
in
if
List
.
length
idlist
<>
0
then
idlist
else
error
"Expected list of at least one identifiers but got none"
in
let
rec
parse
(
state
:
state
)
:
functorExp
=
let
_
=
dropWhitespace
()
in
let
binary
(
operator
:
char
)
(
nextStep
:
state
)
...
...
@@ -88,7 +103,7 @@ let functorExpFromString str : functorExp =
|
_
->
error
"Missing closing )"
end
|
None
->
error
"Expected identifier but got end of string"
|
Some
ch
->
Unary
(
identifier
()
)
|
Some
ch
->
Unary
(
nonempty_
identifier
_list
()
)
end
in
let
result
=
parse
ParseSum
in
...
...
@@ -118,9 +133,10 @@ let sortTableFromFunctorExp (fe:functorExp) : CoAlgReasoner.sortTable =
afterwards.
*)
match
fe
with
|
Unary
str
->
|
Unary
str
_list
->
let
nr
=
getLineNr
()
in
(
fun
parameter
->
[
(
logicName2Functor
str
,
[
parameter
])])
,
nr
let
functorname
=
List
.
hd
str_list
in
(
fun
parameter
->
[
(
logicName2Functor
functorname
,
[
parameter
])])
,
nr
|
Choice
(
a
,
b
)
->
let
nr
=
getLineNr
()
in
let
(
a_table
,
a_nr
)
=
generateSorts
a
in
...
...
This diff is collapsed.
Click to expand it.
src/lib/FunctorParsing.mli
+
1
−
1
View file @
77644d14
...
...
@@ -4,7 +4,7 @@ type functorExp =
|
Choice
of
functorExp
*
functorExp
|
Fusion
of
functorExp
*
functorExp
|
Composition
of
functorExp
*
functorExp
|
Unary
of
string
|
Unary
of
string
list
(* a nonempty list of identifiers *)
exception
FunctorParsingFailed
of
string
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment