def f_lossy(self, program, is_rir):
    """Transforms a single program to its lossy IR."""

    lir = str(program)

    # replace FROM clause with an "alias" token
    as_command_regex = r" ([^ ]+? as [^ ]+?) "
    as_commands = re.findall(as_command_regex, program)
    for as_command in as_commands:
      lir = lir.replace(as_command, "alias")
    lir = lir.replace(" alias ,", "")

    # anonymize table names
    table_name_regex = r" ([^ ]+?)\.[^ ]+? "
    table_names = re.findall(table_name_regex, lir)
    for table in table_names:
      lir = lir.replace(table, "table")

    # remove table join conditions
    regex_1 = r"and [^ ]+? = [^ ]+? "
    lir = self._remove_table_joins(lir, regex_1)
    regex_2 = r"[^ ]+? = [^ ]+? and "
    lir = self._remove_table_joins(lir, regex_2)
    return lir
Transforms a single program to its lossy IR.
language/compir/dataset_parsers/sql_parser.py