Regular expressions

2002-02-22 Thread konamiman

Hi obsolete people!

Just for fun, I'm wandering how a regular expressions parser could be implemented on 
MSX.

Is there somewhere the source code of such a parser for any OS, in any language, 
available? Or at least some guidelines about how to develop it.

(Background info: I came up with these wanderings after developping version 0.3 of 
PPPC for InterNestor Suite, which now accepts configuration text files. Of course I 
had to program the file parser by hand and then I though that blah blah...)

About INS itself: let me discover why the !@#$% the computer hangs when receiving 
data AND calling DOS functions at the same time, and then I'll release the 3rd beta!


Konami Man escribiendo desde el curro
(¡qué malo soy!)
[EMAIL PROTECTED]
http://www.konamiman.com
__
Launch your own web site Today!
Create a Web site for your family,
friends, photos, or a special event.
Visit: http://www.namezero.com/sitebuilder
--
For info, see http://www.stack.nl/~wynke/MSX/listinfo.html



RE: Regular expressions

2002-02-22 Thread Stephan Szarafinski

Is there somewhere the source code of such a parser for any OS, in any
language, available? Or at least some guidelines about how to develop it.

Maybe you can find it in the source code of a C compiler for Linux?

Stephan


--
For info, see http://www.stack.nl/~wynke/MSX/listinfo.html



Re: Regular expressions

2002-02-22 Thread Bas Wijnen

 Just for fun, I'm wandering how a regular expressions parser could be implemented on 
MSX.
Probably just like on any other platform. I guess you want to call it
from a program, not from the command line? If you do, you need to write
a front-end for that.

 Is there somewhere the source code of such a parser for any OS, in any language, 
available? Or at least some guidelines about how to develop it.
Sure there is. In the libc source from gnu (apt-get source libc to get
it in Debian gnu/linux) there is a file regex/rx.c. Everything is in
there.

Bye,
shevek
--
For info, see http://www.stack.nl/~wynke/MSX/listinfo.html



Re: Regular expressions

2002-02-22 Thread Joost Yervante Damad

On Fri, Feb 22, 2002 at 03:36:39AM -0800, [EMAIL PROTECTED] wrote:
 Hi obsolete people!
 
 Just for fun, I'm wandering how a regular expressions parser could be implemented on 
MSX.
 
 Is there somewhere the source code of such a parser for any OS, in any language, 
available? Or at least some guidelines about how to develop it.

http://ibiblio.org/pub/gnu/rx/ might be of use?
--
For info, see http://www.stack.nl/~wynke/MSX/listinfo.html



Re: Regular expressions

2002-02-22 Thread Vincent van Dam

 Maybe you can find it in the source code of a C compiler for Linux?

Don't know C compilers which can handle regular expressions, but sed and
perl
can, and their source code is freely available.

Vincent van Dam
--
For info, see http://www.stack.nl/~wynke/MSX/listinfo.html



Re: Regular expressions

2002-02-22 Thread Roberto E. Vargas Caballero



On 22 Feb 2002 [EMAIL PROTECTED] wrote:

 Hi obsolete people!
 
 Just for fun, I'm wandering how a regular expressions parser could be implemented on 
MSX.
 
 Is there somewhere the source code of such a parser for any OS, in any language, 
available? Or at least some guidelines about how to develop it.
 
 (Background info: I came up with these wanderings after developping version 0.3 of 
PPPC for InterNestor Suite, which now accepts configuration text files. Of course I 
had to program the file parser by hand and then I though that blah blah...)
 


http://polaris.lcc.uma.es/docencia/ETSIInf/pl/pl1.html


En esta pagina estan los apuntes de la asignatura de Procesadores de
Lenguajes de Informatica en Malaga.  Mira la parte de analisis
lexicografico Yo me los tuve que estudiar y te digo que mas o menos estan
bien. Si tienes dudas sobre el tema podemos hablarlo en Madrid



Roberto Vargas.













--
For info, see http://www.stack.nl/~wynke/MSX/listinfo.html



Re: Regular expressions

2002-02-22 Thread Roberto E. Vargas Caballero




Sorry, I didn't want send to the list. 


  Hi obsolete people!
  
  Just for fun, I'm wandering how a regular expressions parser could be implemented 
on MSX.
  
  Is there somewhere the source code of such a parser for any OS, in any language, 
available? Or at least some guidelines about how to develop it.
  
  (Background info: I came up with these wanderings after developping version 0.3 of 
PPPC for InterNestor Suite, which now accepts configuration text files. Of course I 
had to program the file parser by hand and then I though that blah blah...)
  
 
 
 http://polaris.lcc.uma.es/docencia/ETSIInf/pl/pl1.html
 
 
 En esta pagina estan los apuntes de la asignatura de Procesadores de
 Lenguajes de Informatica en Malaga.  Mira la parte de analisis
 lexicografico Yo me los tuve que estudiar y te digo que mas o menos estan
 bien. Si tienes dudas sobre el tema podemos hablarlo en Madrid
 
 
 
 Roberto Vargas.

--
For info, see http://www.stack.nl/~wynke/MSX/listinfo.html



Re: Regular expressions

2002-02-22 Thread Adriano Camargo Rodrigues da Cunha


 Just for fun, I'm wandering how a regular expressions parser could be
 implemented on MSX.
 Is there somewhere the source code of such a parser for any OS, in any
 language, available? Or at least some guidelines about how to develop it.

UZIX has regexp in libc. Get the sources from UZIX site (uzix.sf.net).


=
Adriano Camargo Rodrigues da Cunha ([EMAIL PROTECTED])
http://www.adrpage.cjb.net  MSX: more fun per less MHz

___
Yahoo! GeoCities
Tenha seu lugar na Web. Construa hoje mesmo sua home page no Yahoo! GeoCities. É fácil 
e grátis!
http://br.geocities.yahoo.com/
--
For info, see http://www.stack.nl/~wynke/MSX/listinfo.html



Re: Regular expressions

2002-02-22 Thread Maarten ter Huurne

On Friday 22 February 2002 12:36, you wrote:

 Just for fun, I'm wandering how a regular expressions parser could be
 implemented on MSX.

If you just want to tokenize config files, you don't need full regex support 
on MSX. From the regular expressions for your config language, create a state 
machine. You can do this step using any convenient language, I would suggest 
something like Python or Perl, but you can use an MSX language instead if you 
like. Then implement a small engine in MSX assembly that executes a state 
machine.

Advantages:
- INS won't increase much in size: only state machine and engine would have 
to be integrated, the rest is an external program
- you can do most programming in a high-level language
- the state machine generator and engine are independent of the config 
language, so you don't have to re-write them if the config syntax changes

Example of state machine:

Let's say you have 2 keywords, being on and off. The state machine would 
look like this:
0 --(o)-- 1
1 --(n)-- 2
1 --(f)-- 3
3 --(f)-- 4
Where:
0 is the initial state
2 is the end state for on
4 is the end state for off
--(x)-- means you perform this state transition if the current input 
character is x

If there is no valid transition, the string you're reading is not a 
recognised token. In most languages, you would scan until a separator and the 
result is an identifier (non-keyword token). In a language without separators 
you would have to jump to the correct internal state, which is hard, so don't 
design such a language unless you actually need it.

Ofcourse on | off is a very trivial regex, but any regex can be expressed 
as a state machine. A non-trivial regex would make a too large example, 
this is also why state machine generation should be automated.

Bye,
Maarten
--
For info, see http://www.stack.nl/~wynke/MSX/listinfo.html