Re: AST, BNF, ANTLR

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: AST, BNF, ANTLR

Terry Fuller
** Reply to message from Bill Fenlason <[hidden email]> on Mon, 18 Mar 2013
14:03:35 -0400

 I don't understand the distinction (apparently) being made below -- that
Classic Rexx has a structure definable in a standard, but that NetRexx does
not.  I believe that the philosophy of local variables / keywords is exactly
the same for both languages.  

Right?

taf


> There were several different implementations of Classic Rexx, including
> Regina which is perhaps the most used.  It seems to me that without the
> standard definition for Rexx and the ability to use automated scanner
> and parser generators (as well as hand written ones), a number of the
> Rexx implementations might not have occurred.  In my opinion those
> implementations were of significant benefit to the Rexx language and its
> usage.
>
> I do not believe an effective and workable _standard _definition for
> NetRexx (using BNF or another grammar definition method) is possible.  
> Keywords can not be defined without adding caveats such as: "The word
> "exit" shall not be recognized in this context if there exists any
> active variable or method named "exit" when the word "exit" is
> encountered in the source input."
>
> To clarify, it is only because keywords are seldom used as variable or
> method names that a processor using automated tools can be effective
> since they assume that keywords take priority over variable and method
> names.
>
> Adding an AST generation capability to the NetRexx translator (along
> with API) is certainly possible, although that in effect means that the
> whole translator will be included in any additional NetRexx processing
> tool.  I doubt that method would be suitable for dynamic tools such as
> intelligent editors, etc.
>
> As I mentioned in my prior append, this is a philosophical discussion.  
> I think that in the long run, NetRexx would be a better language if the
> priority of keywords and names was definable (perhaps by option) and a
> convention for the specification of language level were added.  I
> believe that the easier it is to implement NetRexx tools (including
> compilers, etc) the better. Clearly this is just my opinion, others may
> disagree, and of course I might be wrong :)
>
> Bill
>
> On 3/18/2013 1:35 AM, Kermit Kiser wrote:
> > René and all --
> >
> > I have followed this discussion with interest and although I cannot
> > say that I understand it all, I have drawn some conclusions and I do
> > have a recommendation.
> >
> > It seems that some people believe that a formal grammar definition for
> > NetRexx is possible and that is somewhat supported by the ANSI
> > standard for Rexx which RexxLA provides here:
> >
> > http://www.rexxla.org/rexxlang/standards/j18pub.pdf
> >
> > The above document contains a BNF definition for classic Rexx. However
> > I have no idea if it could be converted into a NetRexx definition or
> > if such an item would be of any use in automated systems.
> >
> > Therefore, given the currently limited development resources of the
> > NetRexx community, I suggest that we define an API for the NetRexx
> > translator which allows passing of it's AST equivalent data structures
> > to those programming tools which desire to walk the tree and perform
> > highlighting or other special processing for source code. This would
> > allow different tools to use the same standard NetRexx parsing system
> > without having to attempt developing an independent parsing approach
> > (a project which we have all agreed is difficult). I grant that this
> > would probably not provide the piecewise recompilation that Bill
> > desires, but it would still enable many advanced tools to be developed
> > for NetRexx programmers, such as refactoring editors etc.
> >
> > Does that approach seem feasible?
> >
> > -- Kermit
> >
> >
> > On 3/11/2013 2:34 AM, René Jansen wrote:
> >> Not that I can really help. I have been wondering the same.
> >>
> >> Cases in point here are the Chad Slaughter ANTLR grammar for NetRexx.
> >> It is 'almost correct', and should be correctable. In the days of the
> >> 'open source parallel implementation of NetRexx' (nothing ever came
> >> from it) I have tried to interest the maintainers of ANTLR with $1000
> >> to correct and maintain it. They probably had enough money OR it is
> >> too hard. (The offer has sinc been rescinded, thanks).
> >>
> >> Bill's javacc grammar works, otherwise the Eclipse plugin would not
> >> display such good syntax coloring and parsing. It might miss some of
> >> the things you need to build a whole compiler, though.
> >> I read Bill thinks it needs polishing before public consumption, but
> >> I have not often seen polished things that still work - and when they
> >> work, they'll get dirty again.
> >>
> >> The fact that NetRexx's parser is hand-written does not proof that a
> >> parser generator cannot handle it, in itself. The ooRexx parser is
> >> lexx/yacc I think and it handles something very akin to NetRexx.
> >>
> >> The problem with ANTLR is in the 'keyword-less' approach of NetRexx.
> >> I have spoken to Terence Parr ages ago and he says that however hard,
> >> it is no showstopper. Also years ago, I have invested time in this
> >> and with a depressing outcome. Normally, I am used to things
> >> happening when I work on them. This is not the case with grammar
> >> tools, and the working grammars I produced (one for an SQL tool in
> >> NetRexx, called nsql (I might publish it one day), and one for a
> >> special-purpose modelling language called 'bint) I have to keep in
> >> version management and check in after every character I change -
> >> grammar files are that brittle and even looking at them makes it stop
> >> working. Also, ANTLR has had a number of versions that changed
> >> everything.
> >>
> >> It might be that I am just not smart enough. I have a friend with a
> >> grade in exactly this and I will forward your questions.
> >>
> >> best regards,
> >>
> >> René.
> >>
> >>
> >> On 11 mrt. 2013, at 13:09, Kermit Kiser <[hidden email]
> >> <mailto:[hidden email]>> wrote:
> >>
> >>> Please bear with me if my question below seems elementary but my
> >>> formal computer science education is mostly limited to the
> >>> undergraduate level.
> >>>
> >>> Although I have written uncountable parsing routines, my knowledge
> >>> of the formal terminology and algorithms of parsers and compilers is
> >>> quite limited. That may be part of the reason that I have not yet
> >>> attempted any enhancements to the NetRexx language. I think I can
> >>> see the use of the AST and CST structures in the translator but I
> >>> don't have a solid enough grasp on how they interact to modify them.
> >>> Bill's comment indicates that the NetRexx AST is not a "full AST"
> >>> but I have no idea what that means.
> >>>
> >>> I have seen several requests for an ANTLR grammar or a BNF
> >>> definition for NetRexx. But Wikipedia says this about ANTLR:
> >>>
> >>> A language is specified using a context-free grammar
> >>> <http://en.wikipedia.org/wiki/Context-free_grammar> which is
> >>> expressed using Extended Backus--Naur Form
> >>> <http://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form> (EBNF).
> >>>
> >>> and this about EBNF:
> >>>
> >>> In computer science <http://en.wikipedia.org/wiki/Computer_science>,
> >>> *Extended Backus--Naur Form (EBNF)* is a family of metasyntax
> >>> <http://en.wikipedia.org/wiki/Metasyntax> notations used for
> >>> expressing context-free grammars
> >>> <http://en.wikipedia.org/wiki/Context-free_grammar>
> >>>
> >>> Yet I have seen comments indicating that Rexx is not a context-free
> >>> language and I think that applies equally to NetRexx as it's
> >>> keywords are also not generally reserved outside of their context,
> >>> for example.
> >>>
> >>> To confuse things further, I have seen multiple comments indicating
> >>> that there IS a BNF definition of Rexx in the ANSI standard for that
> >>> language which RexxLA is said to maintain a copy of, but which I
> >>> cannot find as the RexxLA site seems to be inaccessible currently.
> >>>
> >>> So here is my question: Is it really possible to create an ANTLR
> >>> grammar or BNF definition for NetRexx?
> >>>
> >>> -- Kermit
> >>>
> >>>
> >>> On 3/8/2013 6:37 AM, Bill Fenlason wrote:
> >>>> My understanding of the translator logic and data structures isn't
> >>>> complete enough to be sure of what the best approach would be.
> >>>>
> >>>> When I was looking at it, it appeared to me that a full AST
> >>>> construction might not be easy to add to the translator.  Ideally a
> >>>> secondary processor (like to generate HTML, different output codes,
> >>>> formatting and pretty printing, etc.) could work just by walking
> >>>> the tree.  The design choice is between generating an AST which is
> >>>> processed by different applications or imbedding code in the
> >>>> translator to do the various output generations.
> >>>>
> >>>> The AST that I currently generate in the Eclipse plugin certainly
> >>>> needs refinement.  It's a bit of a kludge at this point.  Eclipse
> >>>> builds ASTs for the Java code, and one obvious approach would be to
> >>>> have the translator actually generate the Java ASTs, but
> >>>> understanding how to do that would take a great deal of research.
> >>>> One up side of that approach would be that NetRexx code could be
> >>>> debugged using the (very sophisticated) Eclipse debugger.
> >>>>
> >>>> The ultra-dynamic nature of NetRexx is a complication of course.
> >>>>
> >>>> Bill
> >>>>
> >>>> On 3/8/2013 9:21 AM, René Jansen wrote:
> >>>>> Yes I thought of that too. Bill has a parser for the Eclipse tool;
> >>>>> the open sourcing was a bit late as I can imagine he would have
> >>>>> rather used the translator itself. I was just asking around
> >>>>> because I want to go to production any day now and perhaps someone
> >>>>> had something around that fit the bill.
> >>>>>
> >>>>> I agree that the translator itself would be the road to do the
> >>>>> best syntax colouring possible.
> >>>>>
> >>>>> best regards,
> >>>>>
> >>>>> René.
> >>>>> On 8 mrt. 2013, at 14:24, "Mike Cowlishaw" <[hidden email]>
> >>>>> wrote:
> >>>>>
> >>>>>>> Who has, or knows of a NetRexx program that translates
> >>>>>>> NetRexx source to syntax coloured source in html? It has to
> >>>>>>> be quite quick, also.
> >>>>>>>
> >>>>>>> i would be very interested in this for a new netrexx website
> >>>>>>> I am working on.
> >>>>>> Maybe a nice option for the NetRexx compiler. Instead of emitting
> >>>>>> Java, a
> >>>>>> version that emitted HTML.  Given that the compiler has access to
> >>>>>> semantics as
> >>>>>> well as syntax it could do a lot more .. e.g., different colours
> >>>>>> (or minor
> >>>>>> variations of colours) for different types.  ints a different
> >>>>>> colour than
> >>>>>> floats.  Local variables a different font than inherited ones.  
> >>>>>> Italic or bold
> >>>>>> used for other attributes, etc.
> >>>>>>
> >>>>>> Lots of possibilities :-).
> >>>>>>
> >>>>>> Mike
> >>>>>>
> >
> >
> > _______________________________________________
> > Ibm-netrexx mailing list
> > [hidden email]
> > Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
> >
> >
> >
> > 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
> >
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

