To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 341
340  |  342
Subject: 
Re: NQC wishlist
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Thu, 6 Jan 2000 00:42:04 GMT
Viewed: 
2028 times
  
In article <FnuxMy.IpK@lugnet.com>, "Vlad Dumitrescu"
<vladdu@nospam.hotmail.com> wrote:

In lugnet.robotics.rcx.nqc, Dave Baum writes:
Implementation of ## gets pretty nasty - at least within the current
pre-processor design.

I believe the simplest way to do it would be to have an extra preprocessing
pass... it will slow down compilation a little, it's true, but maybe not that
much as to matter (compilation is anyway so much faster than the downloading
anyway)


If I were to implement it, I probably wouldn't add a second pass.  The
real obstacle at present is that the literal text for a token cannot
always be recovered after it leaves the lexer.  For example, '01' and '1'
both leave the lexer as an Integer token of value 1.  Glomming tokens
together with ## requires that you recover the original text and merge
them.  Adding this support (either in a new preprocessor or within the
existing one) would probably be about the same amount of work and take up
the same amount of memory.

Assuming the original text was recoverable, building a temporary buffer
with the glommed tokens and pushing this into the lexer is pretty
straight-forward.

Detection of '##' during macro expansion requires a look-ahead token
during pre-processing, but still isn't too difficult.  In fact you could
probably do the look-ahead when the macro is read (I haven't thought about
this enough to say for certain).

Dave Baum

--
reply to: dbaum at enteract dot com



Message has 1 Reply:
  Re: NQC wishlist
 
(...) I took a good look at the preprocessor code, and it shouldn't be too hard to implement ## aside from the problem of recovering original token text. Adding support for remembering the original token text is easy to do if you're willing to be a (...) (25 years ago, 6-Jan-00, to lugnet.robotics.rcx.nqc)

Message is in Reply To:
  Re: NQC wishlist
 
(...) I believe the simplest way to do it would be to have an extra preprocessing pass... it will slow down compilation a little, it's true, but maybe not that much as to matter (compilation is anyway so much faster than the downloading anyway) then (...) (25 years ago, 5-Jan-00, to lugnet.robotics.rcx.nqc)

17 Messages in This Thread:







Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR