[Fractdev] <Richard> Lex & yacc for formula parser?

Top Page
Delete this message
Reply to this message
Author: Hal Lane
Date:  
To: Fractint developer's list
Old-Topics: Re: [Fractdev] <Richard> Q's re Fractint for Windows
Subject: [Fractdev] <Richard> Lex & yacc for formula parser?
> > When I took a quick look at the formula parser some time ago,
> > I was pretty intimidated. The parser looked like an ad hoc
> > design approach, rather than an automatically generated parser,
> > like lex and yacc.
>
> Yes, its pretty inscrutable. My long term approach is actually to
> replace the parser entirely, but I wouldn't mind fixing the bug that
> causes some formulas to render incorrectly in the near term.


The language that needs to be parsed is a essentially a 'tiny c'.
I will look around and see if anyone has already defined a
'tiny c' in lex and yacc that might be usable.

I located a lex specification for ANSI C grammar circa 1985:
http://www.lysator.liu.se/c/ANSI-C-grammar-l.html

and its corresponding yacc:
http://www.lysator.liu.se/c/ANSI-C-grammar-y.html


A person posting on this page:
http://episteme.arstechnica.com/eve/forums/a/tpc/f/6330927813/m/550002093631
( or: http://tinyurl.com/ysyxxt )

said:
"Bison has an option to generate a C++ based parser,
or a re-entrant C parser. Either of these will feel
a lot more modern than the default parser, which with
its reliance on global variables, I agree feels very
old-fashioned."

I found a web page:
http://www.monmouth.com/~wstreett/lex-yacc/lex-yacc.html

that says:
"Below is a straight port and compilation of FLEX and BISON to
the WIN32."

The page has downloadable programs for the lex and yacc
compatible flex and bison.


I have not used lex or yacc or any of their variants.


- Hal Lane

#########################
# hallane@??? <mailto:hallane@???> #
#########################

> -----Original Message-----
> From: fractdev-bounces@???
> [mailto:fractdev-bounces@???]On Behalf Of Richard
> Sent: Sunday, February 17, 2008 8:39 PM
> To: Fractint developer's list
> Subject: Re: [Fractdev] <Richard> Q's re Fractint for Windows
>
> In article <MDBBJLBFBICIIEIHFBMEOECPDFAA.hallane@???>,
> "Hal Lane" <hallane@???> writes:
>
> > What currently determines how much of the CPU is given to the
> > calculation of a fractal? <---<<
>
> It runs as fast as it can. Screen updates are limited to 10 fps;
> Windows will give a process a little "bonus" in scheduling if its
> window is currently the selected foreground window. Otherwise, you're
> getting just the normal Windows timeslicing. Nothing fancy.
>
> > When I took a quick look at the formula parser some time ago,
> > I was pretty intimidated. The parser looked like an ad hoc
> > design approach, rather than an automatically generated parser,
> > like lex and yacc.
>
> Yes, its pretty inscrutable. My long term approach is actually to
> replace the parser entirely, but I wouldn't mind fixing the bug that
> causes some formulas to render incorrectly in the near term.
>
> > I guess if the formula parser code is still the original code, that
> > something like the changed #includes and/or data typing and
> > it passing must be the source of the problem.
>
> Its probably some hidden assumption that an int is 16 bits somewhere.
> I've had to correct a number of those where they did pointer
> arithmetic and added 2 instead of sizeof(int), and so-on.
>
> > I note that you changed the keys that encode different screen
> > resolutions from the original encodings.
>
> The whole business of specifying video resolution by hotkeys is dumb,
> IMO. It will be replaced with something that lets you specify the
> resolution directly with a fallback to mapping "default" key
> assignments to their default resolutions. Its particularly dumb,
> since the user can change everything so that the key assignments don't
> mean the same resolutions anymore.
>
> > Do you have a web page where you collect the issues/bugs that
> > people report or that you are working on -- beyond the items
> > listed in the BUGS.txt file included in your distribution?
>
> I have a list of bugs that have been reported, some of which are not
> in that text file since they were reported after the release of that
> beta version. Feel free to report any bugs to this list.
>
> > I don't want to report any items that have already been
> > reported, or reported and fixed like: <---<<
> >
> > > <\> or <h> or <ctrl-h> just redraws the current image
> > Fixed in beta 6
>
> I can always give it a quick test and tell you whether or not I've
> fixed it already. I've fixed the major ones except for this formula
> rendering problem.
> --
> "The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
> <http://www.xmission.com/~legalize/book/download/index.html>
>
> Legalize Adulthood! <http://blogs.xmission.com/legalize/>
>
> _______________________________________________
> Fractdev mailing list
> Fractdev@???
> http://mailman.xmission.com/cgi-bin/mailman/listinfo/fractdev