code: def demo3():
      from nltk import Production
  
      (S, VP, NP, PP, P, N, Name, V, Det) = nonterminals(
          "S, VP, NP, PP, P, N, Name, V, Det"
      )
  
      productions = (
          # Syntactic Productions
          Production(S, [NP, VP]),
          Production(NP, [Det, N]),
          Production(NP, [NP, PP]),
          Production(VP, [VP, PP]),
          Production(VP, [V, NP, PP]),
          Production(VP, [V, NP]),
          Production(PP, [P, NP]),
          Production(PP, []),
          Production(PP, ["up", "over", NP]),
          # Lexical Productions
          Production(NP, ["I"]),
          Production(Det, ["the"]),
          Production(Det, ["a"]),
          Production(N, ["man"]),
          Production(V, ["saw"]),
          Production(P, ["in"]),
          Production(P, ["with"]),
          Production(N, ["park"]),
          Production(N, ["dog"]),
          Production(N, ["statue"]),
          Production(Det, ["my"]),
      )
  
      t = Tk()
  
      def destroy(e, t=t):
          t.destroy()
  
      t.bind("q", destroy)
      p = ProductionList(t, productions)
      p.pack(expand=1, fill="both")
      p.add_callback("select", p.markonly)
      p.add_callback("move", p.markonly)
      p.focus()
      p.mark(productions[2])
      p.mark(productions[8])
  
imports: import re
  from tkinter import Button, Canvas, Entry, Frame, IntVar, Label, Scrollbar, Text, Tk, Toplevel
  from nltk.draw.tree import TreeSegmentWidget, tree_to_treesegment
  from nltk.draw.util import CanvasFrame, ColorizedList, ShowText, SymbolWidget, TextWidget
  from nltk.grammar import CFG, Nonterminal, _read_cfg_production, nonterminals
  from nltk.tree import Tree
label_desc: Use image node_id 3 for calling a global function with example usage: demo3() without return types