On Sunday, 3 March 2013 at 03:06:15 UTC, Daniel Murphy wrote:
"Zach the Mystic" <reachbutminusthisz...@googlymail.com> wrote in message
news:pwwrifebdwzctiouj...@forum.dlang.org...
On Saturday, 2 March 2013 at 10:05:08 UTC, Daniel Murphy wrote:

"Zach the Mystic" <reachbutminusthisz...@googlymail.com> wrote in message
news:bueceuemxqmflixkq...@forum.dlang.org...
On Saturday, 2 March 2013 at 04:28:40 UTC, Zach the Mystic wrote:
You would definitely need an identifier translation table:

"Dsymbols *" -> "Dsymbol[]"

Might as well just define ArrayBase etc

"NULL" -> "null"

Sure, but what about all the places 0 is used to mean NULL?

`//printf("...%d...", s)` -> `writef("...%s...", s)`

Why not just keep it as printf?

"#ifdef XIFDEFVERSION" + nested ifdefs + "#endif"
-> "version(XIFDEFVERSION) {" + nested {}'s + "}"

"#ifdef 0" -> "version(none)"


No luck, dmd source uses #ifdefs mid-declaration, mid-statement, and
mid-expression (even mid-string-literal)
It also uses #ifs with complex conditions.

And don't forget no-args ctors, implicit calling of ctors, stack allocated classes, new keywords, narrowing integer conversions, 'virtual', pure virtual function syntax, macros as expression aliases, string literal constness, the EXP_CANT_INTERPRET cast hack, macros, namespaces, macros,
structs using inheritance, and of course more macros.

Every single one of these would have to be special-cased. If you had a domain-specific language you could keep track of whether you were mid-declaration, mid-statement, or mid-string-literal. Half the stuff you special-case could probably be applied to other C++ projects as well.

If this works, the benefits are just enormous. In fact, I would actually like to "waste" my time trying to make this work, but I'm going to need to ask a lot of questions because my current programming skills are nowhere near the average level of posters at this forum.

I would like a c++ lexer (with whitespace) to start with. Then a discussion of parsers and emitters. Then a ton of questions just on learning github and other basics.

I would also like the sanction of some of the more experienced people here, saying it's at least worth a go, even if other strategies are simultaneously pursued.

Something like this https://github.com/yebblies/magicport2 ?

Yes! I need to look it over more thoroughly, but I couldn't ask for a better beginning. Can I trust that you'll be a willing part of future discussions on this matter, even if only to play Devil's Advocate?

Reply via email to