Learning semantic functions of attribute grammars