[m-rev.] lex and moose changed
Holger Krug
hkrug at rationalizer.com
Thu Aug 2 20:05:07 AEST 2001
On Thu, Aug 02, 2001 at 02:40:32AM -0700, Ralph Becket wrote:
> > Great proposal. Thanks ! I'll try to answer for both sides and allow
> > Ralph to kill me (but only within 3 hours after having read this email
> > and only personally, so he had to come to Berlin within 3 hours) if
> > there's some wrongdoing concerning his approach.
>
> Damn, I'll never get a flight now!
Thanks heaven, no distant hypnosis.
> I feel there's a little bit too much going on here, but looking at it
> things don't seem nearly as bad as I'd imagined.
What do the others say ?
> I've got some minor suggestions for improving the syntax if this is
> the preferred option.
>
> Rather than the somewhat bulky lexeme(AnnotatedToken, RegExp) we
> might want to move to a more traditional looking form, something
> like
>
> lexemes = [
> atom('+') - return(plus),
> atom('-') - return(minus),
> ...
> signed_int - (func(IStr) =
> int(string__det_to_int(IStr))),
> identifier - (func(Id) = ident(Id))
> ].
>
> Where we have return/2 as a utility function:
>
> :- func return(T, string) = T.
> return(Token, _) = Token.
OK, looks nice.
> This would require extracting the string component for every matched
> regexp, but that's surely small beer in performance terms.
At the end of the times we will have a great optimizer which even
recognizes that those strings are never accessed ...
> Okay, I'm sold on the idea!
Great. It's free today.
> While we're at it, I suggest changing the regex operator names
> {/\, \/, star, plus, opt} to {++, or, *, +, ?} respectively.
I'm with this.
> > % A problem here, I admit, is that in the current
> > implementation there
> > % is no way to signal an error at this place in the case of e.g. an
> > % integer overflow. This has to be added to the implementation.
> > % (An exception may be thrown inside the converter. If the converter
> > % throws an exception, `lex__read' catches the exception and returns
> > % the appropriated error message. This all is transparent to
> > the user,
> > % I only forgot to implement it.)
>
> Yes, I'd go along with that.
I now wait for additional remarks. If no further remarks come, I'll implement
the changes as proposed by you. OK ?
--
Holger Krug
hkrug at rationalizer.com
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list