Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.os.development > #8747 > unrolled thread
| Started by | "Rod Pemberton" <boo@fasdfrewar.cdm> |
|---|---|
| First post | 2015-09-11 19:11 -0400 |
| Last post | 2015-11-01 09:07 -0800 |
| Articles | 2 on this page of 142 — 9 participants |
Back to article view | Back to alt.os.development
C parser ramblings, language design, etc "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-09-11 19:11 -0400
Re: C parser ramblings, language design, etc "Alexei A. Frounze" <alexfrunews@gmail.com> - 2015-09-12 05:10 -0700
Re: C parser ramblings, language design, etc "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-09-13 04:41 -0400
Re: C parser ramblings, language design, etc "Alexei A. Frounze" <alexfrunews@gmail.com> - 2015-09-13 02:37 -0700
Re: C parser ramblings, language design, etc "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-09-13 07:20 -0400
Re: C parser ramblings, language design, etc "James Harris" <james.harris.1@gmail.com> - 2015-09-13 18:37 +0100
Re: C parser ramblings, language design, etc "Alexei A. Frounze" <alexfrunews@gmail.com> - 2015-09-13 21:03 -0700
Re: C parser ramblings, language design, etc "James Harris" <james.harris.1@gmail.com> - 2015-09-12 13:49 +0100
Re: C parser ramblings, language design, etc "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-09-13 06:27 -0400
Re: C parser ramblings, language design, etc "James Harris" <james.harris.1@gmail.com> - 2015-09-13 19:02 +0100
Re: C parser ramblings, language design, etc "Alexei A. Frounze" <alexfrunews@gmail.com> - 2015-09-13 15:10 -0700
Re: C parser ramblings, language design, etc "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-09-13 20:30 -0400
Re: C parser ramblings, language design, etc "Alexei A. Frounze" <alexfrunews@gmail.com> - 2015-09-13 20:07 -0700
Re: C parser ramblings, language design, etc "James Harris" <james.harris.1@gmail.com> - 2015-09-14 22:29 +0100
Re: C parser ramblings, language design, etc "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-09-20 18:48 -0400
Re: C parser ramblings, language design, etc "James Harris" <james.harris.1@gmail.com> - 2015-09-22 20:04 +0100
Re: C parser ramblings, language design, etc "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-09-30 20:32 -0400
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2015-12-27 13:51 +0000
Re: C parser ramblings, language design, etc "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-12-27 17:35 -0500
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-16 17:09 +0000
Re: C parser ramblings, language design, etc Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-01-16 14:30 -0500
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-16 21:40 +0000
Re: C parser ramblings, language design, etc Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-01-18 07:34 -0500
Re: C parser ramblings, language design, etc Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-01-18 08:37 -0500
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-18 23:35 +0000
Re: C parser ramblings, language design, etc "wolfgang kern" <nowhere@never.at> - 2016-01-19 12:52 +0100
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-19 13:09 +0000
Re: C parser ramblings, language design, etc "wolfgang kern" <nowhere@never.at> - 2016-01-19 21:46 +0100
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-21 11:15 +0000
Re: C parser ramblings, language design, etc "wolfgang kern" <nowhere@never.at> - 2016-01-21 21:48 +0100
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-22 15:16 +0000
Re: C parser ramblings, language design, etc "wolfgang kern" <nowhere@never.at> - 2016-01-22 23:02 +0100
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-01-23 17:04 +0100
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-27 15:27 +0000
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-02-29 09:26 +0100
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-02-29 19:02 +0000
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-03-02 20:48 +0000
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-03-09 22:29 +0100
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-03-17 16:41 +0000
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-03-29 09:00 +0200
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-03-09 22:29 +0100
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-03-17 17:36 +0000
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-03-29 09:01 +0200
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-04-02 10:13 +0100
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-04-10 19:33 +0200
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-04-15 16:27 +0200
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-04-26 08:10 +0100
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-05-03 20:14 +0200
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-05-04 09:17 +0100
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-05-21 21:10 +0200
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-05-29 08:44 +0100
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-05-29 12:05 +0200
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-05-29 12:28 +0100
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-06-01 19:22 +0200
OT: Obama in the UK (was: C parser ramblings, language design, etc) James Harris <james.harris.1@gmail.com> - 2016-04-26 08:46 +0100
Re: OT: Obama in the UK (was: C parser ramblings, language design, etc) Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-04-26 23:58 -0400
Re: OT: Obama in the UK (was: C parser ramblings, language design, etc) Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-04-27 00:08 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-04-27 06:40 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-04-27 05:25 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-04-27 17:45 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-04-27 18:25 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-05-02 23:44 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-05-03 16:56 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-05-04 09:23 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-05-04 17:22 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-05-06 11:47 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-05-06 19:34 -0400
Re: OT: Obama in the UK "James Harris" <james.harris.1@gmail.com> - 2016-05-07 12:51 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-05-07 19:20 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-05-08 01:46 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-05-07 21:43 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-05-08 09:36 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-05-08 15:34 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-05-10 11:25 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-05-10 17:32 -0400
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-05-10 18:25 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-05-15 00:06 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-05-07 21:32 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-06-02 07:41 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-06-02 16:21 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-05-20 14:59 +0100
Re: OT: Obama in the UK "wolfgang kern" <nowhere@never.at> - 2016-05-20 21:13 +0200
Re: OT: Obama in the UK "wolfgang kern" <nowhere@never.at> - 2016-05-20 21:17 +0200
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-05-21 08:04 +0100
Re: OT: Obama in the UK Bernhard Schornak <schornak@web.de> - 2016-05-21 21:10 +0200
Re: OT: Obama in the UK "wolfgang kern" <nowhere@never.at> - 2016-05-21 11:16 +0200
Re: OT: Obama in the UK Bernhard Schornak <schornak@web.de> - 2016-05-21 21:11 +0200
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-05-20 22:51 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-05-21 07:29 +0100
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-06-02 08:33 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-06-02 16:21 -0400
UK pronunciation was, [Re: OT: Obama in the UK, was C lang parser ramblings] Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-06-11 14:34 -0400
Re: UK pronunciation was, [Re: OT: Obama in the UK, was C lang parser ramblings] James Harris <james.harris.1@gmail.com> - 2016-07-24 18:28 +0100
Re: UK pronunciation was, [Re: OT: Obama in the UK, was C lang parser ramblings] Rod Pemberton <NoHaveNotOne@bcczxcfrze.cam> - 2016-07-25 21:54 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-07-24 18:21 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfrze.cam> - 2016-07-25 21:54 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-07-26 10:02 +0100
Re: OT: Obama in the UK Rod Pemberton <NoHaveNotOne@bcczxcfrze.cam> - 2016-07-26 07:56 -0400
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-07-30 12:26 +0100
Re: OT: Obama in the UK Bernhard Schornak <schornak@web.de> - 2016-05-03 20:14 +0200
Re: OT: Obama in the UK James Harris <james.harris.1@gmail.com> - 2016-05-04 09:25 +0100
Re: OT: Obama in the UK Bernhard Schornak <schornak@web.de> - 2016-05-21 21:11 +0200
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-04-26 07:59 +0100
Re: C parser ramblings, language design, etc Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-04-27 00:01 -0400
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-04-27 09:28 +0100
Re: C parser ramblings, language design, etc Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-04-27 05:42 -0400
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-04-27 17:16 +0100
Re: C parser ramblings, language design, etc Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-04-27 18:05 -0400
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-04-27 09:29 +0100
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-04-27 09:42 +0100
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-05-03 20:14 +0200
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-05-07 14:34 +0100
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-05-21 21:10 +0200
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-05-29 11:27 +0100
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-06-01 19:22 +0200
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-05-07 16:34 +0100
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-05-21 21:10 +0200
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-05-29 12:10 +0100
Re: C parser ramblings, language design, etc Bernhard Schornak <schornak@web.de> - 2016-06-01 19:22 +0200
Re: C parser ramblings, language design, etc Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-01-25 18:29 -0500
Re: C parser ramblings, language design, etc "wolfgang kern" <nowhere@never.at> - 2016-01-26 11:47 +0100
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-27 17:08 +0000
Re: C parser ramblings, language design, etc "wolfgang kern" <nowhere@never.at> - 2016-01-28 11:54 +0100
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-28 11:47 +0000
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-21 10:13 +0000
Re: C parser ramblings, language design, etc Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-01-25 18:29 -0500
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-27 17:15 +0000
Re: C parser ramblings, language design, etc Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-01-27 17:31 -0500
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-28 11:07 +0000
Re: C parser ramblings, language design, etc Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-01-19 22:28 -0500
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-22 15:04 +0000
Re: C parser ramblings, language design, etc Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-01-25 17:48 -0500
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2016-01-27 17:16 +0000
Re: cows and bulls game, was [Re: C parser ramblings, language design, etc] "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-12-27 21:19 -0500
Re: C parser ramblings, language design, etc "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-09-30 20:32 -0400
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2015-10-05 15:13 +0100
Re: C parser ramblings, language design, etc "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-05 21:56 -0400
Re: C parser ramblings, language design, etc James Harris <james.harris.1@gmail.com> - 2015-12-27 13:56 +0000
Re: C parser ramblings, language design, etc "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-21 19:46 -0400
Re: C parser ramblings, language design, etc "James Harris" <james.harris.1@gmail.com> - 2015-09-12 15:38 +0100
Re: C parser ramblings, language design, etc "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-09-13 07:10 -0400
Re: C parser ramblings, language design, etc "s_dubrovich@yahoo.com" <s_dubrovich@yahoo.com> - 2015-11-01 09:07 -0800
Page 8 of 8 — ← Prev page 1 2 3 4 5 6 7 [8]
| From | "Rod Pemberton" <boo@fasdfrewar.cdm> |
|---|---|
| Date | 2015-09-13 07:10 -0400 |
| Message-ID | <op.x4wencplyfako5@localhost> |
| In reply to | #8760 |
On Sat, 12 Sep 2015 10:38:18 -0400, James Harris <james.harris.1@gmail.com> wrote: > "Rod Pemberton" <boo@fasdfrewar.cdm> wrote in message > news:op.x4tmp0ssyfako5@localhost... >> I also recently made some great progress on my OS-like >> environment for DOS that provides a console window for DOS. >> It's coded for DJGPP (GCC) C and uses CWSDPMI features. >> I now just need to find some use for it. > > I am puzzled. Why did you write it if you didn't have > a use for it? LOL. LOL. I'm at a slight loss to explain that rationally ... Um, it just sort of came to me in a flash, that I could do so, and so I did. If I don't do things when they come to me, the idea or concept never gets done. I didn't want to "lose" it, or be aware of it on my "to do" list but not find time to implement or create it. I was thinking about my OS, also about Windows 98/SE console, about v86 mode monitors, whether I should code a monitor, and also about the original purpose of my OS, when I realized that, after learning some "secret" things about DJGPP, I knew enough that could put together a console like DJGPP app. So, I coded up the base app one afternoon, then worked on implementing a number of other things, then ran into a serious problem, and so I let it sit around for a year. A year later, I started tweaking, updating, re-organizing, and optimizing the code. I was wanting to work on other projects, as I had ideas in mind for them, but kept being drawn back to this one. Then, I realized that the problem I had wasn't a problem at all, just a simple mistake on my part and some needed and undocumented DJGPP info. So, I fixed that and determined the undocumented info too. Technically, it's a console window, but it's almost like an OS that runs on top of DOS, except it's not an OS yet because it hasn't added anything or improved anything as compared to DOS itself, but it's the base code for an OS on DOS. It'll work well with DJGPP apps, possibly other DPMI apps for DOS, but will need lots of work to improve regular DOS apps which don't use DPMI. The "cool" part is the interrupts can be coded in pure C. No special assembly wrappers are required, because I figured out some undocumented DJGPP stuff. ISTM, that this was left out intentionally ... So, the C library handles the interrupt wrappers. >> At the moment it >> doesn't provide any advantage over a standard DOS command >> line, except I can watch PM interrupts, which are only called >> by DJGPP apps, and install PM interrupts and keep them active. >> So, no RM interrupts are being monitored at the moment. The >> Windows 98/SE console windows was much faster than DOS. So, >> improving speed is one potential option for a purpose. > > That sounds like a problem being found to fit a solution. Well, DOS is slow, and Windows 98/SE is not widely available anymore, but has an excellent console window which was quick. So, I'm not sure what else to do with it. It could be the foundation for a game, but what game needs the DOS CLI? Perhaps, a DOS GUI? That's another OS-like app ... > Perhaps you could add it or something like it to your own OS > to give you a shell window, unless your OS has that already. It's not a full shell or command interpreter. DOS does all the shell or command work, except for an internal implementation of the DOS PROMPT command which was needed to correctly display a PROMPT. This heavily uses DJGPP's C library, specific CWSDPMI DPMI host features, and uses DOS itself. > BTW, can you execute apps in your console windows? Yes, but not because of my code. It uses DJGPP's system() to execute .exe files, .com files, raw DJGPP COFF, etc detected as being apps or executable by a DJGPP function. IIRC, there was an issue with DOS .bat files though. There was a very good DOS command interpreter posted to Ibiblio (formerly Simtel) for FreeDOS by Allen Cheung of Centroid Corp which compiles with DJGPP for DOS. Rod Pemberton -- Just how many texting and calendar apps does humanity need?
[toc] | [prev] | [next] | [standalone]
| From | "s_dubrovich@yahoo.com" <s_dubrovich@yahoo.com> |
|---|---|
| Date | 2015-11-01 09:07 -0800 |
| Message-ID | <b2afe627-8e7e-440e-95f6-8a4e6d395cf9@googlegroups.com> |
| In reply to | #8747 |
On Friday, September 11, 2015 at 6:11:45 PM UTC-5, Rod Pemberton wrote:
> You would think that C, being created long ago, would be very easy
> to parse with truly simple techniques, but things like optional
> braces, 'while' used as both 'while' and 'do-while', i.e., which
> 'while' goes with 'do' when nested, base types comprising multiple
> words, e.g., "long long", implicit int's, no keyword for typedef
> usage, conflict with implicit int's and typedef's, ... etc all
> complicate very simple C parsers.
>
> E.g., since braces are optional in C, there isn't much useful
> information for parsing, from statements like this:
>
first:> do while(x--); while(x--);
>
> That's confusing for a human and a simple parser. It could be
> recognized by both as either of these:
>
second:> do { while(x--); } while(x--);
third:> do {} while (x--); while(x--);
>
My fourth: do ; while (x--); while(x--);
> Which 'while' goes with the 'do'? Only the first one is correct,
> but how do you determine that from the braceless syntax above?
> You get a 'while' prior to the 'while' you need.
But the form of do..while is 'do <statement> while ( expression ) ;
So, first: and second: are equivalent as nested loops. The first
'while' after 'do' is seen as <statement>.
And, third: and fourth: are equivalent as un-nested loops. The
<statement> in third: is the compound null statement '{}', the
<statement> in fourth: is the singular null statement.
(That is, as seen by GCC).
>
> Technically, the second example needs a semicolon, but that
> doesn't help any with properly parsing the braceless example.
Yes, '{}' should be '{;}' but compilers are lax about this rule.
The braces are supposed to bracket one or more statements, and ';'
stands in for the null statement. If you are lawyering C, '{}'
should be a soft error, but if it is pruned from the AST as a
non-statement then third: becomes as first: and second:, so this
makes your point, chalk-up another idiosyncrasy.
>
> 'while' is overloaded or ambiguous. It means two different
> things at different places, and somehow the parser or compiler
> must distinquish and keep track of which 'while' goes with
> which 'do'. Nesting can throw the dual-keyword do-while loop
> tracking out of whack. Adding nested while just complicates
> it further. You almost need a stack and a state-machine.
>
Well you do. The parser is looking for <statement> when is sees
'do', and expects another <statement> next after 'do' - what if
that is another 'do'? Seems to me that is a recursion needing
'a stack and a state-machine' to parse.
(5) do do do ; while (x--); while (y--); while (z--);
==================
int x,y,z;
main ()
{ /** gcc -S -o tstdowh.s tstdowh.c **/
first: do while (x--); while (x--);
second: do { while (x--); } while (x--);
third: do {} while (x--); while (x--);
fourth: do ; while (x--); while (x--);
do do do ; while (x--); while (y--); while (z--);
}
--------
.file "tstdowh.c"
.comm x,4,4
.comm y,4,4
.comm z,4,4
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
(first)
.L2:
.L11:
nop
.L3:
movl x, %eax
testl %eax, %eax
setne %dl
subl $1, %eax
movl %eax, x
testb %dl, %dl
jne .L3
movl x, %eax
testl %eax, %eax
setne %dl
subl $1, %eax
movl %eax, x
testb %dl, %dl
jne .L11
(second)
.L4:
.L12:
nop
.L5:
movl x, %eax
testl %eax, %eax
setne %dl
subl $1, %eax
movl %eax, x
testb %dl, %dl
jne .L5
movl x, %eax
testl %eax, %eax
setne %dl
subl $1, %eax
movl %eax, x
testb %dl, %dl
jne .L12
(third-a)
.L6:
movl x, %eax
testl %eax, %eax
setne %dl
subl $1, %eax
movl %eax, x
testb %dl, %dl
jne .L6
nop
(third-b)
.L7:
movl x, %eax
testl %eax, %eax
setne %dl
subl $1, %eax
movl %eax, x
testb %dl, %dl
jne .L7
(fourth-a)
.L8:
movl x, %eax
testl %eax, %eax
setne %dl
subl $1, %eax
movl %eax, x
testb %dl, %dl
jne .L8
nop
(fourth-b)
.L9:
movl x, %eax
testl %eax, %eax
setne %dl
subl $1, %eax
movl %eax, x
testb %dl, %dl
jne .L9
(5-fifth)(three nested loops)
.L10:
movl x, %eax
testl %eax, %eax
setne %dl
subl $1, %eax
movl %eax, x
testb %dl, %dl
jne .L10
movl y, %eax
testl %eax, %eax
setne %dl
subl $1, %eax
movl %eax, y
testb %dl, %dl
jne .L10
movl z, %eax
testl %eax, %eax
setne %dl
subl $1, %eax
movl %eax, z
testb %dl, %dl
jne .L10
popl %ebp
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Debian 4.7.2-5) 4.7.2"
.section .note.GNU-stack,"",@progbits
==================
I was going to bring up another subject but I'm out of time:
Is it possible to program in C in a stackless way for pure ROM code.
I.e. no calls (labeled functions), only register parameters.
Steve
==================
> That would've been much simpler to parse and emit code for if a
> different keyword was used at the bottom of the loop or if the
> condition was placed at the top of the loop for a do-while.
> I.e., this is much easier to parse, since the 'while' keyword
> isn't overloaded and it's easier to match paired 'do' and 'end':
>
> do end(x--); while(x--);
> do while(x--); end(x--);
>
> Now, you know that every end is at the same scope as the 'do'
> and you're not going to have "spurious" 'end's' inbetween.
>
> /* condition syntax at top of bottom test/exit loop */
> do(x--); { while(x--); }
>
> That's even simpler.
>
> I think the goal for any language should not only be LALR(1)
> but also be able to be compiled in a single-pass with no
> backtracking and with exceptionally easy parsing. That's why
> my language uses space delimited parsing, like Forth, with
> character directed parsing. I.e., a character in front of
> each keyword, operator, etc in the language, tells the parser
> what is coming next.
>
> E.g., the hello world program for my language:
>
> ^main
> {
> $"Hello_World!" ~puts
> }
>
> I.e., '^' for declaring a procedure, '~' for calling a
> procedure, etc. The parser doesn't have to determine that
> "main" is a procedure or an identifier or that it's being
> declared here, or that "puts" is a procedure which is being
> called, or that "Hello_World" is a string, etc. The character
> directive tells it that. Save info. It's like a built-in
> AST, somewhat. I also went to a little bit of extra work
> to support curly braces without following that pattern, which
> would've required something to follow a brace. Unfortunately,
> I just realized that I should've provided for a C style
> semicolon too ';' for multipled statements per block.
>
> I also did some work on my larger C parser project. I merged
> in a bunch of similar code from other projects which helped
> to fill the program out somewhat more than it was. Now, it
> emits nicely reformatted C, an AST as text, and it's emitting
> some very rudimentary assembly code, but it has a long, ...
> long way to go to properly compile C code. Fortunately,
> I have a number of other simpler C projects.
>
> I also recently made some great progress on my OS-like
> environment for DOS that provides a console window for DOS.
> It's coded for DJGPP (GCC) C and uses CWSDPMI features.
> I now just need to find some use for it. At the moment it
> doesn't provide any advantage over a standard DOS command
> line, except I can watch PM interrupts, which are only called
> by DJGPP apps, and install PM interrupts and keep them active.
> So, no RM interrupts are being monitored at the moment. The
> Windows 98/SE console windows was much faster than DOS. So,
> improving speed is one potential option for a purpose.
> Unfortunately, switching RM interrupts back to PM has overhead
> which could reduce any real gains from 32-bit PM C code.
> Unfortunately, CWSDPMI doesn't use v86, unless VCPI is
> installed, which would've reflected all RM interrupts to PM.
>
>
> Rod Pemberton
>
>
> --
> Just how many texting and calendar apps does humanity need?
[toc] | [prev] | [standalone]
Page 8 of 8 — ← Prev page 1 2 3 4 5 6 7 [8]
Back to top | Article view | alt.os.development
csiph-web