The binding generator current organization makes it hard to fully grasp all logic. It would be good to refactor it so as to ease understanding and improving of this code.
The python generators have a more modular approach. Maybe this could be a source of inspiration. There might be some initial steps we could do like: - Have separate files for generating headers, generating sources and common utilities - Further split into dedicated files for specific generation steps like constructor generation - Have specific dedicated steps, like a single place where all includes would be done for headers, another for the sources includes. - Extract the template CPP code to some places so that the script logic is easier to understand It may also help if we would like to switch progressively to python for this code generator.
This bug entry is more a meta bug for improvement ideas actually.
If we want to do this, I recommend switching piece at a time, by handling one particular output file, getting it to work incrementally for all input cases, then expanding out from there. One big problem is that as far as I know, all of our IDL parsing is in Perl, and the rest of code generation is predicated on being able to parse the IDL files. Is there some Python library we can use to parse IDL? Or is there a workable intermediate format we can use to shim IDLParser.pm to Python code generators?
(In reply to comment #3) > If we want to do this, I recommend switching piece at a time, by handling > one particular output file, getting it to work incrementally for all input > cases, then expanding out from there. > > One big problem is that as far as I know, all of our IDL parsing is in Perl, > and the rest of code generation is predicated on being able to parse the IDL > files. Is there some Python library we can use to parse IDL? Or is there a > workable intermediate format we can use to shim IDLParser.pm to Python code > generators? Rewriting our bindings generator in Python would be huge effort and would probably not bring huge benefits. I would much rather we improve / clean our current generator (I do agree its needs clean up / refactoring).
(In reply to comment #4) > (In reply to comment #3) > > If we want to do this, I recommend switching piece at a time, by handling > > one particular output file, getting it to work incrementally for all input > > cases, then expanding out from there. > > > > One big problem is that as far as I know, all of our IDL parsing is in Perl, > > and the rest of code generation is predicated on being able to parse the IDL > > files. Is there some Python library we can use to parse IDL? Or is there a > > workable intermediate format we can use to shim IDLParser.pm to Python code > > generators? > > Rewriting our bindings generator in Python would be huge effort and would > probably not bring huge benefits. I would much rather we improve / clean our > current generator (I do agree its needs clean up / refactoring). I agree, especially since so many people are familiar with the current thing. I was able to rewrite some other generators because < 5 people ever knew how they worked. ;-)