• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
      • Proof-checker-array
      • Soft
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Ethereum
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • Zcash
      • Des
      • X86isa
      • Sha-2
      • Yul
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Axe
      • Poseidon
      • Where-do-i-place-my-book
      • Aleo
        • Aleobft
        • Aleovm
        • Leo
          • Grammar
          • Early-version
            • Json2ast
              • Json2ast-mutual-recursion-expressions
              • Json-fixtype-span-removal
              • Json2ast-mutual-recursion-statements
              • Json-value-is-span-object-p
              • Json-value-is-core-span-object-p
              • Json2ast-mutual-recursion-types
              • J2f-struct-declaration
                • J2f-console-statement
                • Jsonast-looks-like-function-definition-p
                • J2f-function-definition
                • J2f-assign-statement
                • Json-member-is-span-p
                • J2f-struct-declarations
                • J2f-let-or-const-statement
                • J2f-console-error
                • J2f-struct-members
                • J2f-return-statement
                • J2f-function-definitions
                • J2f-console-log
                • J2f-console-assert
                • Jsonast-looks-like-struct-declaration-p
                • J2f-funinputs
                • J2f-if-statement-tail
                • Jsonast-looks-like-file-p
                • J2f-iteration-statement
                • J2f-if-statement
                • J2f-block-statement
                • J2f-statements
                • J2f-statement
                • J2f-type
              • Testing
              • Definition
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Json2ast

    J2f-struct-declaration

    Converts a single member of the structs of a file to a leo::topdecl-struct.

    Signature
    (j2f-struct-declaration json-struct) 
      → 
    (mv erp leo-top-struct-declaration)
    Arguments
    json-struct — Guard (json::memberp json-struct).
    Returns
    erp — Type (booleanp erp).
    leo-top-struct-declaration — Type (topdeclp leo-top-struct-declaration).

    Definitions and Theorems

    Function: j2f-struct-declaration

    (defun j2f-struct-declaration (json-struct)
     (declare (xargs :guard (json::memberp json-struct)))
     (let ((__function__ 'j2f-struct-declaration))
      (declare (ignorable __function__))
      (if
       (not (and (json::memberp json-struct)
                 (jsonast-looks-like-struct-declaration-p json-struct)))
       (mv t *error-definition*)
       (b*
        ((struct-name-with-span (json::member->name json-struct))
         (struct-name (extract-identifier-name struct-name-with-span))
         ((unless (identifier-string-p struct-name))
          (mv t *error-definition*))
         (inner-struct-val (json::member->value json-struct))
         ((unless (equal :object (json::value-kind inner-struct-val)))
          (mv t *error-definition*))
         (array-of-struct-members
              (json::object-member-value "members" inner-struct-val))
         ((unless
              (equal :array (json::value-kind array-of-struct-members)))
          (mv t *error-definition*))
         (json-struct-members
              (json::value-array->elements array-of-struct-members))
         ((mv erp leo-members)
          (j2f-struct-members json-struct-members))
         ((when erp)
          (mv
           t
           (make-topdecl-struct
              :get (make-structdecl
                        :name (make-identifier :name "ERROR_in_members")
                        :components leo-members))))
         (leo-struct
              (make-structdecl :name (make-identifier :name struct-name)
                               :components leo-members)))
        (mv nil
            (make-topdecl-struct :get leo-struct))))))