Approach to heterocycles from carbohydrate derivatives and others involving cycloaddition and cyclization reaction