Any good 'Pseudocode to C' translators out there? 
Author Message
 Any good 'Pseudocode to C' translators out there?

I'm new to C, so I don't know which are 'the best' or industry
standard. What do YOU use, and do you like it?




Mon, 04 Apr 2005 23:19:47 GMT  
 Any good 'Pseudocode to C' translators out there?


Quote:
> I'm new to C, so I don't know which are 'the best' or industry
> standard. What do YOU use, and do you like it?

ISO C doesn't specify such things. What did a google search reveal?


Mon, 04 Apr 2005 23:21:35 GMT  
 Any good 'Pseudocode to C' translators out there?

Quote:

> I'm new to C, so I don't know which are 'the best' or industry
> standard. What do YOU use, and do you like it?

I use C, and I like it because it's topical. ;-)

Sounds silly, but it's quite serious, I assure you. If I need to convert
some text or other to C, I write a C program to do it.

A recent example: that error message thing I posted. As was apparent
from the ensuing discussion, it wasn't everyone's cup of tea, which is
fair enough, but it's indicative of the way I think (which, again, isn't
everyone's cup of tea!).

Another example: I hate handling command line arguments, and I hate the
(non-ISO) getopt() too. (I looked at the man page, but it's okay - I
survived (just).) So I wrote a program ("genargs") to handle command
line arguments for me. I give it a fairly rudimentary command line
grammar, and it writes main() and a bunch of other stuff, and - within
main() - writes a call to ApplicationMain, which it prototypes
appropriately for the grammar I specified. It's not a panacea by any
means, but for programs with simple argv requirements it's quite handy.
(Not only that, but about half its source code was generated by genargs
itself, which suits my twisted sense of humour.)

For me, C is the best C code generator there is. YMMV.

--

"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton



Mon, 04 Apr 2005 23:42:18 GMT  
 Any good 'Pseudocode to C' translators out there?
Back in the 70s, I consulted for a signals company.

They insisted on designing psuedocode before they programmed
the real solution.   Seemed reasonable.

One day, one of them decided that they had all that psuedocode,
why not just compile that?

I was young and green, and made the mistake of taking the contract to do so.

Psuedocode is useful *because* it is sloppy.  Its like
the sketches on your whiteboard; it enables discussion,
but after you walk out of the room, they're just
meaningless squiggles.

The problem with "compiling psueodcode" is that you
have to decide what everything means, so the translation
can be "right".   This turns into a language design problem,
and now the psuedocode has to suddenly become formal.
And it no longer means exactly what the original users wrote.
Language design is actually very hard, and doing
while the users are writing in the language will not
make anybody happy.

