Compression & Expansion basically relate to a change in Volume i.e. [itex]\Delta V \ne 0[/itex]
Expansion is negative of Compression. Depending on your sign convention, either of them will be positive. Generally, [itex]\Delta V[/itex] is taken as [itex]\Delta V = V_f - V_i[/itex] and hence compression corresponds to a negative [itex]\Delta V[/itex] i.e. [itex]-\Delta V_c > 0[/itex]
Also, if a conservative force is applied for either of the process, the work done for the same [itex]|\Delta V|[/itex] will have the same magnitude.
Under constant pressure, the work done in doing either of the process is given as:
[tex]
W = P\Delta V[/tex]
and for non-constant pressure, we express it in a differential equation. Note that here, Pressure will be some function of Volume and may also depend on Temperature which in turn maybe another function of Volume.
[tex]
\int^{W}_0 dW = \int^{V_f}_{V_i}PdV[/tex]
This holds only when there is no energy exchange from the system to the surrounding or vice versa in any form other than the force applied on the piston.