Let
$\phantom {\dot {i}\!}\mathbb {F}_{q}$
be a finite field of order q, where q = ps is a power of a prime number p. Let m and m1 be two positive integers such that m1 divides m. For any positive divisor e of q − 1, we construct an infinite family of codes with dimension m + m1 and few weights over
$\phantom {\dot {i}\!}\mathbb {F}_{q}$
. Using Gauss sum, their weight distributions are provided. When gcd(e, m) = 1, we obtain a subclass of optimal codes which attain the Griesmer bound. Moreover, when gcd(e, m) =...