def METHOD_NAME(script: Script):
    """parse bpftrace script (read variable semantics, add continuous output)"""
    found_metadata = re.findall(r'^//\s*([\w\-]+)' +  # key
                                r'(?:\s*:\s*(.+?)\s*)?$',  # optional value
                                script.code, re.MULTILINE)
    for key, val in found_metadata:
        if key == 'name':
            if re.match(r'^[a-zA-Z_]\w+$', val):
                script.metadata.name = val
            else:
                raise BPFtraceError(f"invalid value '{val}' for {key}: "
                                    f"must contain only alphanumeric characters and "
                                    f"start with a letter")
        elif key == 'include':
            script.metadata.include = val.split(',')
        elif key == 'table-retain-lines':
            if val.isdigit():
                script.metadata.table_retain_lines = int(val)
            else:
                raise BPFtraceError(f"invalid value '{val}' for {key}, "
                                    f"must be numeric")
        elif key == 'custom-output-block':
            script.metadata.custom_output_block = True
    all_variables = re.findall(r'(@.*?)' +  # variable
                               r'(?:\[(.+?)\])?' +  # optional map key
                               r'\s*=\s*' +  # assignment
                               r'(?:([a-zA-Z]\w*)\s*\()?',  # optional function
                               script.code)
    for var, key, func in all_variables:
        if script.metadata.include is not None and var not in script.metadata.include:
            continue
        vardef = VariableDefinition(single=True, semantics=PM_SEM_INSTANT, datatype=PM_TYPE_U64,
                                    metrictype=None)
        if func in ['hist', 'lhist']:
            if key:
                raise BPFtraceError("every histogram needs to be in a separate variable")
            vardef.single = False
            vardef.semantics = PM_SEM_COUNTER
            vardef.metrictype = MetricType.Histogram
        elif func == 'count':
            vardef.single = not bool(key)
            vardef.semantics = PM_SEM_COUNTER
            if re.search(r'(^|,)[ku]stack($|,)', key):
                vardef.metrictype = MetricType.Stacks
        else:
            vardef.single = not bool(key)
            vardef.semantics = PM_SEM_INSTANT
        script.variables[var] = vardef
    output_fns = re.search(r'(printf|time)\s*\(', script.code)
    if output_fns and (script.metadata.include is None or '@output' in script.metadata.include):
        if '@output' in script.variables:
            raise BPFtraceError("output from printf(), time() etc. will be stored in @output. "
                                "please rename the existing @output variable or remove any "
                                "calls to any function which produces output")
        script.variables['@output'] = VariableDefinition(single=True, semantics=PM_SEM_INSTANT,
                                                         datatype=PM_TYPE_STRING,
                                                         metrictype=MetricType.Output)
    if not script.variables:
        raise BPFtraceError("no bpftrace variables or printf statements found, please include "
                            "at least one variable or printf statement in your script")
    if script.metadata.name:
        script.persistent = True
    return script