Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
racr-mquat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
René Schöne
racr-mquat
Commits
267e1e92
Commit
267e1e92
authored
9 years ago
by
René Schöne
Browse files
Options
Downloads
Patches
Plain Diff
[WIP] ast-find-child with * to solve problems?
parent
494a0809
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Makefile
+1
-1
1 addition, 1 deletion
Makefile
ag-test.scm
+6
-1
6 additions, 1 deletion
ag-test.scm
ast-generation.scm
+7
-6
7 additions, 6 deletions
ast-generation.scm
basic-ag.scm
+9
-6
9 additions, 6 deletions
basic-ag.scm
with
23 additions
and
14 deletions
Makefile
+
1
−
1
View file @
267e1e92
...
...
@@ -42,4 +42,4 @@ clean:
rm
-rf
$(
LARCENY_BUILD_DIR
)
/
*
run
:
racket
fab call_racket:cli.scm,ag |
tee
ast-output.txt | less
fab call_racket:cli.scm,ag
2>&1
|
tee
ast-output.txt | less
This diff is collapsed.
Click to expand it.
ag-test.scm
+
6
−
1
View file @
267e1e92
...
...
@@ -14,6 +14,11 @@
;; Testing printing whole asts
;; num-pe=10, num-pe-subs=0, num-comp=3, impl-per-comp=4, mode-per-impl=5
(
define
(
display-part2
node
)
(
define
(
print
name
)
(
cons
name
(
lambda
(
v
)
v
)))
(
define
printer
(
list
(
print
'remote-unit
)))
(
print-ast
node
printer
(
current-output-port
)))
(
define
(
do-it
.
args
)
(
let*
([
ast
(
create-system
10
0
3
4
5
)]
; [clause (car (->* (->Clause* (car (->* (->Mode* (car (->* (->Impl* (car (->* (->Comp* (->SWRoot ast)))))))))))))]
...
...
@@ -24,4 +29,4 @@
; (display (=ilp-eval-binvar clause pe))
; (rewrite-terminal 'value prov-clause (rand 1 3 0))
; (display (=ilp-eval-binvar clause pe))
(
display-part
ast
))))
(
display-part
2
ast
))))
This diff is collapsed.
Click to expand it.
ast-generation.scm
+
7
−
6
View file @
267e1e92
...
...
@@ -48,10 +48,11 @@
(
let
([
entry
(
assq
nr
types-al
)])
(
if
entry
(
cdr
entry
)
(
let
([
new
(
make-type
nr
container?
)])
(
set!
types-al
(
cons
(
cons
nr
new
)
types-al
))
new
))))
(
define
(
create-hw-clause
udfs
name
property
)
(
let
([
f
(
create-clause
udfs
default-hw-clause-gen
name
)])
(
if
f
(
let
([
args
(
f
(
->name
property
))])
(
if
(
eq?
args
#t
)
(
set!
args
(
default-hw-clause-gen
(
->name
property
))))
(
if
args
((
car
args
)
property
(
cadr
args
)
(
caddr
args
))
#f
))
(
let
([
f
(
create-clause
udfs
default-hw-clause-gen
name
)]
[
property-name
(
if
(
ast-subtype?
property
'RealProperty
)
(
->name
property
)
(
ast-child
'refname
property
))])
(
if
f
(
let
([
args
(
f
property-name
)])
(
if
(
eq?
args
#t
)
(
set!
args
(
default-hw-clause-gen
property-name
)))
(
if
args
((
car
args
)
property-name
(
cadr
args
)
(
caddr
args
))
#f
))
#f
)))
(
define
(
default-hw-clause-gen
property-name
)
(
cond
...
...
@@ -137,13 +138,13 @@
(
cons
sw-root
(
car
(
prop
last-comp-nr
)))))
(
define
(
create-request
target-property
)
(
let*
([
make-req
(
lambda
(
p
maxVal
digits
offset
)
(
:ReqClause
mquat-spec
p
comp-min-eq
(
rand
maxVal
digits
offset
)))]
(
let*
([
make-req
(
lambda
(
p
ropname
maxVal
digits
offset
)
(
:ReqClause
mquat-spec
(
:PropertyRef
mquat-spec
propname
)
comp-min-eq
(
rand
maxVal
digits
offset
)))]
[
target
(
<<-
target-property
)])
(
debug
"create-request: target-property = "
target-property
)
(
:Request
mquat-spec
(
list
(
:MetaParameter
mquat-spec
mp-name
((
rand
100
2
0
))))
target
(
list
(
make-req
target-property
1
2
0
))
#f
)))
;TODO: check type of target-property (terminal?, Property?)
target
(
list
(
make-req
(
->name
(
=real
target-property
))
1
2
0
))
#f
)))
;TODO: check type of target-property (terminal?, Property?)
; Creates a new system.
; num-pe: total number of resources
...
...
This diff is collapsed.
Click to expand it.
basic-ag.scm
+
9
−
6
View file @
267e1e92
...
...
@@ -64,7 +64,7 @@
(
define
(
=value-attr
n
)
(
att-value
'value-attr
n
))
(
define
(
=value-of
n
name
)
(
att-value
'value-of
n
name
))
(
define
(
find-prop
propname
subtree
)
(
ast-find-child
(
lambda
(
i
n
)
(
string=?
propname
(
->name
n
)))
subtree
))
(
define
(
find-prop
propname
subtree
)
(
ast-find-child
*
(
lambda
(
i
n
)
(
string=?
propname
(
->name
n
)))
subtree
))
(
define
(
add-basic-ags
mquat-spec
)
(
with-specification
...
...
@@ -187,13 +187,13 @@
lookup-property
(
Root
(
lambda
(
n
propname
)
(
or
(
=lookup-property
(
->SWRoot
n
)
propname
)
(
=lookup-property
(
->HWRoot
n
)
propname
)
(
error
"Could not find "
propname
))))
(
SWRoot
(
lambda
(
n
propname
)
(
or
(
find-prop
propname
(
->RealProperty*
n
))
(
ast-find-child
(
lambda
(
i
c
)
(
=lookup-property
c
propname
))
(
->Comp*
n
)))))
(
ast-find-child
*
(
lambda
(
i
c
)
(
=lookup-property
c
propname
))
(
->Comp*
n
)))))
(
Comp
(
lambda
(
n
propname
)
(
find-prop
propname
(
->Property*
n
))))
(
HWRoot
(
lambda
(
n
propname
)
(
or
(
ast-find-child
(
lambda
(
i
rt
)
(
=lookup-property
rt
propname
))
(
->ResourceType*
n
))
(
ast-find-child
(
lambda
(
i
r
)
(
=lookup-property
r
propname
))
(
->SubResources
n
)))))
(
HWRoot
(
lambda
(
n
propname
)
(
or
(
ast-find-child
*
(
lambda
(
i
rt
)
(
=lookup-property
rt
propname
))
(
->ResourceType*
n
))
(
ast-find-child
*
(
lambda
(
i
r
)
(
=lookup-property
r
propname
))
(
->SubResources
n
)))))
(
ResourceType
(
lambda
(
n
propname
)
(
find-prop
propname
(
->RealProperty*
n
))))
(
Resource
(
lambda
(
n
propname
)
(
or
(
find-prop
propname
(
->Property*
n
))
(
ast-find-child
(
lambda
(
i
sr
)
(
=lookup-property
sr
propname
))
(
->SubResources
n
))))))
(
ast-find-child
*
(
lambda
(
i
sr
)
(
=lookup-property
sr
propname
))
(
->SubResources
n
))))))
; <=impl: Get Impl in subtree of the Impl
(
ag-rule
get-impl
(
Impl
(
lambda
(
n
)
n
)))
...
...
@@ -253,7 +253,7 @@
(
ag-rule
real
(
RealProperty
(
lambda
(
n
)
n
))
(
PropertyRef
(
lambda
(
n
)
(
info
n
", refname="
(
ast-child
'refname
n
)
", hasParent="
(
ast-has-parent?
n
))
(
=real
(
=lookup-property
(
<=root
n
)
(
ast-child
'refname
n
)))))
)
(
PropertyRef
(
lambda
(
n
)
(
debug
n
", refname="
(
ast-child
'refname
n
)
", hasParent="
(
ast-has-parent?
n
))
(
=lookup-property
(
<=root
n
)
(
ast-child
'refname
n
)))))
; =req-comp-map: Returns a associate list, mapping required components to a list of implementations requiring that component
(
ag-rule
...
...
@@ -315,6 +315,9 @@
; =selected?: Returns #t, if the Implementation is selected by its component
(
ag-rule
selected?
(
Impl
(
lambda
(
n
)
(
eq?
(
->selected-impl
(
<<-
n
))
n
))))
; =remote-unit: Returns the unit of the RealProperty the PropertyRef is pointing to
(
ag-rule
remote-unit
(
PropertyRef
(
lambda
(
n
)
(
->unit
(
=real
n
)))))
; =value-of: Given a metaparameter name, return the value of the according metaparameter
(
ag-rule
value-of
(
Request
(
lambda
(
n
name
)
(
ast-find-child*
(
lambda
(
i
child
)
(
and
(
string=?
(
->name
child
)
name
)
(
->value
child
)))
...
...
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