def p_service(self, p):
        '''service : SERVICE IDENTIFIER '{' function_seq '}' annotations
                   | SERVICE IDENTIFIER EXTENDS IDENTIFIER \
                     '{' function_seq '}' annotations
        '''

        if len(p) == 7:
            p[0] = ast.Service(
                name=p[2],
                functions=p[4],
                parent=None,
                annotations=p[6],
                lineno=p.lineno(2),
            )
        else:
            p[0] = ast.Service(
                name=p[2],
                functions=p[6],
                parent=ast.ServiceReference(p[4], p.lineno(4)),
                annotations=p[8],
                lineno=p.lineno(2),
            )