Recursion 
Author Message
 Recursion

Hi,
        Can you do recursion in Pascal?  I'm wondering because I might
        want to implement a pascal compiler and recursion makes a big
        difference.

        David



Wed, 18 Jun 1902 08:00:00 GMT  
 Recursion

Quote:
>Hi,
>        Can you do recursion in Pascal?  I'm wondering because I might
>        want to implement a pascal compiler and recursion makes a big
>        difference.

Yep, it's possible.  Just call the same procedure within itself (single
recursion), or have two procedures that call each other (mutual recursion).  
Don't forget to have sufficient stack space, and make sure your procedure
has an early out.

BTW, who says Borland doesn't have any sense of humor?  Look up "Recursive
loop" in your Language Guide.  :-)  (I know BP7 has this, I think I remember
seeing it in my friend's TP6 manuals).

Quote:
>        David

--
Scott F. Earnest           | We now return you to our regularly scheduled



Wed, 18 Jun 1902 08:00:00 GMT  
 Recursion


Quote:




.>
.>>Hi,
.>>        Can you do recursion in Pascal?  I'm wondering because I might
.>>        want to implement a pascal compiler and recursion makes a big
.>>        difference.
.>
.>Yep, it's possible.  Just call the same procedure within itself (single
.>recursion), or have two procedures that call each other (mutual
.>recursion).  

     And, if you use mutual recursion, you need to use the FORWARD statement
(in Standard Pascal).

Bob Schor
Recursive Pascal Enthusiast



Wed, 18 Jun 1902 08:00:00 GMT  
 Recursion
Remember that recursion works backward...

                                _.:Justin:._



Wed, 18 Jun 1902 08:00:00 GMT  
 Recursion

Quote:
>Hi,
>    Can you do recursion in Pascal?  I'm wondering because I might
>    want to implement a pascal compiler and recursion makes a big
>    difference.

Oddly enough, Borland restricts use of its Pascal development tools to
make pascal compilers.  You might want to know that.  

If you want to learn recursion for your own benefit, see the URL
below.

Glenn Grotzinger

MOD and S3M user extraordinaire.
Writer of TP tutorial.  All released parts findable at:
ftp://garbo.uwasa.fi/pc/turbopas/tptutr11.zip



Wed, 18 Jun 1902 08:00:00 GMT  
 Recursion

Quote:
>Hi,
>    Can you do recursion in Pascal?  I'm wondering because I might
>    want to implement a pascal compiler and recursion makes a big
>    difference.
>    David

Recursion can be used in Turbo Pascal for the P.C. and Think Pascal
for the Mac.  


Wed, 18 Jun 1902 08:00:00 GMT  
 Recursion

Quote:

>Recursion can be used in Turbo Pascal for the P.C. and Think Pascal
>for the Mac.  

More, recursion is defined by the Pascal standard.
(at least by Wirth, I am not sure about a ANSI standard)

Koos Pol
-----------------------------------------------------------------
S.C. Pol                                    Phone: +31 20 3116122
PC Systems Administrator                    Fax  : +31 20 3116133

Amsterdam
The Netherlands               "Please DO disturb. I was working!"
-----------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. TechTips: Avoiding unavoidable recursion in event-handlers ...

2. Recursion problem

3. Recursion and One-to-Many

4. Directory recursion - help!

5. Recursion, Objects and the Heap - mountain.pas [0/1]

6. Recursion, Objects and posting articles

7. stuck in a recursion program

8. recursion help

9. recucalc.zip A TP parser, calculates math formula with recursion

10. recursion(help)

11. Recursion and Binary Tree

12. Recursion and Binary Tree

 

 
Powered by phpBB® Forum Software