• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Community
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
      • Operational-semantics
      • Real
      • Start-here
      • Debugging
      • Miscellaneous
      • Output-controls
      • Macros
      • Interfacing-tools
        • Io
        • Defttag
        • Sys-call
        • Save-exec
        • Quicklisp
        • Std/io
        • Oslib
        • Bridge
        • Clex
        • Tshell
        • Unsound-eval
        • Hacker
        • ACL2s-interface
        • Startup-banner
        • Command-line
          • Save-exec
          • Argv
          • Getopt
            • Demo-p
            • Defoptions
            • Demo2
              • Demo2-opts-p
              • Demo2-main
              • Parsers
              • Sanity-check-formals
              • Formal->parser
              • Formal->argname
              • Formal->longname
              • Formal->alias
              • Formal->usage
              • Formal->merge
              • Formal->hiddenp
      • Interfacing-tools
        • Io
        • Defttag
        • Sys-call
        • Save-exec
        • Quicklisp
        • Std/io
        • Oslib
        • Bridge
        • Clex
        • Tshell
        • Unsound-eval
        • Hacker
        • ACL2s-interface
        • Startup-banner
        • Command-line
          • Save-exec
          • Argv
          • Getopt
            • Demo-p
            • Defoptions
            • Demo2
              • Demo2-opts-p
              • Demo2-main
              • Parsers
              • Sanity-check-formals
              • Formal->parser
              • Formal->argname
              • Formal->longname
              • Formal->alias
              • Formal->usage
              • Formal->merge
              • Formal->hiddenp
        • Hardware-verification
        • Software-verification
        • Math
        • Testing-utilities
      • Demo2

      Demo2-main

      Run the demo2 program.

      Definitions and Theorems

      Function: demo2-main

      (defun demo2-main (state)
       (b*
        (((mv argv state) (argv))
         ((mv errmsg opts ?extra-args)
          (parse-demo2-opts argv))
         ((when errmsg)
          (cw "~@0~%" errmsg)
          (exit 1)
          state)
         ((demo2-opts opts) opts)
         ((when opts.help)
          (b*
           ((-
              (cw "demo2: how to write a command line program in ACL2~%"))
            (state (princ$ *demo2-opts-usage* *standard-co* state))
            (- (cw "~%")))
           (exit 0)
           state))
         ((when opts.version)
          (cw "demo2: version 1.234~%")
          (exit 0)
          state)
         ((when opts.fail) (exit 1) state))
        (cw "colorless green ideas sleep furiously~%")
        (exit 0)
        state))