Generalized polynomials and associated semigroups