implement matching internal DSL
simplified tree construction