Mr. Adobo
Mr. Adobo

Reputation: 835

What do :+ and :or do on Scheme?

I'm trying to do my homework and hacking through some example code I saw this line:

   [(:+ (:or VAR)) (token-VAR (string->symbol lexeme))]

This is from a lexical analyzer in a calculator;

Now I'm not really sure what either of this does, and I'm not particularly sure what this means exactly, but I'm pretty sure it has what I need to finish my homework. Searching hasn't gotten me any help so all help is great at this time. Thanks!

Upvotes: 2

Views: 172

Answers (1)

jacobm
jacobm

Reputation: 14035

The sample code probably imported parser-tools using the : prefix (which is the recommended prefix in the parser-tools documentation. If that's the case, then :+ means "repetition one or more times" and :or matches any of the subpatterns (just VAR in this case).

Upvotes: 9

Related Questions