Skip to Content.
Sympa Menu

maude-help - Re: [Maude-help] Re: Parsing question (answer + new question)

maude-help AT lists.cs.illinois.edu

Subject: Maude-help mailing list

List archive

Re: [Maude-help] Re: Parsing question (answer + new question)


Chronological Thread 
  • From: Francisco Duran <duran AT lcc.uma.es>
  • To: Todd Wilson <twilson AT csufresno.edu>, maude-help AT maude.cs.uiuc.edu
  • Cc:
  • Subject: Re: [Maude-help] Re: Parsing question (answer + new question)
  • Date: Wed, 02 Nov 2005 18:51:04 +0100
  • List-archive: <http://maude.cs.uiuc.edu/pipermail/maude-help>
  • List-id: Maude help list <maude-help.maude.cs.uiuc.edu>

Hi Todd,

There should be no problem. In fact, you may be interested in using your own tokens. Take a look to the section on the manual on Tokens, Bubbles, and Metaparsing.


I've read that section carefully already, thanks. I did see how I could define tokens and bubbles (although, again, the declarations are somewhat mysterious -- it would be nice to know what the id-hook and op-hook declarations actually do, and what the partial operation <Qids> is), but I couldn't see how I could use tokens and bubbles to recognize and parse integer, float, and string constants.


If what you need is to parse integers, floats, and strings, probably you first attempt was the good one. But you can parse any other kind of token sequence by using bubbles. Notice that the ideaas explained in the manual, is that once you have e.g. a 'token[''23.Qid] you can obtain the natural number 23 equationally. That is, you can define your own notion of token. This is very limited, of course, in the long term we'd like to have lexical level parsing, but meanwhile this approach can do the job.

Maybe some of the bubble declarations and the ones I copied from prelude.maude could be combined to form "integer constant bubbles", "float constant bubbles", etc.?


You don't need to combine them, for parsing built-ins what you were dong is fine. For parsing any other thing you'll probably need bubbles.

Also, it appears that there is nothing special about "tokens": they are just length-one bubbles. Is that correct?


You are right, its just bubbles of size 1.

Paco




Archive powered by MHonArc 2.6.16.

Top of Page