--
Regards,
        taf

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: AST, BNF, ANTLR

billfen
Terry,

The philosophy is not exactly the same, in my opinion.

In Rexx, I believe the equivalent of a NetRexx variable or keyword used
as as method call is a CALL statement.

I think the appropriate comparison is that between a NetRexx method call
and a Rexx external command specification.  If you check Section 13 of
"The Rexx Language" titled "Reserved Keywords and Language
Extendability" (page 132 in the original (1985 blue cover) edition), the
clear implication is that a single variable name (to be used as an
external command) with the same name as a keyword is not overridden by
the existence of an external command by the same name.  The advice in
that situation is to enclose the external command name in quotes or to
insure that it is part of an expression by concatenating a null string
to the front of the variable name.

Because the Rexx keywords have priority over variable names in that
situation, the keywords are definable and keywords can be parsed without
referencing the external environment.

In the NetRexx equivalent, all of the available methods (and active
variable names) must be checked dynamically.  If a match is found, it
takes priority over the keyword.  Therefore the keywords can not be
unambiguously parsed.

Bill

On 3/18/2013 3:23 PM, Terry Fuller wrote:

> ** Reply to message from Bill Fenlason <[hidden email]> on Mon, 18 Mar 2013
> 14:03:35 -0400
>
>   I don't understand the distinction (apparently) being made below -- that
> Classic Rexx has a structure definable in a standard, but that NetRexx does
> not.  I believe that the philosophy of local variables / keywords is exactly
> the same for both languages.
>
> Right?
>
> taf
>
>
>> There were several different implementations of Classic Rexx, including
>> Regina which is perhaps the most used.  It seems to me that without the
>> standard definition for Rexx and the ability to use automated scanner
>> and parser generators (as well as hand written ones), a number of the
>> Rexx implementations might not have occurred.  In my opinion those
>> implementations were of significant benefit to the Rexx language and its
>> usage.
>>
>> I do not believe an effective and workable _standard _definition for
>> NetRexx (using BNF or another grammar definition method) is possible.
>> Keywords can not be defined without adding caveats such as: "The word
>> "exit" shall not be recognized in this context if there exists any
>> active variable or method named "exit" when the word "exit" is
>> encountered in the source input."
>>
>> To clarify, it is only because keywords are seldom used as variable or
>> method names that a processor using automated tools can be effective
>> since they assume that keywords take priority over variable and method
>> names.
>>
>> Adding an AST generation capability to the NetRexx translator (along
>> with API) is certainly possible, although that in effect means that the
>> whole translator will be included in any additional NetRexx processing
>> tool.  I doubt that method would be suitable for dynamic tools such as
>> intelligent editors, etc.
>>
>> As I mentioned in my prior append, this is a philosophical discussion.
>> I think that in the long run, NetRexx would be a better language if the
>> priority of keywords and names was definable (perhaps by option) and a
>> convention for the specification of language level were added.  I
>> believe that the easier it is to implement NetRexx tools (including
>> compilers, etc) the better. Clearly this is just my opinion, others may
>> disagree, and of course I might be wrong :)
>>
>> Bill
>>
>> On 3/18/2013 1:35 AM, Kermit Kiser wrote:
>>> René and all --
>>>
>>> I have followed this discussion with interest and although I cannot
>>> say that I understand it all, I have drawn some conclusions and I do
>>> have a recommendation.
>>>
>>> It seems that some people believe that a formal grammar definition for
>>> NetRexx is possible and that is somewhat supported by the ANSI
>>> standard for Rexx which RexxLA provides here:
>>>
>>> http://www.rexxla.org/rexxlang/standards/j18pub.pdf
>>>
>>> The above document contains a BNF definition for classic Rexx. However
>>> I have no idea if it could be converted into a NetRexx definition or
>>> if such an item would be of any use in automated systems.
>>>
>>> Therefore, given the currently limited development resources of the
>>> NetRexx community, I suggest that we define an API for the NetRexx
>>> translator which allows passing of it's AST equivalent data structures
>>> to those programming tools which desire to walk the tree and perform
>>> highlighting or other special processing for source code. This would
>>> allow different tools to use the same standard NetRexx parsing system
>>> without having to attempt developing an independent parsing approach
>>> (a project which we have all agreed is difficult). I grant that this
>>> would probably not provide the piecewise recompilation that Bill
>>> desires, but it would still enable many advanced tools to be developed
>>> for NetRexx programmers, such as refactoring editors etc.
>>>
>>> Does that approach seem feasible?
>>>
>>> -- Kermit
>>>
>>>
>>> On 3/11/2013 2:34 AM, René Jansen wrote:
>>>> Not that I can really help. I have been wondering the same.
>>>>
>>>> Cases in point here are the Chad Slaughter ANTLR grammar for NetRexx.
>>>> It is 'almost correct', and should be correctable. In the days of the
>>>> 'open source parallel implementation of NetRexx' (nothing ever came
>>>> from it) I have tried to interest the maintainers of ANTLR with $1000
>>>> to correct and maintain it. They probably had enough money OR it is
>>>> too hard. (The offer has sinc been rescinded, thanks).
>>>>
>>>> Bill's javacc grammar works, otherwise the Eclipse plugin would not
>>>> display such good syntax coloring and parsing. It might miss some of
>>>> the things you need to build a whole compiler, though.
>>>> I read Bill thinks it needs polishing before public consumption, but
>>>> I have not often seen polished things that still work - and when they
>>>> work, they'll get dirty again.
>>>>
>>>> The fact that NetRexx's parser is hand-written does not proof that a
>>>> parser generator cannot handle it, in itself. The ooRexx parser is
>>>> lexx/yacc I think and it handles something very akin to NetRexx.
>>>>
>>>> The problem with ANTLR is in the 'keyword-less' approach of NetRexx.
>>>> I have spoken to Terence Parr ages ago and he says that however hard,
>>>> it is no showstopper. Also years ago, I have invested time in this
>>>> and with a depressing outcome. Normally, I am used to things
>>>> happening when I work on them. This is not the case with grammar
>>>> tools, and the working grammars I produced (one for an SQL tool in
>>>> NetRexx, called nsql (I might publish it one day), and one for a
>>>> special-purpose modelling language called 'bint) I have to keep in
>>>> version management and check in after every character I change -
>>>> grammar files are that brittle and even looking at them makes it stop
>>>> working. Also, ANTLR has had a number of versions that changed
>>>> everything.
>>>>
>>>> It might be that I am just not smart enough. I have a friend with a
>>>> grade in exactly this and I will forward your questions.
>>>>
>>>> best regards,
>>>>
>>>> René.
>>>>
>>>>
>>>> On 11 mrt. 2013, at 13:09, Kermit Kiser <[hidden email]
>>>> <mailto:[hidden email]>> wrote:
>>>>
>>>>> Please bear with me if my question below seems elementary but my
>>>>> formal computer science education is mostly limited to the
>>>>> undergraduate level.
>>>>>
>>>>> Although I have written uncountable parsing routines, my knowledge
>>>>> of the formal terminology and algorithms of parsers and compilers is
>>>>> quite limited. That may be part of the reason that I have not yet
>>>>> attempted any enhancements to the NetRexx language. I think I can
>>>>> see the use of the AST and CST structures in the translator but I
>>>>> don't have a solid enough grasp on how they interact to modify them.
>>>>> Bill's comment indicates that the NetRexx AST is not a "full AST"
>>>>> but I have no idea what that means.
>>>>>
>>>>> I have seen several requests for an ANTLR grammar or a BNF
>>>>> definition for NetRexx. But Wikipedia says this about ANTLR:
>>>>>
>>>>> A language is specified using a context-free grammar
>>>>> <http://en.wikipedia.org/wiki/Context-free_grammar> which is
>>>>> expressed using Extended Backus--Naur Form
>>>>> <http://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form> (EBNF).
>>>>>
>>>>> and this about EBNF:
>>>>>
>>>>> In computer science <http://en.wikipedia.org/wiki/Computer_science>,
>>>>> *Extended Backus--Naur Form (EBNF)* is a family of metasyntax
>>>>> <http://en.wikipedia.org/wiki/Metasyntax> notations used for
>>>>> expressing context-free grammars
>>>>> <http://en.wikipedia.org/wiki/Context-free_grammar>
>>>>>
>>>>> Yet I have seen comments indicating that Rexx is not a context-free
>>>>> language and I think that applies equally to NetRexx as it's
>>>>> keywords are also not generally reserved outside of their context,
>>>>> for example.
>>>>>
>>>>> To confuse things further, I have seen multiple comments indicating
>>>>> that there IS a BNF definition of Rexx in the ANSI standard for that
>>>>> language which RexxLA is said to maintain a copy of, but which I
>>>>> cannot find as the RexxLA site seems to be inaccessible currently.
>>>>>
>>>>> So here is my question: Is it really possible to create an ANTLR
>>>>> grammar or BNF definition for NetRexx?
>>>>>
>>>>> -- Kermit
>>>>>
>>>>>
>>>>> On 3/8/2013 6:37 AM, Bill Fenlason wrote:
>>>>>> My understanding of the translator logic and data structures isn't
>>>>>> complete enough to be sure of what the best approach would be.
>>>>>>
>>>>>> When I was looking at it, it appeared to me that a full AST
>>>>>> construction might not be easy to add to the translator.  Ideally a
>>>>>> secondary processor (like to generate HTML, different output codes,
>>>>>> formatting and pretty printing, etc.) could work just by walking
>>>>>> the tree.  The design choice is between generating an AST which is
>>>>>> processed by different applications or imbedding code in the
>>>>>> translator to do the various output generations.
>>>>>>
>>>>>> The AST that I currently generate in the Eclipse plugin certainly
>>>>>> needs refinement.  It's a bit of a kludge at this point.  Eclipse
>>>>>> builds ASTs for the Java code, and one obvious approach would be to
>>>>>> have the translator actually generate the Java ASTs, but
>>>>>> understanding how to do that would take a great deal of research.
>>>>>> One up side of that approach would be that NetRexx code could be
>>>>>> debugged using the (very sophisticated) Eclipse debugger.
>>>>>>
>>>>>> The ultra-dynamic nature of NetRexx is a complication of course.
>>>>>>
>>>>>> Bill
>>>>>>
>>>>>> On 3/8/2013 9:21 AM, René Jansen wrote:
>>>>>>> Yes I thought of that too. Bill has a parser for the Eclipse tool;
>>>>>>> the open sourcing was a bit late as I can imagine he would have
>>>>>>> rather used the translator itself. I was just asking around
>>>>>>> because I want to go to production any day now and perhaps someone
>>>>>>> had something around that fit the bill.
>>>>>>>
>>>>>>> I agree that the translator itself would be the road to do the
>>>>>>> best syntax colouring possible.
>>>>>>>
>>>>>>> best regards,
>>>>>>>
>>>>>>> René.
>>>>>>> On 8 mrt. 2013, at 14:24, "Mike Cowlishaw" <[hidden email]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>>> Who has, or knows of a NetRexx program that translates
>>>>>>>>> NetRexx source to syntax coloured source in html? It has to
>>>>>>>>> be quite quick, also.
>>>>>>>>>
>>>>>>>>> i would be very interested in this for a new netrexx website
>>>>>>>>> I am working on.
>>>>>>>> Maybe a nice option for the NetRexx compiler. Instead of emitting
>>>>>>>> Java, a
>>>>>>>> version that emitted HTML.  Given that the compiler has access to
>>>>>>>> semantics as
>>>>>>>> well as syntax it could do a lot more .. e.g., different colours
>>>>>>>> (or minor
>>>>>>>> variations of colours) for different types.  ints a different
>>>>>>>> colour than
>>>>>>>> floats.  Local variables a different font than inherited ones.
>>>>>>>> Italic or bold
>>>>>>>> used for other attributes, etc.
>>>>>>>>
>>>>>>>> Lots of possibilities :-).
>>>>>>>>
>>>>>>>> Mike
>>>>>>>>
>>>
>>> _______________________________________________
>>> Ibm-netrexx mailing list
>>> [hidden email]
>>> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>>>
>>>
>>>
>>> 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
>>>
>>
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: AST, BNF, ANTLR

