code: def parse_grammar(
      args: TypeTuple, verb: GrammarVerb
  ) -> TypeList[GrammarTerm]:
      # if the command is a launch, check if any shorthands were employed
      if verb.command == "launch":
          args = launch_shorthand_support(args=args)
  
      arg_list = list(args)
      arg_count = len(arg_list)
      errors = []
      if validate_arg_count(arg_count=arg_count, verb=verb):
          terms = []
          abbreviation = verb.abbreviations[arg_count]
          for i, term_type in enumerate(abbreviation):
              if term_type is None:
                  arg = None  # use None so we get the default
              else:
                  arg = arg_list.pop(0)  # use a real arg
  
              term_settings = verb.full_sentence[i]
  
              try:
                  term = term_settings["klass"](**term_settings)
                  term.parse_input(arg)
                  terms.append(term)
  
              except BadGrammar as e:
                  errors.append(str(e))
  
          if len(errors) > 0:
              raise BadGrammar("\n".join(errors))
  
          # make command
          return terms
      else:
          raise BadGrammar("Grammar is not valid")
  
imports: from __future__ import annotations
  import socket
  from typing import Any
  from typing import Callable
  from typing import Dict
  from typing import List
  from typing import Optional
  from typing import Tuple
  from typing import Union
  from .deps import allowed_hosts
  from .lib import find_available_port
label_desc: Use image node_id 3 for calling a global function with example usage: parse_grammar(args, verb) and returns: terms