Heterocyclic compounds of the formula: ##SPC1## Wherein A is a carbonyl group, a methylene group or an alkylidene group having 2 to 4 carbon atoms; B is an oxygen atom, a sulfur atom or --N(R')-- (wherein R' is a hydrogen atom or an alkyl group having 1 to 4 carbon atoms); each of R.sup.1 and R.sup.2 is a hydrogen atom, a halogen atom, an alkyl group having 1 to 4 carbon atoms, an alkoxy group having 1 to 4 carbon atoms or a phenyl group which may be substituted by a halogen atom, an alkyl group having 1 to 4 carbon atoms or an alkoxy group having 1 to 4 carbon atoms; X is an alkyl group having 1 to 4 carbon atoms, a cycloalkyl group having 3 to 6 carbon atoms or OM (wherein M is a hydrogen atom, an alkyl group having 1 to 4 carbon atoms, a metal atom or NH.sub.4); and ring P represents a pyridine ring, are useful as anti-allergic agents.