For what it's worth, I ended up with this:
%%{
machine nmea;
action store { *wptr = fc; }
action append { *wptr++ = fc; }
action term { *wptr++ = 0; }
integer = digit+;
float = digit+ '.' digit+;
rmc = '$GPRMC,'
float ','
[AV] >{ wptr = &loc.valid; } $store ','
float? >{ wptr = loc.lat; } $append %term ','
[NS]? >{ wptr = &loc.ns; } $store ','
float? >{ wptr = loc.lng; } $append %term ','
[EW]? >{ wptr = &loc.ew; } $store
print*
'\n' >{ printf("%c, %s, %c, %s, %c\n", loc.valid, loc.lat, loc.ns, loc.lng, loc.ew); }
;
main := any* rmc;
}%%