Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #2477
| From | "Ev. Drikos" <drikosev@gmail.com> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: Languages with optional spaces |
| Date | 2020-03-02 20:04 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <20-03-006@comp.compilers> (permalink) |
| References | <20-02-015@comp.compilers> <20-02-033@comp.compilers> <20-02-034@comp.compilers> <20-03-003@comp.compilers> <20-03-005@comp.compilers> |
On 02/03/2020 08:33, Christopher F Clark wrote:
> ...
>
> As far as I can tell (and I haven't thought seriously about BASIC for
> years), there are roughly two cases.
>
Neither I have thought seriously about any BASIC Dialect so far. The
example grammar in my previous message took me less than half an hour.
> 1) We have already identified the lower bound in "lower bound TO upper
> bound". This can happen if we saw a number, or maybe an identifier
> without the word "TO" in it (followed by a space?). This will not be
> true, if we just saw an operator such as "+" as we will be expecting
> another identifier to continue the expression...
One is supposed to progressively add syntax as needed. I just found such
a case at www.gkc.org.uk/martin/software/UK101-tapes.zip:
5120 FOR J=K+1TON4:A(K,J)=A(K,J)/P:NEXT J:I=1
Here is a more complete rule that parses ie "512 FOR J=LOWER+1TOUPPER"
<lbound> ::=
<lbound> <rel-op> <lbound> ~: <rel-op>
| <lbound> <add-op> <lbound>
| <lbound> <mult-op> <lbound>
| <add-op> <lbound> -: { <mult-op> }
| <number>
| <id-p>
IMHO, the most difficult problems come with statements like "NEXT i,j"
that imply a shared end statement of two FOR loops and BASIC doesn't
seem to be as easy as Fortran where this problem has a simple solution:
https://github.com/drikosev/Fortran/blob/master/OMP_Legacy_Parser.txt
> ...
> So, what would I do? I would do it in 3 parts. A lexer, a "fixer",
> and a parser...
So, the suggestion is a fixer between the parser and the lexer. Ok, I
appreciate your opinion.
Ev. Drikos
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
Languages with optional spaces Maury Markowitz <maury.markowitz@gmail.com> - 2020-02-19 07:35 -0800
Re: Languages with optional spaces Jerry <awanderin@gmail.com> - 2020-02-20 23:38 -0700
Re: Languages with optional spaces Maury Markowitz <maury.markowitz@gmail.com> - 2020-02-25 06:13 -0800
Re: Languages with optional spaces awanderin <awanderin@gmail.com> - 2020-02-26 10:03 -0700
Re: Languages with optional spaces "Ev. Drikos" <drikosev@gmail.com> - 2020-03-12 17:45 +0200
Re: Languages with optional spaces "Ev. Drikos" <drikosev@gmail.com> - 2020-02-23 12:33 +0200
Re: Languages with optional spaces Martin Ward <martin@gkc.org.uk> - 2020-02-25 17:00 +0000
Re: Languages with optional spaces "Ev. Drikos" <drikosev@gmail.com> - 2020-02-28 13:34 +0200
Re: Languages with optional spaces Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2020-02-29 11:48 +0200
Re: Languages with optional spaces "Ev. Drikos" <drikosev@gmail.com> - 2020-02-29 21:38 +0200
Re: Languages with optional spaces Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2020-03-01 10:07 +0200
Re: Languages with optional spaces "Ev. Drikos" <drikosev@gmail.com> - 2020-03-01 19:41 +0200
Re: Languages with optional spaces Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2020-03-02 08:33 +0200
Re: Languages with optional spaces "Ev. Drikos" <drikosev@gmail.com> - 2020-03-02 20:04 +0200
Re: Languages with optional spaces Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2020-03-01 00:28 +0100
Re: Languages with optional spaces Maury Markowitz <maury.markowitz@gmail.com> - 2020-02-25 06:11 -0800
Re: Languages with optional spaces Kaz Kylheku <493-878-3164@kylheku.com> - 2020-02-26 08:06 +0000
Re: Languages with optional spaces and tools Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2020-02-28 20:16 +0100
Re: Languages with optional spaces gah4@u.washington.edu - 2020-03-02 21:12 -0800
Re: Languages with optional spaces Gene <gene.ressler@gmail.com> - 2020-04-14 10:08 -0700
Re: Languages with optional spaces mertesthomas@gmail.com - 2020-04-19 04:04 -0700
Re: Languages with optional spaces aston.goldsmith@gmail.com - 2020-05-05 13:05 -0700
csiph-web