[Oberon] re. Literate Programming Light

shark at gulfnet.sd64.bc.ca shark at gulfnet.sd64.bc.ca
Tue Dec 30 19:08:50 CET 2003


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/




More information about the Oberon mailing list