I have a project where I need a full expression language, but the target of generation is XQuery. I'm trying to decide what would be more efficient:
1) extend base language and use those concepts, then map the concepts to XQuery in the generator or
2) just roll my own expression language following the Xquery/XPath specs, referring to base language for ideas if I get stuck
The problem I see with #1 is that the whole java language is available and potentially has to be mapped, and some concepts may not map cleanly to Xquery. Also, I have to map everything up front, or build in a lot of constraints to restrict the base concepts that are available. Plus, I'm just not sure if base language is meant to be used that way.
I could see #2 allowing a more incremental approach,like start with a few simple operators and stuff, then add more advanced concepts if and when needed. My fear here is hitting a wall as more concepts are added and the complexity mounts, or eventually end up replicating most of base language.
I'm leaning towards #2, and I've started building an XQuery language based on the spec, which I would build my language on top of.
But before I get too far down that path, I thought I would ask for suggestions. It's awfully tempting to extend base language, inheirit from Expression and then sort it out in the generator.
Expression system - best approach?