Documentation

Core.NetworkPlusCal.Syntax

The output of Guarded2Network: a receive is no longer an abstract guard statement — it's compiled into a genuine second kind of thread, Thread.rx, that loops reading a process-local inbox sequence variable, and every later await/with guard that referenced the received value now reads that inbox instead. Reuses GuardedPlusCal.Block/Ref/Multicast/ Declarations unchanged — none of those shapes are affected by this pass, only Statement (drops receive) and Thread (gains a second, non-code constructor) are.

inductive NetworkPlusCal.Statement (Typ Expr : Type) :
BoolBoolType

A statement in the Network PlusCal language — identical to GuardedPlusCal.Statement minus receive (compiled away into Thread.rx by this pass), including with's ann : Typ field (GuardedPlusCal.Statement.with's doc comment explains why it's kept). The first Bool (guardClass) is true for a statement allowed in a branch's precondition (with/await); the second (terminal) is true only for goto.

Instances For
    @[implicit_reducible]
    instance NetworkPlusCal.instReprStatement {Typ✝ Expr✝ : Type} {a✝ a✝¹ : Bool} [Repr Typ✝] [Repr Expr✝] :
    Repr (Statement Typ✝ Expr✝ a✝ a✝¹)
    Equations
    def NetworkPlusCal.instReprStatement.repr {Typ✝ Expr✝ : Type} {a✝ a✝¹ : Bool} [Repr Typ✝] [Repr Expr✝] :
    Statement Typ✝ Expr✝ a✝ a✝¹Std.Format
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      @[implicit_reducible]
      instance NetworkPlusCal.instBifunctorStatement {b b' : Bool} :
      Bifunctor fun (x1 x2 : Type) => Statement x1 x2 b b'
      Equations
      • One or more equations did not get rendered due to their size.
      @[implicit_reducible]
      instance NetworkPlusCal.instBitraversableStatement {b b' : Bool} :
      Bitraversable fun (x1 x2 : Type) => Statement x1 x2 b b'
      Equations
      • One or more equations did not get rendered due to their size.
      structure NetworkPlusCal.AtomicBranch (Typ Expr : Type) :
      Instances For
        @[implicit_reducible]
        instance NetworkPlusCal.instReprAtomicBranch {Typ✝ Expr✝ : Type} [Repr Typ✝] [Repr Expr✝] :
        Repr (AtomicBranch Typ✝ Expr✝)
        Equations
        def NetworkPlusCal.instReprAtomicBranch.repr {Typ✝ Expr✝ : Type} [Repr Typ✝] [Repr Expr✝] :
        AtomicBranch Typ✝ Expr✝Std.Format
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          @[implicit_reducible]
          Equations
          • One or more equations did not get rendered due to their size.
          @[implicit_reducible]
          Equations
          • One or more equations did not get rendered due to their size.
          structure NetworkPlusCal.AtomicBlock (Typ Expr : Type) :
          Instances For
            def NetworkPlusCal.instReprAtomicBlock.repr {Typ✝ Expr✝ : Type} [Repr Typ✝] [Repr Expr✝] :
            AtomicBlock Typ✝ Expr✝Std.Format
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              @[implicit_reducible]
              instance NetworkPlusCal.instReprAtomicBlock {Typ✝ Expr✝ : Type} [Repr Typ✝] [Repr Expr✝] :
              Repr (AtomicBlock Typ✝ Expr✝)
              Equations
              @[implicit_reducible]
              Equations
              • One or more equations did not get rendered due to their size.
              @[implicit_reducible]
              Equations
              • One or more equations did not get rendered due to their size.
              inductive NetworkPlusCal.Thread (Typ Expr : Type) :

              One parallel {...} thread — either ordinary code (a sequence of labelled atomic blocks, in program order, same shape as GuardedPlusCal.Thread) or a dedicated receiving loop: drains chan of type τ into a process-local inbox sequence variable (fresh per process, via Guarded2Network.freshName). A real second kind of thread, not folded into .code, since its body isn't a List AtomicBlock — see the module doc.

              label is the receiving loop's own block label. .rx's meaning is the single atomic block label : receive(chan, tmp) ; inbox := Append(inbox, tmp) ; goto label, without the temporary variable tmp ever being assigned to — so the loop needs a label of its own to be scheduled by, and to be the target of its own terminal goto, whereas tmp is never written and needs no name at all. Both are freshly generated, so this one field carries the one that matters.

              Instances For
                @[implicit_reducible]
                instance NetworkPlusCal.instReprThread {Typ✝ Expr✝ : Type} [Repr Typ✝] [Repr Expr✝] :
                Repr (Thread Typ✝ Expr✝)
                Equations
                def NetworkPlusCal.instReprThread.repr {Typ✝ Expr✝ : Type} [Repr Typ✝] [Repr Expr✝] :
                Thread Typ✝ Expr✝Std.Format
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  @[implicit_reducible]
                  Equations
                  • One or more equations did not get rendered due to their size.
                  @[implicit_reducible]
                  Equations
                  • One or more equations did not get rendered due to their size.
                  structure NetworkPlusCal.Process (Typ Expr : Type) :
                  Instances For
                    def NetworkPlusCal.instReprProcess.repr {Typ✝ Expr✝ : Type} [Repr Typ✝] [Repr Expr✝] :
                    Process Typ✝ Expr✝Std.Format
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      @[implicit_reducible]
                      instance NetworkPlusCal.instReprProcess {Typ✝ Expr✝ : Type} [Repr Typ✝] [Repr Expr✝] :
                      Repr (Process Typ✝ Expr✝)
                      Equations
                      @[implicit_reducible]
                      Equations
                      • One or more equations did not get rendered due to their size.
                      @[implicit_reducible]
                      Equations
                      • One or more equations did not get rendered due to their size.
                      structure NetworkPlusCal.Algorithm (Typ Expr : Type) :
                      Instances For
                        @[implicit_reducible]
                        instance NetworkPlusCal.instReprAlgorithm {Typ✝ Expr✝ : Type} [Repr Typ✝] [Repr Expr✝] :
                        Repr (Algorithm Typ✝ Expr✝)
                        Equations
                        def NetworkPlusCal.instReprAlgorithm.repr {Typ✝ Expr✝ : Type} [Repr Typ✝] [Repr Expr✝] :
                        Algorithm Typ✝ Expr✝Std.Format
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          @[implicit_reducible]
                          Equations
                          • One or more equations did not get rendered due to their size.
                          @[implicit_reducible]
                          Equations
                          • One or more equations did not get rendered due to their size.