To make a light dimmer you have to use a non-zero crossing triac driver. For example, the MOC3051/52. These are sometimes called "Random Phase Triac Drivers".
You typically also need a zero crossing detector. To control the brightness you vary the time delay between each zero crossing and triggering the triac, from close to zero (for close to full power) to almost 1/2 cycle (for almost no power). This is called phase control, and it causes continuous EMI from the switching (which should be filtered) and sometimes the filaments 'sing' audibly with the current pulses.
You cannot realistically smoothly control the brightness of an incandescent bulb with a zero crossing triac driver, though you might be able to get a few discrete steps, especially if you don't care about putting harmonics on the power line- for example you could turn the lamp on or off during 3 consecutive 1/2 cycles (then repeat) giving you 0/3, 1/3, 2/3 and 3/3. And get 1/2 by turning on and off for 1/2 cycles like a diode. You might still see undesirable flicker, especially at 2/3.
PWM as you suggest can be used to control something like a slow heater or other device that has a long time constant relative to the PWM timebase, which in turn should be many AC cycles. For heaters we often use a timebase in the 2-20 second range. Obviously that would cause undesirable flicker on an ordinary light bulb.