def get_files(file_tokens, cwd=None):
    """ Given a list of parser file tokens, return a list of input objects
    for them.
    """
    if not file_tokens:
        return []

    token = file_tokens.pop()
    try:
        filename = token.filename
    except AttributeError:
        filename = ''

    if cwd:
        input = Input(token.alias, filename, cwd=cwd)
    else:
        input = Input(token.alias, filename)

    return [input] + get_files(file_tokens)