refactor context and expression's id generation