Hello Everyone I was going over PetitParser part on the pharo by example book. http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/PetitParser.p... It was all going good until page 11. Script 1.19is for creating the class so this was fine. You get an ExpressionGrammar class with all the needed variables, but what about script 1.20? Where does this script go? I understand what the code does. It is describing a grammar for mathematical expressions by defining what everything is and the rules of the grammar. I am not sure where shall I put this script to run it. In earlier examples I was using the workspace. Any help is much appreciated. Mohammad
This code ExpressionGrammar>>term ^ add / prod ExpressionGrammar>>add ^ prod , $+ asParser trim , term ExpressionGrammar>>prod ^ mul / prim ExpressionGrammar>>mul ^ prim , $* asParser trim , prod ExpressionGrammar>>prim ^ parens / number ExpressionGrammar>>parens ^ $( asParser trim , term , $) asParser trim is not a code to evaluate in a workspace. It the representation we use to express the implementation of a method By example ExpressionGrammar>>term ^ add / prod means that on class ExpressionGrammar, you need to add a method named term with source code ^ add / prod So, you can either use a method browser to do it, or programatically do it by doing: ExpressionGrammar compile: 'term ^ add / prod' But this method is a bit ad hoc. :) Hope it helps ;) Ben On Mar 13, 2013, at 8:56 PM, Mohammad Al Houssami (Alumni) <mha53@mail.aub.edu> wrote:
Hello Everyone
I was going over PetitParser part on the pharo by example book. http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/PetitParser.p...
It was all going good until page 11. Script 1.19is for creating the class so this was fine. You get an ExpressionGrammar class with all the needed variables, but what about script 1.20?
Where does this script go? I understand what the code does. It is describing a grammar for mathematical expressions by defining what everything is and the rules of the grammar. I am not sure where shall I put this script to run it. In earlier examples I was using the workspace.
Any help is much appreciated. Mohammad
Thank You Benjamin, There was no way I would figure that out on my own... its weird to represent it this way but its clear now.(Probably because im new to Smalltalk though) Thanks again :) Mohammad From: pharo-users-bounces@lists.gforge.inria.fr [mailto:pharo-users-bounces@lists.gforge.inria.fr] On Behalf Of Benjamin Sent: Wednesday, March 13, 2013 8:58 PM To: A friendly place where any question about pharo is welcome Subject: Re: [Pharo-users] PetitParser Help This code ExpressionGrammar>>term ^ add / prod ExpressionGrammar>>add ^ prod , $+ asParser trim , term ExpressionGrammar>>prod ^ mul / prim ExpressionGrammar>>mul ^ prim , $* asParser trim , prod ExpressionGrammar>>prim ^ parens / number ExpressionGrammar>>parens ^ $( asParser trim , term , $) asParser trim is not a code to evaluate in a workspace. It the representation we use to express the implementation of a method By example ExpressionGrammar>>term ^ add / prod means that on class ExpressionGrammar, you need to add a method named term with source code ^ add / prod So, you can either use a method browser to do it, or programatically do it by doing: ExpressionGrammar compile: 'term ^ add / prod' But this method is a bit ad hoc. :) Hope it helps ;) Ben On Mar 13, 2013, at 8:56 PM, Mohammad Al Houssami (Alumni) <mha53@mail.aub.edu<mailto:mha53@mail.aub.edu>> wrote: Hello Everyone I was going over PetitParser part on the pharo by example book. http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/PetitParser.p... It was all going good until page 11. Script 1.19is for creating the class so this was fine. You get an ExpressionGrammar class with all the needed variables, but what about script 1.20? Where does this script go? I understand what the code does. It is describing a grammar for mathematical expressions by defining what everything is and the rules of the grammar. I am not sure where shall I put this script to run it. In earlier examples I was using the workspace. Any help is much appreciated. Mohammad ________________________________ No virus found in this message. Checked by AVG - www.avg.com<http://www.avg.com> Version: 2013.0.2904 / Virus Database: 2641/6169 - Release Date: 03/13/13
Personnally, I found the browser very useful, so read on until you come to the marvels of PPBrowser new Your life will never be the same after that... On Thu, Mar 14, 2013 at 3:20 AM, Mohammad Al Houssami (Alumni) < mha53@mail.aub.edu> wrote:
Thank You Benjamin,
****
There was no way I would figure that out on my own⦠its weird to represent it this way but its clear now.(Probably because im new to Smalltalk though)
Thanks again J****
Mohammad****
** **
*From:* pharo-users-bounces@lists.gforge.inria.fr [mailto: pharo-users-bounces@lists.gforge.inria.fr] *On Behalf Of *Benjamin *Sent:* Wednesday, March 13, 2013 8:58 PM *To:* A friendly place where any question about pharo is welcome *Subject:* Re: [Pharo-users] PetitParser Help****
** **
This code****
ExpressionGrammar>>term****
^ add / prod****
ExpressionGrammar>>add****
^ prod , $+ asParser trim , term****
ExpressionGrammar>>prod****
^ mul / prim****
ExpressionGrammar>>mul****
^ prim , $*****
asParser trim , prod****
ExpressionGrammar>>prim****
^ parens / number****
ExpressionGrammar>>parens****
^ $( asParser trim , term , $) asParser trim****
** **
is not a code to evaluate in a workspace.****
It the representation we use to express the implementation of a method****
By example****
** **
ExpressionGrammar>>term****
^ add / prod****
** **
means that on class ExpressionGrammar, you need to add a method named term with source code****
^ add / prod****
** **
** **
So, you can either use a method browser to do it, or programatically do it by doing:****
** **
ExpressionGrammar compile: 'term****
^ add / prod'****
** **
But this method is a bit ad hoc.****
** **
:)****
Hope it helps ;)****
Ben ****
** **
On Mar 13, 2013, at 8:56 PM, Mohammad Al Houssami (Alumni) < mha53@mail.aub.edu> wrote:****
****
Hello Everyone****
****
I was going over PetitParser part on the pharo by example book. http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/PetitParser.p... ****
****
It was all going good until page 11.****
Script 1.19is for creating the class so this was fine. You get an ExpressionGrammar class with all the needed variables, but what about script 1.20?****
****
Where does this script go? I understand what the code does. It is describing a grammar for mathematical expressions by defining what everything is and the rules of the grammar. I am not sure where shall I put this script to run it. In earlier examples I was using the workspace.****
****
Any help is much appreciated.****
Mohammad****
****
** ** ------------------------------
No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.2904 / Virus Database: 2641/6169 - Release Date: 03/13/13* ***
I am not sure what you mean Alain. Using the system browser to read what ? From: pharo-users-bounces@lists.gforge.inria.fr [mailto:pharo-users-bounces@lists.gforge.inria.fr] On Behalf Of Alain Busser Sent: Thursday, March 14, 2013 5:42 AM To: A friendly place where any question about pharo is welcome Subject: Re: [Pharo-users] PetitParser Help Personnally, I found the browser very useful, so read on until you come to the marvels of PPBrowser new Your life will never be the same after that... On Thu, Mar 14, 2013 at 3:20 AM, Mohammad Al Houssami (Alumni) <mha53@mail.aub.edu<mailto:mha53@mail.aub.edu>> wrote: Thank You Benjamin, There was no way I would figure that out on my own... its weird to represent it this way but its clear now.(Probably because im new to Smalltalk though) Thanks again :) Mohammad From: pharo-users-bounces@lists.gforge.inria.fr<mailto:pharo-users-bounces@lists.gforge.inria.fr> [mailto:pharo-users-bounces@lists.gforge.inria.fr<mailto:pharo-users-bounces@lists.gforge.inria.fr>] On Behalf Of Benjamin Sent: Wednesday, March 13, 2013 8:58 PM To: A friendly place where any question about pharo is welcome Subject: Re: [Pharo-users] PetitParser Help This code ExpressionGrammar>>term ^ add / prod ExpressionGrammar>>add ^ prod , $+ asParser trim , term ExpressionGrammar>>prod ^ mul / prim ExpressionGrammar>>mul ^ prim , $* asParser trim , prod ExpressionGrammar>>prim ^ parens / number ExpressionGrammar>>parens ^ $( asParser trim , term , $) asParser trim is not a code to evaluate in a workspace. It the representation we use to express the implementation of a method By example ExpressionGrammar>>term ^ add / prod means that on class ExpressionGrammar, you need to add a method named term with source code ^ add / prod So, you can either use a method browser to do it, or programatically do it by doing: ExpressionGrammar compile: 'term ^ add / prod' But this method is a bit ad hoc. :) Hope it helps ;) Ben On Mar 13, 2013, at 8:56 PM, Mohammad Al Houssami (Alumni) <mha53@mail.aub.edu<mailto:mha53@mail.aub.edu>> wrote: Hello Everyone I was going over PetitParser part on the pharo by example book. http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/PetitParser.p... It was all going good until page 11. Script 1.19is for creating the class so this was fine. You get an ExpressionGrammar class with all the needed variables, but what about script 1.20? Where does this script go? I understand what the code does. It is describing a grammar for mathematical expressions by defining what everything is and the rules of the grammar. I am not sure where shall I put this script to run it. In earlier examples I was using the workspace. Any help is much appreciated. Mohammad ________________________________ No virus found in this message. Checked by AVG - www.avg.com<http://www.avg.com> Version: 2013.0.2904 / Virus Database: 2641/6169 - Release Date: 03/13/13 ________________________________ No virus found in this message. Checked by AVG - www.avg.com<http://www.avg.com> Version: 2013.0.2904 / Virus Database: 2641/6172 - Release Date: 03/13/13
No, not the *system* browser, PetitParser has its own browser: In a workspace, just write PPBrowser new then "DoIt", and a PetitParser browser opens: It is a very beautiful tool, and powerful at that! Especially there is a graphical version which shows your grammar... On Thu, Mar 14, 2013 at 5:53 PM, Mohammad Al Houssami (Alumni) < mha53@mail.aub.edu> wrote:
I am not sure what you mean Alain. Using the system browser to read what ?****
** **
*From:* pharo-users-bounces@lists.gforge.inria.fr [mailto: pharo-users-bounces@lists.gforge.inria.fr] *On Behalf Of *Alain Busser *Sent:* Thursday, March 14, 2013 5:42 AM
*To:* A friendly place where any question about pharo is welcome *Subject:* Re: [Pharo-users] PetitParser Help****
** **
Personnally, I found the browser very useful, so read on until you come to the marvels of
PPBrowser new
Your life will never be the same after that... ****
On Thu, Mar 14, 2013 at 3:20 AM, Mohammad Al Houssami (Alumni) < mha53@mail.aub.edu> wrote:****
Thank You Benjamin,****
There was no way I would figure that out on my own⦠its weird to represent it this way but its clear now.(Probably because im new to Smalltalk though)
Thanks again J****
Mohammad****
****
*From:* pharo-users-bounces@lists.gforge.inria.fr [mailto: pharo-users-bounces@lists.gforge.inria.fr] *On Behalf Of *Benjamin *Sent:* Wednesday, March 13, 2013 8:58 PM *To:* A friendly place where any question about pharo is welcome *Subject:* Re: [Pharo-users] PetitParser Help****
****
This code****
ExpressionGrammar>>term****
^ add / prod****
ExpressionGrammar>>add****
^ prod , $+ asParser trim , term****
ExpressionGrammar>>prod****
^ mul / prim****
ExpressionGrammar>>mul****
^ prim , $*****
asParser trim , prod****
ExpressionGrammar>>prim****
^ parens / number****
ExpressionGrammar>>parens****
^ $( asParser trim , term , $) asParser trim****
****
is not a code to evaluate in a workspace.****
It the representation we use to express the implementation of a method****
By example****
****
ExpressionGrammar>>term****
^ add / prod****
****
means that on class ExpressionGrammar, you need to add a method named term with source code****
^ add / prod****
****
****
So, you can either use a method browser to do it, or programatically do it by doing:****
****
ExpressionGrammar compile: 'term****
^ add / prod'****
****
But this method is a bit ad hoc.****
****
:)****
Hope it helps ;)****
Ben ** **
****
On Mar 13, 2013, at 8:56 PM, Mohammad Al Houssami (Alumni) < mha53@mail.aub.edu> wrote:****
** **
Hello Everyone****
****
I was going over PetitParser part on the pharo by example book. http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/PetitParser.p... ****
****
It was all going good until page 11.****
Script 1.19is for creating the class so this was fine. You get an ExpressionGrammar class with all the needed variables, but what about script 1.20?****
****
Where does this script go? I understand what the code does. It is describing a grammar for mathematical expressions by defining what everything is and the rules of the grammar. I am not sure where shall I put this script to run it. In earlier examples I was using the workspace.****
****
Any help is much appreciated.****
Mohammad****
****
**** ------------------------------
No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.2904 / Virus Database: 2641/6169 - Release Date: 03/13/13* ***
** ** ------------------------------
No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.2904 / Virus Database: 2641/6172 - Release Date: 03/13/13* ***
Oh okay I didn't know that. Thanks for the information. I tried that but nothing happened. Any ideas why this might be the case? From: pharo-users-bounces@lists.gforge.inria.fr [mailto:pharo-users-bounces@lists.gforge.inria.fr] On Behalf Of Alain Busser Sent: Thursday, March 14, 2013 3:07 PM To: A friendly place where any question about pharo is welcome Subject: Re: [Pharo-users] PetitParser Help No, not the *system* browser, PetitParser has its own browser: In a workspace, just write PPBrowser new then "DoIt", and a PetitParser browser opens: It is a very beautiful tool, and powerful at that! Especially there is a graphical version which shows your grammar... On Thu, Mar 14, 2013 at 5:53 PM, Mohammad Al Houssami (Alumni) <mha53@mail.aub.edu<mailto:mha53@mail.aub.edu>> wrote: I am not sure what you mean Alain. Using the system browser to read what ? From: pharo-users-bounces@lists.gforge.inria.fr<mailto:pharo-users-bounces@lists.gforge.inria.fr> [mailto:pharo-users-bounces@lists.gforge.inria.fr<mailto:pharo-users-bounces@lists.gforge.inria.fr>] On Behalf Of Alain Busser Sent: Thursday, March 14, 2013 5:42 AM To: A friendly place where any question about pharo is welcome Subject: Re: [Pharo-users] PetitParser Help Personnally, I found the browser very useful, so read on until you come to the marvels of PPBrowser new Your life will never be the same after that... On Thu, Mar 14, 2013 at 3:20 AM, Mohammad Al Houssami (Alumni) <mha53@mail.aub.edu<mailto:mha53@mail.aub.edu>> wrote: Thank You Benjamin, There was no way I would figure that out on my own... its weird to represent it this way but its clear now.(Probably because im new to Smalltalk though) Thanks again :) Mohammad From: pharo-users-bounces@lists.gforge.inria.fr<mailto:pharo-users-bounces@lists.gforge.inria.fr> [mailto:pharo-users-bounces@lists.gforge.inria.fr<mailto:pharo-users-bounces@lists.gforge.inria.fr>] On Behalf Of Benjamin Sent: Wednesday, March 13, 2013 8:58 PM To: A friendly place where any question about pharo is welcome Subject: Re: [Pharo-users] PetitParser Help This code ExpressionGrammar>>term ^ add / prod ExpressionGrammar>>add ^ prod , $+ asParser trim , term ExpressionGrammar>>prod ^ mul / prim ExpressionGrammar>>mul ^ prim , $* asParser trim , prod ExpressionGrammar>>prim ^ parens / number ExpressionGrammar>>parens ^ $( asParser trim , term , $) asParser trim is not a code to evaluate in a workspace. It the representation we use to express the implementation of a method By example ExpressionGrammar>>term ^ add / prod means that on class ExpressionGrammar, you need to add a method named term with source code ^ add / prod So, you can either use a method browser to do it, or programatically do it by doing: ExpressionGrammar compile: 'term ^ add / prod' But this method is a bit ad hoc. :) Hope it helps ;) Ben On Mar 13, 2013, at 8:56 PM, Mohammad Al Houssami (Alumni) <mha53@mail.aub.edu<mailto:mha53@mail.aub.edu>> wrote: Hello Everyone I was going over PetitParser part on the pharo by example book. http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/PetitParser.p... It was all going good until page 11. Script 1.19is for creating the class so this was fine. You get an ExpressionGrammar class with all the needed variables, but what about script 1.20? Where does this script go? I understand what the code does. It is describing a grammar for mathematical expressions by defining what everything is and the rules of the grammar. I am not sure where shall I put this script to run it. In earlier examples I was using the workspace. Any help is much appreciated. Mohammad ________________________________ No virus found in this message. Checked by AVG - www.avg.com<http://www.avg.com> Version: 2013.0.2904 / Virus Database: 2641/6169 - Release Date: 03/13/13 ________________________________ No virus found in this message. Checked by AVG - www.avg.com<http://www.avg.com> Version: 2013.0.2904 / Virus Database: 2641/6172 - Release Date: 03/13/13 ________________________________ No virus found in this message. Checked by AVG - www.avg.com<http://www.avg.com> Version: 2013.0.2904 / Virus Database: 2641/6172 - Release Date: 03/13/13
On Thu, Mar 14, 2013 at 7:24 PM, Mohammad Al Houssami (Alumni) < mha53@mail.aub.edu> wrote:
Oh okay I didnât know that. Thanks for the information.****
I tried that but nothing happened.****
Any ideas why this might be the case?
Maybe your download is incomplete? I did exactly what is in the PBE2 chapter, and it took a rather long time to complete the downloads...
****
** **
*From:* pharo-users-bounces@lists.gforge.inria.fr [mailto: pharo-users-bounces@lists.gforge.inria.fr] *On Behalf Of *Alain Busser *Sent:* Thursday, March 14, 2013 3:07 PM
*To:* A friendly place where any question about pharo is welcome *Subject:* Re: [Pharo-users] PetitParser Help****
** **
No, not the *system* browser, PetitParser has its own browser:
In a workspace, just write
PPBrowser new
then "DoIt", and a PetitParser browser opens: It is a very beautiful tool, and powerful at that! Especially there is a graphical version which shows your grammar...****
On Thu, Mar 14, 2013 at 5:53 PM, Mohammad Al Houssami (Alumni) < mha53@mail.aub.edu> wrote:****
I am not sure what you mean Alain. Using the system browser to read what ? ****
****
*From:* pharo-users-bounces@lists.gforge.inria.fr [mailto: pharo-users-bounces@lists.gforge.inria.fr] *On Behalf Of *Alain Busser *Sent:* Thursday, March 14, 2013 5:42 AM****
*To:* A friendly place where any question about pharo is welcome *Subject:* Re: [Pharo-users] PetitParser Help****
****
Personnally, I found the browser very useful, so read on until you come to the marvels of
PPBrowser new
Your life will never be the same after that... ****
On Thu, Mar 14, 2013 at 3:20 AM, Mohammad Al Houssami (Alumni) < mha53@mail.aub.edu> wrote:****
Thank You Benjamin,****
There was no way I would figure that out on my own⦠its weird to represent it this way but its clear now.(Probably because im new to Smalltalk though)
Thanks again J****
Mohammad****
****
*From:* pharo-users-bounces@lists.gforge.inria.fr [mailto: pharo-users-bounces@lists.gforge.inria.fr] *On Behalf Of *Benjamin *Sent:* Wednesday, March 13, 2013 8:58 PM *To:* A friendly place where any question about pharo is welcome *Subject:* Re: [Pharo-users] PetitParser Help****
****
This code****
ExpressionGrammar>>term****
^ add / prod****
ExpressionGrammar>>add****
^ prod , $+ asParser trim , term****
ExpressionGrammar>>prod****
^ mul / prim****
ExpressionGrammar>>mul****
^ prim , $*****
asParser trim , prod****
ExpressionGrammar>>prim****
^ parens / number****
ExpressionGrammar>>parens****
^ $( asParser trim , term , $) asParser trim****
****
is not a code to evaluate in a workspace.****
It the representation we use to express the implementation of a method****
By example****
****
ExpressionGrammar>>term****
^ add / prod****
****
means that on class ExpressionGrammar, you need to add a method named term with source code****
^ add / prod****
****
****
So, you can either use a method browser to do it, or programatically do it by doing:****
****
ExpressionGrammar compile: 'term****
^ add / prod'****
****
But this method is a bit ad hoc.****
****
:)****
Hope it helps ;)****
Ben ** **
****
On Mar 13, 2013, at 8:56 PM, Mohammad Al Houssami (Alumni) < mha53@mail.aub.edu> wrote:****
****
Hello Everyone****
****
I was going over PetitParser part on the pharo by example book. http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/PetitParser.p... ****
****
It was all going good until page 11.****
Script 1.19is for creating the class so this was fine. You get an ExpressionGrammar class with all the needed variables, but what about script 1.20?****
****
Where does this script go? I understand what the code does. It is describing a grammar for mathematical expressions by defining what everything is and the rules of the grammar. I am not sure where shall I put this script to run it. In earlier examples I was using the workspace.****
****
Any help is much appreciated.****
Mohammad****
****
**** ------------------------------
No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.2904 / Virus Database: 2641/6169 - Release Date: 03/13/13* ***
**** ------------------------------
No virus found in this message. Checked by AVG - www.avg.com****
Version: 2013.0.2904 / Virus Database: 2641/6172 - Release Date: 03/13/13* ***
** ** ------------------------------
No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.2904 / Virus Database: 2641/6172 - Release Date: 03/13/13* ***
participants (3)
-
Alain Busser -
Benjamin -
Mohammad Al Houssami (Alumni)