X-Git-Url: https://ruin.nu/git/?p=proglang.git;a=blobdiff_plain;f=formalsemantics;fp=formalsemantics;h=a94c4db5cc0e979862f5b9b6d294cd82d5e1d509;hp=0000000000000000000000000000000000000000;hb=2c2f90fca1005f6dedc69ee7f3d7c5072e5c123b;hpb=4f21d932178a490040cf5e054f3ba9d006579368 diff --git a/formalsemantics b/formalsemantics new file mode 100644 index 0000000..a94c4db --- /dev/null +++ b/formalsemantics @@ -0,0 +1,86 @@ +INTERPOL - ANTICS ++++++++++++++++++ + + + + |> v means that e evaluates to v in the state o. + + + + +basic arithmetic operations. + +(PLUS) + |> v <= |> v1 & |> v2 & v is the sum of v1 and v2 + + +(MINUS) + |> v <= |> v1 & |> v2 & v is v1 subtracted from v2 + + +(MULT) + |> v <= |> v1 & |> v2 & v is the product of v1 and v2 + + +(DIV) + |> v <= |> v1 & |> v2 & v is v1 divided by v2 + + + +basic comparative operations. + + +(Less Than) + + |> true <= |> v1 & |> v2 & v1 is smaller than v2 + |> false <= |> v1 & |> v2 & v1 is larger than or as large as v2 + + |> true <= |> v1 & |> v2 & v1 is smaller than or as small as v2 + |> false <= |> v1 & |> v2 & v1 is larger than v2 + ++similar rules apply for greater than+ + + +(Equal, Not Equal) + + |> true <= |> v1 & |> v2 & v1 is equal to v2 + |> false <= |> v1 & |> v2 & v1 is not equal to v2 + + |> true <= |> v1 & |> v2 & v1 is not equal to to v2 + |> false <= |> v1 & |> v2 & v1 is equal to v2 + + + +(Not, Neg) + + |> false <= |> true + |> true <= |> false + +<-e, o> |> v2 <= |> v1 & v2 is the negative value of v1 + + + + +(Int) + |> n <= + +(Bool) + |> b <= + + + + + +(If) + |> o' <= |> true & |> o' + |> o' <= |> false & |> o' + +(While) + |> o'' <= |> true & |> o' & |> o'' + |> o <= |> false + +(Assign) + |> o[x->v] <= |> v + +(Seq) + |> o'' <= |> o' & |> o''