code: def p_start(p):
      
      global ast, data_ast
  
      user_data = make_label('.ZXBASIC_USER_DATA', 0)
      make_label('.ZXBASIC_USER_DATA_LEN', 0)
  
      if PRINT_IS_USED:
          zxbpp.ID_TABLE.define('___PRINT_IS_USED___', 1)
          # zxbasmpp.ID_TABLE.define('___PRINT_IS_USED___', 1)
  
      if zxblex.IN_STATE:
          p.type = 'NEWLINE'
          p_error(p)
          sys.exit(1)
  
      ast = p[0] = p[1]
      __end = make_sentence('END', make_number(0, lineno=p.lexer.lineno))
  
      if not is_null(ast):
          ast.appendChild(__end)
      else:
          ast = __end
  
      SYMBOL_TABLE.check_labels()
      SYMBOL_TABLE.check_classes()
  
      if gl.has_errors:
          return
  
      __DEBUG__('Checking pending labels', 1)
      if not api.check.check_pending_labels(ast):
          return
  
      __DEBUG__('Checking pending calls', 1)
      if not api.check.check_pending_calls():
          return
  
      data_ast = make_sentence('BLOCK', user_data)
  
      # Appends variable declarations at the end.
      for var in SYMBOL_TABLE.vars_:
          data_ast.appendChild(make_var_declaration(var))
  
      # Appends arrays declarations at the end.
      for var in SYMBOL_TABLE.arrays:
          data_ast.appendChild(make_array_declaration(var))
docs: start : program