[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Is & a command?

  • From: Rick Jelliffe <rjelliffe@allette.com.au>
  • To: xml-dev <xml-dev@lists.xml.org>
  • Date: Wed, 16 Nov 2022 01:13:56 +1100

Re:  Is & a command?
In addition to Michael's comment, I think Roger is making the mistake of treating a specific for a universal.

"The [ is actually the name of the command" is not a universal statement that all [ are commands, or that all opening delimiters are commands, but a specific statement that in the particular shell they are implemented/treated/equivalent as commands. The scope of the statement is that particular language's implementation or design (and perhaps its "denotational semantics".)

It is as wrongheaded as would be "English has prepositions, so is the XML & delimiter a preposition?"

On the other hand, if Roger is asking "Is it possible to write a parser for XML in which each delimiter is used as the 'name' of a 'command' used to parse the next  section after it?"  then the answer is yes: there are several classes of parsers that can be implemented like that (e.g. some of bottom up, shift-reduce, PEG, etc.)  

Loosely, a top-down parser says "I am looking now for z, y or z" while a bottom-up parser say "I am presented now with a z: what are the ramifications?"  So in the bottom-up case, you could regard of the z as (the name of) a command, if it helped. (The threaded interpreted languages like Forth work like that, IIRC:  there is no distinct scanner, so a new command could be added just using any unique character.)

Parsers can be implemented accepting grammars, or by hardcoding, and by everything in between.  (The fundamental implementation issue is not whether a lexical token is treated as a string, a message, a method name, a command, or whatever, but whether your implementation needs a stack or not:  a stack is not required to parse XML text, but it is needed one to judge well-formedness.)

Regards
Rick



On Mon, Nov 14, 2022 at 8:53 PM Roger L Costello <costello@mitre.org> wrote:

Hi Folks,

 

In UNIX there is a command named “test” which is used like this:

 

             test expression

 

Upon encountering that, a UNIX-aware application (e.g., a UNIX shell) will call the test command to evaluate expression.

 

Interestingly, these two forms are equivalent:

 

             test expression

             [ expression ]

 

The book [1] that I am reading says this about the second form:

 

The [ is actually the name of the command
             (who said anything about command names
             having to be alphanumeric characters?). It
             still initiates execution of the same test
             command, only in this format, test expects
             to see a closing ] at the end of the expression.

 

Okay, now to XML ….

 

An XML document may contain this:

 

             &lt;

 

Upon encountering that, an XML-aware application (e.g., an XML parser) will call a routine to convert the entity. One might say this:

 

The & is actually the name of the command.
             It initiates execution of the & command and
             expects to see a closing ; at the end.

 

So, …………….

 

Is & a command?

 

Likewise, ……………..

 

Is < a command?

 

Is " a command?

 

If the answers are no, then what are they? What is the difference between a command and whatever those things are?

 

/Roger

 

[1] UNIX Shell Programming by Kochan and Wood, p. 155.



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.