To support the rapid development of pen-based structured diagram editors, we propose a framework for describing such editors. The framework uses grammar to describe the context, i.e., the positional relationship between handwritten strokes and other objects, which can be used to interpret ambiguous results of pattern matching, and to describe the syntax of the target diagrams. We implemented th...