Re: Implementing multi-line comments, other characters..

"Nick Maclaren" <nmm1@cus.cam.ac.uk>
2 Jul 2002 01:03:48 -0400

          From comp.compilers

Related articles
Implementing multi-line comments, other characters.. holychapin@hotmail.com (2002-06-28)
Re: Implementing multi-line comments, other characters.. nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-07-02)
Re: Implementing multi-line comments, other characters.. Marko.Makela@HUT.FI (Marko =?ISO-8859-1?Q?M=E4kel=E4?=) (2002-07-02)
| List of all articles for this month |
From: "Nick Maclaren" <nmm1@cus.cam.ac.uk>
Newsgroups: comp.compilers
Date: 2 Jul 2002 01:03:48 -0400
Organization: University of Cambridge, England
References: 02-06-096
Keywords: parse, i18n
Posted-Date: 02 Jul 2002 01:03:48 EDT

  <holychapin@hotmail.com> wrote:
>
>I'm developing a BASIC compiler in C++ and in my reading object
>(Reading.h), it checks for the next word to see if it is an
>identifier, white space, etc.
>
>I'm trying to implement characters like ņ to be used. I put that under
>identifier, but still if you do something in let's say John.bas
>
>Hi Seņor!
>
>It'll give an error (implemented in my errors object). What the
>console box does is show a + over a - instead of ņ. Then, it says +
>over - is not an identifier or anything else, so it is a bad
>name/type.


I am afraid that you are working at the wrong level. This is an evil
task, and the C/C++/etc. primitives cannot get it right. By the sound
of it, you have some horrible (Microsoft?) hack that makes even that
worse.


You need to write an input routine that converts the input to a proper
multi-national character set (whatever the successor to ISO 10646 and
Unicode is numbered in ISO terms) and write the compiler in that. And
a similar routine to convert that to output. If you take short cuts,
you WILL have trouble.


>Also, I want to allow multi-line comments to be used in a BASIC file,
>but I'm not sure how to implement this. If you need to see some code
>to understand, I can provide it.


Well, this item is merely a matter of designing some syntax and
implementing it. So you don't need the code - merely a specification
that has already been made compatible with your BASIC.




Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email: nmm1@cam.ac.uk
Tel.: +44 1223 334761 Fax: +44 1223 334679


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.