Hi, Last few days i've been working on a complete reimplementation of IMCC's grammar. It can be found in compilers/pirc/new. THere's no Makefile yet, as I didn't know how to create this in a portable way (as flex and bison are needed). No tests yet either, I only do that with small test files on my pc.
I found updating and fixing IMCC's grammar rather difficult and no fun as there's a lot of unclear stuff. A clean implementation can resolve the trouble of changing the PIR language. Up till now, things worked out pretty well. ALthough it's not completed yet (and only focus on the parsing, not on the semantic stuff), the new implementation has the following features: * no grammar kludges, like %PREC, yy_clear_state(), and /* this is ugly */ comments * nice opportunity to clean up some dark corners of IMCC's grammar. Did youknow you could define a namespace like this: ".namespace ['a' .. 'b']" ? I can't imagine what this should mean. * removal of (almost) all globals. I'm not sure about some built-in globals, like "yytext". In any case, the goal is to make it reentrant. * support for multiple heredocs, allowing to write: .sub foo(<<'A', <<'B', <<'C') hi A hi there B hi again C * A clean implementation of the .include directive * .constant directive works, but I found out IMCC only allows it in PASM mode. If this is desired behaviour, I have to change my implementation. * comments. Lots of it. * beginning implementation of macros. * the lexer spec. is processable by cygwin's default flex version (I think imcc.l can't be processed with that version) * an opportunity to decide how PIR should parsed w.r.t. PASM. SHould PIR be converted to PASM, or should it be interpreted from PIR source immediately? * A basic pre-process option (using "-E"), which shows the user the input as it is read by the parser. Before I continue on finishing the macros, however, I think it'd be nice to set up some kind of feature list of what macros should be able to do. I don't want to put in a lot of effort finishing the macro stuff, only to find out that new features should be added/removed. Recently, there was a bit discussion on list about local variables in macros, which could be added (that generate unique vars, just like .local/.label does for labels currently). comments are most welcome. thanks, kjs