billfen
Or, to put it a bit more simply,

At any given point in a Rexx program, "say" can always be a keyword or a
variable, depending on the statement.

At any given point in a NetRexx program, "say" can be either a keyword
or a variable, but not a keyword after it is used as a variable.

Bill

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: AST, BNF, ANTLR

Mike Cowlishaw
> Or, to put it a bit more simply,
>
> At any given point in a Rexx program, "say" can always be a
> keyword or a variable, depending on the statement.
>
> At any given point in a NetRexx program, "say" can be either
> a keyword or a variable, but not a keyword after it is used
> as a variable.

Nicely put.  And in Rexx the meaning of anything is dynamic: determined by the
path taken through the program, whereas in NetRexx it is far more predictable
and static.

[One pending post to be replied to (re PL/I etc.) .. sorry not had the time for
that this week...]

Mike

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: AST, BNF, ANTLR

billfen

On 3/21/2013 4:26 PM, Mike Cowlishaw wrote:
Or, to put it a bit more simply,

At any given point in a Rexx program, "say" can always be a 
keyword or a variable, depending on the statement.

At any given point in a NetRexx program, "say" can be either 
a keyword or a variable, but not a keyword after it is used 
as a variable.
Nicely put.  And in Rexx the meaning of anything is dynamic: determined by the
path taken through the program, whereas in NetRexx it is far more predictable
and static.

