A spatial computer is a distributed multi-agent system that is embedded in a geometric space. A key challenge is engineering local agent interaction rules that enable spatial computers to robustly achieve global computational tasks. This paper develops a principled approach to global-to-local programming, for pattern formation problems in a one-dimensional multi-agent model. We present theoretical analysis that addresses the existence, construction, and resource tradeoffs of robust local rule solutions to global patterns, and which together form a "global-to-local compiler".