Re: [Oberon] re. Literate Programming Light
Chris & others, cg> Here's what I was recently thinking about ............. Many ideas! Sorry that I can tackle only one. cg> ? linux has got p2c [pascal to C translator]; why not c2p ! Andreas Distelli replied to the C to Oberon question years ago. According to my understanding, the biggest factor is that the syntax of a C-like language is more elaborate than the syntax of a Pascal-like language. Many of the syntactical constructs in Pascal translate directly to constructs in C. Various iteration structures for example. Conversely, C allows structures which do not translate directly to Pascal. A translator would need to analyse the meaning of such C text and make appropriate Pascal. Translating a numerical algorithm could be relatively easy. Translating a system dependent feature could be difficult. Perhaps a partial translation is worthwhile. Ie. do the easy translation and leave the tricky stuff as C text in comments. Have you ever seen an EBNF specification of C or C++? I have not and am not even sure it is feasible to make. In any case, you probably want to have that before making a c2p. The conclusion I recall is that the best approach is to comprehend a C implementation properly and then to write good Oberon code on that basis. Of course a partial c2p translator could help with the comprehension part. Incidently, EBNF specifications exist for few of the many programming languages and protocols. Regards, Peter E. http://carnot.pathology.ubc.ca/
shark@gulfnet.sd64.bc.ca wrote: ...
Have you ever seen an EBNF specification of C or C++? I have not and am not even sure it is feasible to make. In any case, you probably want to have that before making a c2p. ... Regards, Peter E.
I have a BNF version for C (copied from the net) which I eventually will use to create a C2O (various versions of Oberon). I am currently working on a FORTRAN to Oberon translator but don't hold your breath. I have modified Coco/R (Hanspeter Mössenböck) and am looking at a different front end for the scanner based on a parallel search algorthm that generates a finite state machine (similar to Coco's but one that I can control more directly). This algorithm was developed by a student of Donald Knuth's back in 1977. I hope to make available the FORTRAN translator for the high energy physics community at CERN. But again, this is a low level background project that I get to when I find some free time. -Doug
participants (2)
-
Douglas G. Danforth -
shark@gulfnet.sd64.bc.ca