comp.lang.ada
 help / color / mirror / Atom feed
* Re: Pattern recognition Programming language
  2002-01-23  4:23 Pattern recognition Programming language Patricia R Benjamin
@ 2002-01-23  2:32 ` tmoran
  2002-01-23 12:42 ` M. A. Alves
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: tmoran @ 2002-01-23  2:32 UTC (permalink / raw)


> a=b+c;
> some stuff...
> func(a);
 recognized by
> Name_=Name1_ + Name2_
> func(Name_)
  What about:  func(a-c)
How general do you want this tool?  Is it a general data flow analyzer,
or a simple check for special cases in restricted circumstances?



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

* Pattern recognition Programming language
@ 2002-01-23  4:23 Patricia R Benjamin
  2002-01-23  2:32 ` tmoran
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Patricia R Benjamin @ 2002-01-23  4:23 UTC (permalink / raw)


I have a problem:

Given a stream of tokens representing a program in some programming
language,  I would like to extract and process calls to specific
procedures.  Processing includes recognizing and processing the
statements that develop the arguments that are passed to these
procedures.  The token stream also embodies scoping information which
influences the processing.

The tool I am looking for is closer to a filter generator than a
parser generator. (The token stream is generated by an actual parser).

The tool will recognize families of patterns of tokens, where
individual statements from which these patterns are generated are not
necessarily adjacent in the program being analyzed.

For example, a smipped of program to be analyzed moght look like:

  a=b+c;
  some stuff...
  func(a);

The pattern that extracts this construct could be expressed as:

Name_=Name1_ + Name2_
...
func(Name_)

This pattern should also recognize the following program:

cat=mouse+catch;
mystuff=0;
func(cat)

Mathematica's pattern matching capability seems like a candidate, but
I don't think it is general enough.

Any Ideas anyone

Thanks

Milt Benjamin
Milton.K.Benjamin@lmco.com
856-787-3202

______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net



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

* Re: Pattern recognition Programming language
  2002-01-23  4:23 Pattern recognition Programming language Patricia R Benjamin
  2002-01-23  2:32 ` tmoran
@ 2002-01-23 12:42 ` M. A. Alves
  2002-01-23 17:18 ` Robert A Duff
  2002-01-23 22:57 ` Nick Roberts
  3 siblings, 0 replies; 5+ messages in thread
From: M. A. Alves @ 2002-01-23 12:42 UTC (permalink / raw)


On Wed, 23 Jan 2002, Patricia R Benjamin wrote:
> . . . Given a stream of tokens representing a program in some
> programming
> language,  I would like to extract and process calls to specific
> procedures.  Processing includes recognizing and processing the
> statements that develop the arguments that are passed to these
> procedures.  The token stream also embodies scoping information which
> influences the processing.
> . . .
> For example, a smipped of program to be analyzed moght look like:
>
>   a=b+c;
>   some stuff...
>   func(a);
>
> The pattern that extracts this construct could be expressed as:
>
> Name_=Name1_ + Name2_
> ...
> func(Name_)
>
> This pattern should also recognize the following program:
>
> cat=mouse+catch;
> mystuff=0;
> func(cat)

Seems like a job for GNAT.Spitbol.Patterns to me :-)

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823         fax 351+226003654
 A L V E S   P-4150-180 PORTO, Portugal    mob 351+939354002





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

* Re: Pattern recognition Programming language
  2002-01-23  4:23 Pattern recognition Programming language Patricia R Benjamin
  2002-01-23  2:32 ` tmoran
  2002-01-23 12:42 ` M. A. Alves
@ 2002-01-23 17:18 ` Robert A Duff
  2002-01-23 22:57 ` Nick Roberts
  3 siblings, 0 replies; 5+ messages in thread
From: Robert A Duff @ 2002-01-23 17:18 UTC (permalink / raw)


patbenjamin@home.com (Patricia R Benjamin) writes:

> The tool I am looking for is closer to a filter generator than a
> parser generator. (The token stream is generated by an actual parser).
> 
> The tool will recognize families of patterns of tokens, where
> individual statements from which these patterns are generated are not
> necessarily adjacent in the program being analyzed.

I suggest you ask this question on comp.compilers.

- Bob



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

* Re: Pattern recognition Programming language
  2002-01-23  4:23 Pattern recognition Programming language Patricia R Benjamin
                   ` (2 preceding siblings ...)
  2002-01-23 17:18 ` Robert A Duff
@ 2002-01-23 22:57 ` Nick Roberts
  3 siblings, 0 replies; 5+ messages in thread
From: Nick Roberts @ 2002-01-23 22:57 UTC (permalink / raw)


To my knowledge, the 'classic' pattern recognition language is Prolog.

There are many, many other possible languages, but I think it is fair to say
that none of them is as specific to pattern matching but also as
general-purpose and powerful as Prolog. Of course Prolog itself has many
variants available.

Prolog's biggest problem tends to be speed (but only for some applications).
There are compilers (e.g. Mercury), but these have limitations and
complications.

If you do not already know Prolog, get a copy and have a play. It might turn
out to be one of your favourite tools.

--
Best wishes,
Nick Roberts






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

end of thread, other threads:[~2002-01-23 22:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-23  4:23 Pattern recognition Programming language Patricia R Benjamin
2002-01-23  2:32 ` tmoran
2002-01-23 12:42 ` M. A. Alves
2002-01-23 17:18 ` Robert A Duff
2002-01-23 22:57 ` Nick Roberts

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