code: def p_str_assign(p):
      
      if p[1].upper() != 'LET':
          q = p[1]
          r = p[4]
          s = p[2]
          lineno = p.lineno(3)
      else:
          q = p[2]
          r = p[5]
          s = p[3]
          lineno = p.lineno(4)
  
      if q is None or s is None:
          p[0] = None
          return
  
      if r.type_ != TYPE.string:
          api.errmsg.syntax_error_expected_string(lineno, r.type_)
  
      entry = SYMBOL_TABLE.access_var(q, lineno, default_type=TYPE.string)
      if entry is None:
          p[0] = None
          return
  
      p[0] = make_sentence('LETSUBSTR', entry, s[0], s[1], r)
docs: statement : ID substr EQ expr
                    | LET ID substr EQ expr