We managed to get it all to work, but the project was hell,
with the psuedocode writers accusing us of twisting their
intentions, and forcing them to go back over the psuedocode
to "fix" everything.  (Can you say, "state your intentions
in microscopic detail and then debug them"?).

I would not recommend translating psuedocode to C.

There could be a completely different discussion if
the question had been, "Does anybody know how to translate
this formal modeling language to C?".  Presumably
then the semantics are clear from the start.
[UML isn't one of those.]

--
Ira D. Baxter, Ph.D., CTO   512-250-1018
Semantic Designs, Inc.      www.semdesigns.com


Quote:
> I'm new to C, so I don't know which are 'the best' or industry
> standard. What do YOU use, and do you like it?





Mon, 04 Apr 2005 23:57:53 GMT  
 Any good 'Pseudocode to C' translators out there?

Quote:

> Another example: I hate handling command line arguments, and I hate the
> (non-ISO) getopt() too. (I looked at the man page, but it's okay - I
> survived (just).) So I wrote a program ("genargs") to handle command
> line arguments for me. I give it a fairly rudimentary command line
> grammar, and it writes main() and a bunch of other stuff, and - within
> main() - writes a call to ApplicationMain, which it prototypes
> appropriately for the grammar I specified. It's not a panacea by any
> means, but for programs with simple argv requirements it's quite handy.

Personally, for use in portable C programs I just ended up
writing a function for option parsing that I like better than
getopt() or GNU's getoptlong().  It's used in GNU libavl in
`test.c' if anyone is curious:
        ftp://ftp.gnu.org/pub/gnu/avl/avl-2.0.1.tar.gz
--
"We put [the best] Assembler programmers in a little glass case in the hallway
 near the Exit sign.  The sign on the case says, `In case of optimization
 problem, break glass.'  Meanwhile, the problem solvers are busy doing their
 work in languages most appropriate to the job at hand." --Richard Riehle


Tue, 05 Apr 2005 00:06:54 GMT  
 Any good 'Pseudocode to C' translators out there?

Quote:
klachemin writes:
>I'm new to C, so I don't know which are 'the best' or industry
>standard. What do YOU use, and do you like it?

The best translators are human beings.  I use myself because I would be
unwilling to pay what others would charge.

I like it very much.



Tue, 05 Apr 2005 00:16:31 GMT  
 Any good 'Pseudocode to C' translators out there?


Quote:
> I'm new to C, so I don't know which are 'the best' or industry
> standard. What do YOU use, and do you like it?

First, you'll need to formally define your notion of 'pseudocode'.
But then it wouldn't be 'pseudo' any more. :-)

-Mike



Tue, 05 Apr 2005 00:52:39 GMT  
 Any good 'Pseudocode to C' translators out there?

Quote:


> > I'm new to C, so I don't know which are 'the best' or industry
> > standard. What do YOU use, and do you like it?

> I use C, and I like it because it's topical. ;-)

> Sounds silly, but it's quite serious, I assure you. If I need to
> convert some text or other to C, I write a C program to do it.

C, as a language, was originally designed primarily to fit the
machines for which it generated code, rather than to express and
verify a program.  That is why it is often characterised as
'structured assembly'.  Today it does a fairly good job of the
express and verify phase also, but with definite limitations.  It
has very few limitations on what it can express, though, which
largely explains its popularity.

On the other hand (sticking to procedural languages, rather than
things such as Lisp) other languages have been developed with the
prime intent of verifying correctness and expressing the
programmers intent clearly.  Pascal and Ada are examples.

There is absolutely no reason why compilers for such languages
should not output C source as their end product.  Such compilers
exist - some are fairly simple and are considered simply as
translators.  Comeaus C99 compilers, AFAICT, do exactly that for
the C99 language and output it to existing C90 compilers, allowing
for their quirks and peculiarities.

Your own C source is simply pseudocode for the end machines
assembly language, and most C compilers simply translate it into
assembly code for the destination machine.  The original Cfront
was such a compiler for the C++ language, whose output was C.

--

   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!



Tue, 05 Apr 2005 01:11:17 GMT  
 Any good 'Pseudocode to C' translators out there?


<OT>
Ben,

You must post with this sig. in the comp.arch.embedded forum, oh what fun
that would engender...

--

"We put [the best] Assembler programmers in a little glass case in the
hallway near the Exit sign.  The sign on the case says, `In case of
optimization problem, break glass.'  Meanwhile, the problem solvers are
busy doing their work in languages most appropriate to the job at hand."

--Richard Riehle

</OT>



Tue, 05 Apr 2005 01:41:12 GMT  
 Any good 'Pseudocode to C' translators out there?

Quote:
> I'm new to C, so I don't know which are 'the best' or industry
> standard. What do YOU use, and do you like it?

P2C, Ps2C etc...

Try a Google search with "pascal to 2 translator"

--
-ed- emdel at noos.fr ~]=[o
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
C-library: http://www.dinkumware.com/htm_cl/index.html
"Mal nommer les choses c'est ajouter du malheur au monde."
-- Albert Camus.



Tue, 05 Apr 2005 05:03:30 GMT  
 Any good 'Pseudocode to C' translators out there?

Quote:
> I'm new to C, so I don't know which are 'the best' or industry
> standard. What do YOU use, and do you like it?

P2C, Pas2C etc...

Try a Google search with "pascal to 2 C translator"

--
-ed- emdel at noos.fr ~]=[o
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
C-library: http://www.dinkumware.com/htm_cl/index.html
"Mal nommer les choses c'est ajouter du malheur au monde."
-- Albert Camus.



Tue, 05 Apr 2005 05:04:26 GMT  
 Any good 'Pseudocode to C' translators out there?

Quote:

> I would not recommend translating psuedocode to C.

Ew ew. That describes the pit I was falling in to. I start out writing
pseudocode, but somehow always get more detailed than I should. It
eventually gets to the point where I think, 'Now WHY am I writing this
in pseudocode, again?' :-O By the time you make the pseudocode
rigorous enough to codify it, it feels strange, like you're wasting
your time making another language.

But I LIKE pseudocode. I have a problem with the demarcation line
between 'pseudocode' and 'guts', I suppose.

--Kamilche



Tue, 05 Apr 2005 06:56:36 GMT  
 Any good 'Pseudocode to C' translators out there?

Quote:

> The best translators are human beings.  I use myself because I would be
> unwilling to pay what others would charge.

> I like it very much.

Heh heh heh. Yeah. I wish programming languages and design
methodologies were farther along than they are.

'Scan my brain, pluck the idea out, and turn it into code so I can
watch it whir.'

--Kamilche



Tue, 05 Apr 2005 06:58:36 GMT  
 Any good 'Pseudocode to C' translators out there?

Quote:

> I'm new to C, so I don't know which are 'the best' or industry
> standard. What do YOU use, and do you like it?

noweb fulfilled this purpose quite nicely for me.

        - Kevin.



Tue, 05 Apr 2005 08:25:07 GMT  
 Any good 'Pseudocode to C' translators out there?

Quote:


>>The best translators are human beings.  I use myself because I would be
>>unwilling to pay what others would charge.

>>I like it very much.

> Heh heh heh. Yeah. I wish programming languages and design
> methodologies were farther along than they are.

> 'Scan my brain, pluck the idea out, and turn it into code so I can
> watch it whir.'

> --Kamilche

I wish I could find the correct attribution for this quote, but in any case it
fits the occasion quite well:

When someone says "I want a programming language in  which I need only
say what I wish done," give him a lollipop.

Here's your lollipop (stolen from the web):
               _,aggddYYbbgga,_
           ,agd888P"      ,d888bga,
        ,gd88888P"      ,d888888P"Y8g,
      ,dP88888P"      ,d888888P"   `]Yb,
    ,d888888P"      ,d888888P"     ,d88Yb,
   ,888888P"      ,d8888888b     ,d8888888,
  ,88888P"      ,dP"'     `"Yb,,d888888P"`8,
,8888P"      ,dP'           `Y888888P"   `Y,
d88P"      ,d8"               "888P"      )b
8P"      ,d8d'     Normand     `8"       ,d8
8      ,d888)      Veilleux     Y,     ,d88P
8    ,d88888'                   `Yba,,d888P'
8  ,d8888888                      ``"""""'
8,d888888P"8
8888888P"  8
88888P"    8
888P"      8
8P"      ,d8
8      ,d888
8    ,d88888
8  ,d8888888
8,d888888P"8
8888888P"  8
88888P"    8
888P"      8
8P"      ,d8
8      ,d888
8    ,d88888
8  ,d8888888
8,d888888P"8
8888888P"  8
88888P"    8
888P"      8
8P"      ,d8
8      ,d888
8    ,d88888
8  ,d8888888
8,d888888P"8
8888888P"  8
88888P"    8
888P"      8
8P"      ,d8
Y,     ,d88P
`Ya,,,d888P'

-nrk.



Tue, 05 Apr 2005 13:10:57 GMT  
 
 [ 25 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Can't retrieve cookies in .cs file, but works in aspx page

2. Data access 'BEST' practice

3. Best 'Keyboard Stroke' capture Function

4. The 'Best' Language

5. A good 'C' Book

6. A good translation of 'to marshal', 'marshal', 'marshalling' to German ?

7. Good pseudocode for c/c++ programmer

8. The world's foremost FORTRAN to C Translator

9. Technosoft's Pascal-to-C translators

10. HP's Rocky Mtn BASIC to C TRANSLATOR

11. '0', '1', '2', '3' ...???

12. MS-DOS NRO (an 'NROFF'- 'RNO'-like Source in C)

 

 
Powered by phpBB® Forum Software