To restate, in Rexx and PL/I, a given word can be both a keyword and a variable.  In NetRexx, a given word is either a keyword or a variable, depending on the dynamic context.

It just makes more sense to me that a given word can be both a keyword and a variable.  If not, anomalies such as the page 79 example occur.

Isn't the essence of keyword independence that a variable can have the same name as a keyword without conflict?

There are so few keywords in NetRexx that they can be easily recognized. 

When I see "say 'hello' ", I always want it to cause 'hello' to be printed - not an error message (due to the possibility of a conflict with a future version of the language).

[One pending post to be replied to (re PL/I etc.) .. sorry not had the time for
that this week...]

I'm really looking forward to it - I suspect there may be aspects of this topic that I am missing.

 

Mike

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Bill
_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: AST, BNF, ANTLR

ThSITC
Hi Bill, and all:

May I add that I am here totally with *Bill's* position (a symbol may be *both* a Verb, as I call it, you say keyword,
*and* a variable!

For Keywords, in General, it is not as easy, I think, but in most cases ambiguities can be resolved :-)

A Verb (in my Terminology) is a kayword at the start of a clause, e.g. the first token, followed by a blank or a
(maybe implicit) End Of Clause (semicolon), and *not* an assignment-operator, or an immediately following
open parentehes (which would indicate a method reference).

