Passing through

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Passing through

Elliman, David
Passing through

Hi,

I have an application deployed using grammatica - it's great thanks.

However we want to make use of an expression evaluator internally (probably Flee - which itself uses grammatica!) So ideally we would like to have some "Evaluate" production that simply passes through to the other internal parser (by specifically invoking it on the ExitEvaluateProduction(….) handler that I would supply. The problem of course it that the reg exp is too wide; I had definedthe token  PASS_THROUGH <<.+>> and now nothing works because it's too wide and capturing everything all the time. I know that the reg exps are context free WRT the productions which is leading to this but is there any other way to construct this pass through type functionality - other than upgrading our syntax to support everything supported in the internal parser?

Cheers, and thanks again

Dave

_______________________________________________________________________

This email is intended only for the use of the individual(s) to whom
it is addressed and may be privileged and confidential.

Unauthorised use or disclosure is prohibited. If you receive this
e-mail in error, please advise immediately and delete the original
message without copying, using, or telling anyone about its contents.

This message may have been altered without your or our knowledge and
the sender does not accept any liability for any errors or omissions
in the message.

This message does not create or change any contract.  Royal Bank of
Canada and its subsidiaries accept no responsibility for damage caused
by any viruses contained in this email or its attachments.  Emails may
be monitored.

RBC Capital Markets is a business name used by branches and
subsidiaries of Royal Bank of Canada, including Royal Bank of Canada,
London branch and Royal Bank of Canada Europe Limited. In accordance
with English law requirements, details regarding Royal Bank of Canada
Europe Limited are set out below:

ROYAL BANK OF CANADA EUROPE LIMITED
Registered in England and Wales 995939
Registered Address: 71 Queen Victoria Street, London, EC4V 4DE.
Authorised and regulated by the Financial Service Authority.
Member of the London Stock Exchange

_______________________________________________
Grammatica-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/grammatica-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing through

Oliver Gramberg

Hi Dave,

what exactly is it you want to pass through - characters from the input stream, tokens, or a parse tree? From what you say I take it that the internal parser is complete and self-contained, so you are probably thinking of passing characters. First thing that comes to my mind is, pass the exact same stream that you gave to the outer parser to the inner parser at the correct location. Two caveats:
- When you call the inner parser in some Exit... method, all input that corresponds to that rule will already have been parsed, Exit... is post-processing.
- The parser may have read a substantial number of characters from the input stream in order to produce enough look-ahead tokens, depending on the complexity of your grammar.
My best guess, then, is that you should define a very distinctive token that is to appear before the embedded parts, to prevent the parser from reading ahead. Override that token's Exit... method and try if the input stream still contains the beginning of the following embedded part. If not, some refactoring of your grammar may help.

Regards
Oliver



Oliver Gramberg
ABB AG
Forschungszentrum Deutschland
DECRC/I2
Wallstadter Str. 59
D-68526 Ladenburg

Phone: +49 6203/71-6461
Fax: +49 6203/71-6253
E-mail:
oliver.gramberg@...

Sitz/Head Office: Mannheim
Registergericht/Registry Court: Mannheim
Handelsregisternummer/Commercial Register No.: HRB 4664

Vorstand/Managing Board: Peter Smits (Vorsitzender/Chairman), Heinz-Peter Paffenholz, Dr. Joachim Schneider, Hendrik Weiler
Vorsitzender des Aufsichtsrats/Chairman of Supervisory Board: Bernhard Jucker

Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.




"Elliman, David" <[hidden email]>
Sent by: grammatica-users-bounces+oliver.gramberg=[hidden email]

14.09.2009 12:30

Please respond to
[hidden email]

To
<[hidden email]>
cc
Subject
[Grammatica-users] Passing through





Hi,

I have an application deployed using grammatica - it's great thanks.

However we want to make use of an expression evaluator internally (probably Flee - which itself uses grammatica!) So ideally we would like to have some "Evaluate" production that simply passes through to the other internal parser (by specifically invoking it on the ExitEvaluateProduction(….) handler that I would supply. The problem of course it that the reg exp is too wide; I had definedthe token  PASS_THROUGH <<.+>> and now nothing works because it's too wide and capturing everything all the time. I know that the reg exps are context free WRT the productions which is leading to this but is there any other way to construct this pass through type functionality - other than upgrading our syntax to support everything supported in the internal parser?

Cheers, and thanks again

Dave

_______________________________________________________________________

This email is intended only for the use of the individual(s) to whom
it is addressed and may be privileged and confidential.

Unauthorised use or disclosure is prohibited. If you receive this
e-mail in error, please advise immediately and delete the original
message without copying, using, or telling anyone about its contents.

This message may have been altered without your or our knowledge and
the sender does not accept any liability for any errors or omissions
in the message.

This message does not create or change any contract.  Royal Bank of
Canada and its subsidiaries accept no responsibility for damage caused
by any viruses contained in this email or its attachments.  Emails may
be monitored.

RBC Capital Markets is a business name used by branches and
subsidiaries of Royal Bank of Canada, including Royal Bank of Canada,
London branch and Royal Bank of Canada Europe Limited. In accordance
with English law requirements, details regarding Royal Bank of Canada
Europe Limited are set out below:

ROYAL BANK OF CANADA EUROPE LIMITED
Registered in England and Wales 995939
Registered Address: 71 Queen Victoria Street, London, EC4V 4DE.
Authorised and regulated by the Financial Service Authority.
Member of the London Stock Exchange
_______________________________________________
Grammatica-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/grammatica-users


_______________________________________________
Grammatica-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/grammatica-users

Reply | Threaded
Open this post in threaded view
|

RE: Passing through

Elliman, David
Hi Oliver,
 
I've solved it now - thanks. The problem was that the inner stream would contain valid entities from the outer stream - just in a different context. So I took your suggestion about a disntinctive token, effectively a begin and end marker. I just take the inner content and pass it through - thanks


From: grammatica-users-bounces+david.elliman=[hidden email] [mailto:grammatica-users-bounces+david.elliman=[hidden email]] On Behalf Of Oliver Gramberg
Sent: 14 September 2009 12:21
To: [hidden email]
Subject: Re: [Grammatica-users] Passing through


Hi Dave,

what exactly is it you want to pass through - characters from the input stream, tokens, or a parse tree? From what you say I take it that the internal parser is complete and self-contained, so you are probably thinking of passing characters. First thing that comes to my mind is, pass the exact same stream that you gave to the outer parser to the inner parser at the correct location. Two caveats:
- When you call the inner parser in some Exit... method, all input that corresponds to that rule will already have been parsed, Exit... is post-processing.
- The parser may have read a substantial number of characters from the input stream in order to produce enough look-ahead tokens, depending on the complexity of your grammar.
My best guess, then, is that you should define a very distinctive token that is to appear before the embedded parts, to prevent the parser from reading ahead. Override that token's Exit... method and try if the input stream still contains the beginning of the following embedded part. If not, some refactoring of your grammar may help.

Regards
Oliver



Oliver Gramberg
ABB AG
Forschungszentrum Deutschland
DECRC/I2
Wallstadter Str. 59
D-68526 Ladenburg

Phone: +49 6203/71-6461
Fax: +49 6203/71-6253
E-mail:
[hidden email]

Sitz/Head Office: Mannheim
Registergericht/Registry Court: Mannheim
Handelsregisternummer/Commercial Register No.: HRB 4664

Vorstand/Managing Board: Peter Smits (Vorsitzender/Chairman), Heinz-Peter Paffenholz, Dr. Joachim Schneider, Hendrik Weiler
Vorsitzender des Aufsichtsrats/Chairman of Supervisory Board: Bernhard Jucker

Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.




"Elliman, David" <[hidden email]>
Sent by: grammatica-users-bounces+oliver.gramberg=[hidden email]

14.09.2009 12:30

Please respond to
[hidden email]

To
<[hidden email]>
cc
Subject
[Grammatica-users] Passing through





Hi,

I have an application deployed using grammatica - it's great thanks.

However we want to make use of an expression evaluator internally (probably Flee - which itself uses grammatica!) So ideally we would like to have some "Evaluate" production that simply passes through to the other internal parser (by specifically invoking it on the ExitEvaluateProduction(….) handler that I would supply. The problem of course it that the reg exp is too wide; I had definedthe token  PASS_THROUGH <<.+>> and now nothing works because it's too wide and capturing everything all the time. I know that the reg exps are context free WRT the productions which is leading to this but is there any other way to construct this pass through type functionality - other than upgrading our syntax to support everything supported in the internal parser?

Cheers, and thanks again

Dave

_______________________________________________________________________

This email is intended only for the use of the individual(s) to whom
it is addressed and may be privileged and confidential.

Unauthorised use or disclosure is prohibited. If you receive this
e-mail in error, please advise immediately and delete the original
message without copying, using, or telling anyone about its contents.

This message may have been altered without your or our knowledge and
the sender does not accept any liability for any errors or omissions
in the message.

This message does not create or change any contract.  Royal Bank of
Canada and its subsidiaries accept no responsibility for damage caused
by any viruses contained in this email or its attachments.  Emails may
be monitored.

RBC Capital Markets is a business name used by branches and
subsidiaries of Royal Bank of Canada, including Royal Bank of Canada,
London branch and Royal Bank of Canada Europe Limited. In accordance
with English law requirements, details regarding Royal Bank of Canada
Europe Limited are set out below:

ROYAL BANK OF CANADA EUROPE LIMITED
Registered in England and Wales 995939
Registered Address: 71 Queen Victoria Street, London, EC4V 4DE.
Authorised and regulated by the Financial Service Authority.
Member of the London Stock Exchange
_______________________________________________
Grammatica-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/grammatica-users

_______________________________________________________________________

This email is intended only for the use of the individual(s) to whom
it is addressed and may be privileged and confidential.

Unauthorised use or disclosure is prohibited. If you receive this
e-mail in error, please advise immediately and delete the original
message without copying, using, or telling anyone about its contents.

This message may have been altered without your or our knowledge and
the sender does not accept any liability for any errors or omissions
in the message.

This message does not create or change any contract.  Royal Bank of
Canada and its subsidiaries accept no responsibility for damage caused
by any viruses contained in this email or its attachments.  Emails may
be monitored.

RBC Capital Markets is a business name used by branches and
subsidiaries of Royal Bank of Canada, including Royal Bank of Canada,
London branch and Royal Bank of Canada Europe Limited. In accordance
with English law requirements, details regarding Royal Bank of Canada
Europe Limited are set out below:

ROYAL BANK OF CANADA EUROPE LIMITED
Registered in England and Wales 995939
Registered Address: 71 Queen Victoria Street, London, EC4V 4DE.
Authorised and regulated by the Financial Service Authority.
Member of the London Stock Exchange

_______________________________________________
Grammatica-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/grammatica-users