comp.lang.ada
 help / color / mirror / Atom feed
* REQ: Expression parser
@ 1998-01-21  0:00 dagoon
  1998-01-21  0:00 ` Dale Stanbrough
  1998-01-22  0:00 ` Robert Dewar
  0 siblings, 2 replies; 3+ messages in thread
From: dagoon @ 1998-01-21  0:00 UTC (permalink / raw)



Hello, I just started coding in ada, so I have problems, esp. with string 
handling since it's much different from C or pascal style... I'd love to 
see an example of expression parser (like getting "2+2" string and giving 
integer=4). I also know that string in ada is saved as (first,last,*text) 
but I don't know if there's any simply method of changing first and last.
thanks for any help, regards
Marcin




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: REQ: Expression parser
  1998-01-21  0:00 REQ: Expression parser dagoon
@ 1998-01-21  0:00 ` Dale Stanbrough
  1998-01-22  0:00 ` Robert Dewar
  1 sibling, 0 replies; 3+ messages in thread
From: Dale Stanbrough @ 1998-01-21  0:00 UTC (permalink / raw)



"Hello, I just started coding in ada, so I have problems, esp. with
string 
 handling since it's much different from C or pascal style... I'd love to 
 see an example of expression parser (like getting "2+2" string and
giving 
 integer=4). I also know that string in ada is saved as
(first,last,*text) 
 but I don't know if there's any simply method of changing first and last.
 thanks for any help, regards



Try using the Ada.Strings.Unbounded.Unbounded_String type, this has a very
intuitive set of routines. You can easily build up an i/o package to read
these values in from the user.

Unfortunately it seems some of the more common textbooks seem to overlook
this
very useful type.


Dale




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: REQ: Expression parser
  1998-01-21  0:00 REQ: Expression parser dagoon
  1998-01-21  0:00 ` Dale Stanbrough
@ 1998-01-22  0:00 ` Robert Dewar
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Dewar @ 1998-01-22  0:00 UTC (permalink / raw)



dagoon asks

<<Hello, I just started coding in ada, so I have problems, esp. with string
handling since it's much different from C or pascal style... I'd love to
see an example of expression parser (like getting "2+2" string and giving
integer=4). I also know that string in ada is saved as (first,last,*text)
but I don't know if there's any simply method of changing first and last.
thanks for any help, regards
>>

Have a look at Ada.Strings.Unbounded, and no a string in Ada is not
"saved as first,last,*text", it is a more abstract object as you
will see from this specification.

If you want to see some extensive examples of the use of this abstraction,
have a look at the coding of GNAT.Spitbol.Patterns in the GNAT library.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-01-22  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-21  0:00 REQ: Expression parser dagoon
1998-01-21  0:00 ` Dale Stanbrough
1998-01-22  0:00 ` Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox