Advanced control techniques, particularly Model Predictive Control (MPC), have proven effective in enhancing energy efficiency within buildings. While MPC remains a prominent choice, alternative strategies like program synthesis, employing large language models, warrant exploration. Despite its success in diverse applications and the inherent advantage of explainability, the performance of program synthesis in the building domain remains largely unexplored. Implemented through the Synthesize, Execute, Debug, and Rank framework with a pretrained GPT model, program synthesis is compared with MPC in an energy management problem using the BOPTEST building optimization testing framework. The test scenario involves a residential dwelling with a modulating heat pump. MPC, incorporating a graybox model recalibrated using real-time data, excels in improving thermal comfort in typical conditions, achieving a notable 35.5\% reduction in energy costs. In extreme peak conditions, MPC maintains thermal comfort improvements at a slightly higher energy cost. Program synthesis, while enhancing thermal comfort, lags behind MPC, revealing some trade-off challenges in certain scenarios. Notably, a program synthesis designed for a specific scenario demonstrates adaptability, achieving desired objectives across diverse scenarios. These findings emphasize the potential of program synthesis in optimizing energy efficiency and thermal comfort but underscore the importance of nuanced parameterization and scenario-specific optimization for its successful implementation in building control strategies.