Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-07

fpc-passrc expression parser (issue #16914)

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

dmitry boyarintsev

Hello, Michael Van Canneyt,

Sorry, I can't write to the resolved issue (without re-opening) it.

- better class tree (split out binary/unary/primitive operators in subclasses) These may break backwards compatiblity; if you prefer to do them yourself, I can say what I have in mind.

That's how it was originally written. However, I personally prefer to keep less subclasses.
I would like to hear your ideas.

thanks,
dmitry

P.S.. the expression parser still doesn't resolve ranges (i.e. in sets), neither simple nor complex, like:

Char(6) in [Char(sizeof(Integer))..Char(SizeOf(int64))]

Reply by email

Michael Van Canneyt
to dmitry boyarintsev
dmitry boyarintsev wrote 9 lines
Hello, Michael Van Canneyt, Sorry, I can't write to the resolved issue (without re-opening) it. > - better class tree (split out binary/unary/primitive operators in subclasses) > These may break backwards compatiblity; if you prefer to do them yourself, I can say what I have in mind. That's how it was originally written. However, I personally prefer to keep less subclasses.

I prefer more, with less fields, it saves memory on big expressions :-)

I would like to hear your ideas.

Well, at least I would have expected 4 subclasses: TPasExpr
+-- TUnaryExpr (field operand)
+-- TBinaryExpr (fields left, right)
+-- TPrimitiveExpr (field 'value')
+-- TFunctionCallExpr (fields value/params)

I must say that I am not familiar with the parsing style you used. I wrote 2 expression parsers meanwhile, and both used a different style. (see fcl-base/fpexprpars.pp; the other one is in fcl-js. A third will follow in the sql parser I'm about to commit)

Show quoted text 7 lines
thanks, dmitry P.S.. the expression parser still doesn't resolve ranges (i.e. in sets), neither simple nor complex, like: Char(6) in [Char(sizeof(Integer))..Char(SizeOf(int64))]

That should be relatively easy to add, no ?

Michael.

Reply by email

Paul Nicholls
to Michael Van Canneyt

----- Original Message -----

Earlier message 60 lines
From: "Michael Van Canneyt" To: "FPC-Pascal users discussions" Sent: Tuesday, July 13, 2010 6:42 PM Subject: Re: [fpc-pascal] fpc-passrc expression parser (issue #16914) > > > On Tue, 13 Jul 2010, dmitry boyarintsev wrote: > >> Hello, Michael Van Canneyt, >> >> Sorry, I can't write to the resolved issue (without re-opening) it. >> >>> - better class tree (split out binary/unary/primitive operators in >>> subclasses) >>> These may break backwards compatiblity; if you prefer to do them >>> yourself, I can say what I have in mind. >> >> That's how it was originally written. However, I personally prefer to >> keep less subclasses. > > I prefer more, with less fields, it saves memory on big expressions :-) > >> I would like to hear your ideas. > > Well, at least I would have expected 4 subclasses: > TPasExpr > +-- TUnaryExpr (field operand) > +-- TBinaryExpr (fields left, right) > +-- TPrimitiveExpr (field 'value') > +-- TFunctionCallExpr (fields value/params) > > I must say that I am not familiar with the parsing style you used. I wrote > 2 expression parsers meanwhile, and both used a different style. (see > fcl-base/fpexprpars.pp; the other one is in fcl-js. A third will follow in > the sql parser I'm about to commit) > >> thanks, >> dmitry >> >> P.S.. the expression parser still doesn't resolve ranges (i.e. in >> sets), neither simple nor complex, like: >> >> Char(6) in [Char(sizeof(Integer))..Char(SizeOf(int64))] > > That should be relatively easy to add, no ? > > Michael. Hi all, I am interested in expression parsers myself :) Where can I find the code for "fpexprpars.pp" and other fpc parsing code like that? I had bit of a look browsing the SVN online, but no luck... cheers, Paul

Reply by email

Michael Van Canneyt
to Paul Nicholls
Paul Nicholls wrote 56 lines
----- Original Message ----- From: "Michael Van Canneyt" To: "FPC-Pascal users discussions" Sent: Tuesday, July 13, 2010 6:42 PM Subject: Re: [fpc-pascal] fpc-passrc expression parser (issue #16914) > > > On Tue, 13 Jul 2010, dmitry boyarintsev wrote: > >> Hello, Michael Van Canneyt, >> >> Sorry, I can't write to the resolved issue (without re-opening) it. >> >>> - better class tree (split out binary/unary/primitive operators in >>> subclasses) >>> These may break backwards compatiblity; if you prefer to do them >>> yourself, I can say what I have in mind. >> >> That's how it was originally written. However, I personally prefer to >> keep less subclasses. > > I prefer more, with less fields, it saves memory on big expressions :-) > >> I would like to hear your ideas. > > Well, at least I would have expected 4 subclasses: > TPasExpr > +-- TUnaryExpr (field operand) > +-- TBinaryExpr (fields left, right) > +-- TPrimitiveExpr (field 'value') > +-- TFunctionCallExpr (fields value/params) > > I must say that I am not familiar with the parsing style you used. I wrote > 2 expression parsers meanwhile, and both used a different style. (see > fcl-base/fpexprpars.pp; the other one is in fcl-js. A third will follow in > the sql parser I'm about to commit) > >> thanks, >> dmitry >> >> P.S.. the expression parser still doesn't resolve ranges (i.e. in >> sets), neither simple nor complex, like: >> >> Char(6) in [Char(sizeof(Integer))..Char(SizeOf(int64))] > > That should be relatively easy to add, no ? > > Michael. Hi all, I am interested in expression parsers myself :) Where can I find the code for "fpexprpars.pp" and other fpc parsing code like that?

it is in fcl-base/src ?

the JavaScript scanner/parser is in fcl-js/src
the Pascal scanner/parser is in fcl-passrc/src
The SQL one will be in fcl-db/src/sql

You need trunk for this.

Michael.

Reply by email

Marco van de Voort
to Paul Nicholls: ----- Original Message ----- From: "Michael Van Canneyt" To: "FPC-Pascal users…

In our previous episode, Paul Nicholls said:

Show quoted text 10 lines
> > Michael. Hi all, I am interested in expression parsers myself :) Where can I find the code for "fpexprpars.pp" and other fpc parsing code like that? I had bit of a look browsing the SVN online, but no luck...

That one is in packages/fcl-base, and another is in packages/symbolic

Reply by email

dmitry boyarintsev
to Michael Van Canneyt: I prefer more, with less fields, it saves memory on big expressions :-) Well, at least I…
Michael Van Canneyt wrote
I must say that I am not familiar with the parsing style you used. I wrote 2 expression parsers meanwhile, and both used a different style. see fcl-base/fpexprpars.pp;

um... I guess fpexprpars.pp could (should) be used with passrc in this case?!

anyway, I've the patch for the current parser:
http://bugs.freepascal.org/view.php?id=16931

thanks,
dmitry

Reply by email

Michael Van Canneyt
to dmitry boyarintsev
dmitry boyarintsev wrote 7 lines
On Tue, Jul 13, 2010 at 12:42 PM, Michael Van Canneyt wrote: > I must say that I am not familiar with the parsing style you used. I wrote 2 > expression parsers meanwhile, and both used a different style. see > fcl-base/fpexprpars.pp; um... I guess fpexprpars.pp could (should) be used with passrc in this case?!

You can't do this easily, because the scanners are not compatible. You'd have to write a scanner wrapper.

anyway, I've the patch for the current parser: http://bugs.freepascal.org/view.php?id=16931

I have seen it, I will look at it today.

Michael.

Reply by email