Hello!

How difficult is to create a tool described below?

This Tool will look at AST (maybe specific, with some restrictions; maybe a syntax extendion of ML-like language)  of parser (which uses combinators) and will generate parsing code according next rules:
1) this parser-function parses a grammar with
some  ambiguities --- GLR parser is a right choice
2) this parser-function ......................??????................................... --- recursive descent is better.
3) this parser-function .......................????...................................... --- we should use LALR parser.

Now I have code examples which generate parsers of different types from some DSL. AFAIU the main problems are:
1) how to build grammar from parser-combinators code?
2) how to analyze grammar?

Best wishes,
Kakadu