"\ me \ (b\<^sub>1,c\<^sub>1) \ (bv\<^sub>1,c\<^sub>2); me \ (b\<^sub>2,c\<^sub>2) \ (bv\<^sub>2,c\<^sub>3) \ \
me \<turnstile> (And b\<^sub>1 b\<^sub>2,c\<^sub>1) \<rightarrow> (bv\<^sub>1\<and>bv\<^sub>2,c\<^sub>3)" |
"\ me \ (e\<^sub>1,c\<^sub>1) \ (r\<^sub>1,c\<^sub>2); me \ (e\<^sub>2,c\<^sub>2) \ (r\<^sub>2,c\<^sub>3) \ \
me \<turnstile> (Eq e\<^sub>1 e\<^sub>2,c\<^sub>1) \<rightarrow> (r\<^sub>1=r\<^sub>2,c\<^sub>3)"
code_pred (modes: i => i => o => bool) big_step .
text\<open>Example: natural numbers encoded as objects with a predecessor
field. Null is zero. Method succ adds an object in front, method add
adds as many objects in front as the parameter specifies.
First, the method bodies:\<close>
definition "m_succ = (''s'' ::= New)\''pred'' ::= V ''this''; V ''s''"
definition"m_add = IF Eq (V ''param'') Null THEN V ''this''
ELSE V ''this''\<bullet>''succ''<Null>\<bullet>''add''<V ''param''\<bullet>''pred''>"
text\<open>The main code, adding 1 and 2:\<close> definition"main = ''1'' ::= Null\<bullet>''succ''<Null>; ''2'' ::= V ''1''\<bullet>''succ''<Null>;
V ''2''\<bullet> ''add'' <V ''1''>"
text\<open>Execution of semantics. The final variable environment and store are
converted into lists of references based on given lists of variable and field
names toextract.\<close>
values "{(r, map ve' [''1'',''2''], map (\n. map (s' n)[''pred'']) [0..
r ve' s' n. menv \<turnstile> (main, \<lambda>x. null, nth[], 0) \<Rightarrow> (r,ve',s',n)}"
end
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.