Anyway, an *interesting* discussion!
Thomas.
==============================================================================
Am 21.03.2013 22:35, schrieb Bill Fenlason:

On 3/21/2013 4:26 PM, Mike Cowlishaw wrote:
Or, to put it a bit more simply,

At any given point in a Rexx program, "say" can always be a 
keyword or a variable, depending on the statement.

At any given point in a NetRexx program, "say" can be either 
a keyword or a variable, but not a keyword after it is used 
as a variable.
Nicely put.  And in Rexx the meaning of anything is dynamic: determined by the
path taken through the program, whereas in NetRexx it is far more predictable
and static.

To restate, in Rexx and PL/I, a given word can be both a keyword and a variable.  In NetRexx, a given word is either a keyword or a variable, depending on the dynamic context.

It just makes more sense to me that a given word can be both a keyword and a variable.  If not, anomalies such as the page 79 example occur.

Isn't the essence of keyword independence that a variable can have the same name as a keyword without conflict?

There are so few keywords in NetRexx that they can be easily recognized. 

When I see "say 'hello' ", I always want it to cause 'hello' to be printed - not an error message (due to the possibility of a conflict with a future version of the language).

[One pending post to be replied to (re PL/I etc.) .. sorry not had the time for
that this week...]

I'm really looking forward to it - I suspect there may be aspects of this topic that I am missing.

 

