This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: BCPL compiler with GCC


> Tom Crick writes:
>  > Hello,
>  > 
>  > I'm trying to write a compiler for BCPL and have been 
> investigating writing  > a new frontend to GCC.  > 
>  > Do you know if anyone has written a parser and tree rep. 
> for BCPL in GCC?  > Are there some nasty traps and pitfalls 
> ahead? Obviously there are some nice  > little quirks in BCPL 
> ('valof()' and general scoping issues), but  > semantically 
> it's not much different from C.
> 
> Addresses are always word addresses, aren't they?  I suppose 
> you'd end up with something like
> 
> !B  mapping onto  *(word *)(b * sizeof word)

Yeah, word addresses are another of the problems I have come up against
after researching BCPL. I think indirection will have to be handled
carefully! :-)

>  > Also, with upcoming changes to GCC, would it be a good 
> idea to convert to  > GENERIC at the end?
> 
> Yes.  In fact, you could generate generic trees during parsing.

I think this may be the best way - I like the potential benefits of using
generic trees, even if if is just for the aesthetic quality.

> But you could convert BCPL to C instead.

Maybe - it wouldn't be so bad to knock up some Perl to convert the BCPL to C
and then just use GCC as normal, but I'd like it to be a fairly elegant
solution, plus I'd like to learn more about the GCC internals.

What are the major problems with writing a new frontend? Anything to avoid
when starting out?

Thanks,

Tom




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]