Exemplo n.º 1
0
func (g *Grammar) NewRule(lhs_id SymbolID, rhs_ids []SymbolID) RuleID {
	i_rhs := make([]C.Marpa_Symbol_ID, len(rhs_ids))
	for i, id := range rhs_ids {
		i_rhs[i] = C.Marpa_Symbol_ID(id)
	}
	return RuleID(C.marpa_g_rule_new(g.handle, C.Marpa_Symbol_ID(lhs_id), &i_rhs[0], C.int(len(rhs_ids))))
}
Exemplo n.º 2
0
func (g *Grammar) NewRule(lhs_id SymbolID, rhs_ids []SymbolID, length int) RuleID {
	return RuleID(C.marpa_g_rule_new(g.handle, C.Marpa_Symbol_ID(lhs_id), C.Marpa_Symbol_ID*(rhs_ids), C.int(length)))
}