Design note
One rule at a time
Begin the language with a single task and an explicit empty list.
On this page
The first proposed parsing milestone is deliberately small:
all: []
This is a design sketch. The current executable does not parse it yet, and the syntax may change as the implementation develops.
Make the empty case visible
all names a task. [] says that its dependency list is empty. The absence of
dependencies is visible in the source, rather than something the reader has to
infer from a blank space after the colon.
The intended behavior is equally small: asking for this task would succeed without doing any work. Omitting a recipe would not cause Sew to look for an implicit one.
An empty file is a different case. It contains no task at all. Keeping these cases distinct gives the parser and the command line behavior a clear starting point.
Write the parser by hand
For this first case, a handwritten parser keeps the path from input to result easy to follow. There is only a name, a colon, and an empty list to recognize.
The aim is to introduce syntax as it becomes useful. Expressions, variables, recipes, and more general dependency lists can each be considered separately.
Separate dependencies from rebuild decisions
A dependency describes a relationship between tasks. Deciding whether work needs to run is another question: a file might be missing, its contents might have changed, or a task might need to run every time.
The design should make those choices understandable. This first rule gives us a place to start without settling every rebuild policy in advance.
My Sewfile looks at the same example from the perspective of writing a project's build setup.