Mike

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Bill

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



--
Thomas Schneider, IT Consulting; http://www.thsitc.com; Vienna, Austria, Europe

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Dr. Dobb's: NetRexx: The Original JVM Scripting Language Returns

Jeff Hennick
In reply to this post by ThSITC
Dr. Dobb's Journal April 2013

Programming languages take center stage in this Dr. Dobb's Journal. Explore the most interesting features in the new Ada 2012 standard; understand the philosophy behind Clojure; look at the major update to NetRexx; and take a tour through Fantom, a language that generates JavaScript and binaries for .NET and the JVM.
  • NetRexx: The Original JVM Scripting Language Returns
    By René Jansen
  • The first scripting language for the JVM was recently open-sourced by IBM. After a major update, it is gaining traction by leveraging its novel design.


Way to go René!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Dr. Dobb's: NetRexx: The Original JVM ScriptingLanguage Returns

Mike Cowlishaw
 
Nice article!!
 


 
Dr. Dobb's Journal April 2013

Programming languages take center stage in this Dr. Dobb's Journal. Explore the most interesting features in the new Ada 2012 standard; understand the philosophy behind Clojure; look at the major update to NetRexx; and take a tour through Fantom, a language that generates JavaScript and binaries for .NET and the JVM.
  • NetRexx: The Original JVM Scripting Language Returns
    By René Jansen The first scripting language for the JVM was recently open-sourced by IBM. After a major update, it is gaining traction by leveraging its novel design.


Way to go René!

    _______________________________________________
    Ibm-netrexx mailing list
    [hidden email]
    Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

    12