I think it's possible to figure out the structure of the Lagrangian automatically.