Re: Need starting tips for a new interpreter / parser

"Harald Fjerdingstad" <lio-daa@online.no>
4 Jan 1999 13:02:45 -0500

          From comp.compilers

Related articles
Need starting tips for a new interpreter / parser lio-daa@online.no (Harald Fjerdingstad) (1999-01-02)
Re: Need starting tips for a new interpreter / parser mslamm@mscc.huji.ac.il (Ehud Lamm) (1999-01-03)
Re: Need starting tips for a new interpreter / parser anton@mips.complang.tuwien.ac.at (1999-01-03)
Re: Need starting tips for a new interpreter / parser lio-daa@online.no (Harald Fjerdingstad) (1999-01-04)
Re: Need starting tips for a new interpreter / parser lio-daa@online.no (Harald Fjerdingstad) (1999-01-06)
Re: Need starting tips for a new interpreter / parser escargo@mirage.skypoint.com (1999-01-06)
Re: Need starting tips for a new interpreter / parser mslamm@mscc.huji.ac.il (Ehud Lamm) (1999-01-11)
Re: Need starting tips for a new interpreter / parser Immanuel.Litzroth@pandora.be (Immanuel Litzroth) (1999-01-11)
Re: Need starting tips for a new interpreter / parser mikee@cetasoft.cog (1999-01-15)
Re: Need starting tips for a new interpreter / parser hunk@alpha1.csd.uwm.edu (1999-01-15)
[5 later articles]
| List of all articles for this month |

From: "Harald Fjerdingstad" <lio-daa@online.no>
Newsgroups: comp.compilers
Date: 4 Jan 1999 13:02:45 -0500
Organization: Telenor Online Public Access
References: 99-01-012 99-01-016
Keywords: interpreter

Thanks for your answer, (and to -John; where can I get a free
version of Python or TCL, as you said? )


OK. I know there are many interpreters out there. But to run my report
generator tool I believe I need to extend "normal" languages.


Let me be more specific of what I want: (nothing would be better if
the conclusion through this user group will be to use an already
existing interpreter).


First of all to produce a report from a report language source file, I
need to add some rules to loop through the different report-bands
after specific rules. Ex. the REPORTBODYBAND should loop until no more
records in the query., The REPORTHEADERBAND should be called for every
new page etc. Remember I AM NOT CREATING JUST ANOTHER VISUAL REPORT
GENERATOR. This reporting tool is completely source-code driven.


Second, my reporting tool is ment for the advanced user but not for a
programmer. I will have a lot of "extra" reserved words which will "do
a lot" (like in 4GL languages).




The report source will provide 7 BANDS, In the following lines I show
the one of them as an example; the REPORTBODY, which should
autmatically iterate until EOF: (The grammar of the languages looks
like Pascal, I have designed it so far)


***************************************************************************
query1: DataSet; // Declare SQL query
query1 := 'select * from employees where total_sale > 0';


// ================= REPORT BODY =====================
reportbodyband query1 = true; // Loops through all
body-lines until EOF
// Read this as: WHILE QUERY1.NEXT still contains an employee


// Go into this area if reportbodyband is TRUE


    //
    // Set normal font
    //
    setfont('Arial', 10, 'normal');


    //
    // Writes to device context of printer based on the SQL-query
    //
    printfield(1, leftalign, query1('employeenum'));
    printfield(5, leftalign, query1('emplname'));
    printfield(12, rightalign, query1('total_sale'));


    //
    // Calculate bonus
    //
    if query1('years_employedt')>10 then // Years employeed
        amount1 := 60 * query1('total_sale') / 100; // Bonus = 60% of sale
    elseif 0=0; // Alltid utfør hvis <=10
        amount1 := 40 * query1('total_sale') / 100; // Only 40% of sale
    endif;
    printfield(15, rightalign, amount1);


    newline; // Confirms line and
increase band height (Y)


    if query1('total_sale')<1000.0 then // Omsetning < $1000 ?
        sql('delete from employee where employeenum=' + query1('employeenum'));
  //Fire him/her
    endif;


    total1 := total1 + query1('total_sale'); // Accumulate sale


******************************************************
(Next band to come here)
(Loop back to start of body automatically)
(Next band will name will work as a END OF PREVIOUS BAND marker)
(amount1 and total1 will be used in the REPORTTOTALSBAND)




-- Anyone?


Harald Fjerdingstad
[I certainly hope nobody's writing yet another visual report generator,
since most of them look to me worse than the primitive one I wrote for
my thesis in about 1978. But this looks like a fine candidate for Python
which is at www.python.org or maybe TCL at www.neosoft.com/tcl or
www.scriptics.com. If nothing else, hacking something up in Python or TCL
is fast and then you can try some experiments to decide if you're done
or not. Even if you end up with your own language, the application
specific stuff will be reusable. -John]





Post a followup to this message

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