faqts : Computers : Programming : Languages : Tse : Parser

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 1 people (0%) answered Yes
Recently 0 of 1 people (0%) answered Yes

Entry

TSE: Parser: Syntax:Structure:Repeat: Occurrence: +: How to create parser for 1 or more occurrences?

Oct 20th, 2003 17:23
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 25 September 2003 - 01:26 am ------------------

TSE: Parser: Syntax:Structure:Repeat: Occurrence: +: How to create 
parser for 1 or more occurrences?

---

How to possibly parse one or more occurrences of some object (e.g. a
string, a paragraph, ...):

---
---

e.g. Suppose you define a books as a collection
of one or more book.

---

In words:

books is a collection of one or more book.

---
---

In Backus Naur Form:

[books] = [book]+

---
---

In Backus Naur Form diagram:

              +---------<-----+
              |               |
'books' = -->-+->--[book]--->-+->--

---
---

In pseudo code:

repeat
 get 'book'
until 'condition'

---
---

In pseudo code: in general:

repeat
 get 'value'
until 'condition'

---
---

As regular expression: non-greedy:

{book}+

---
---

As regular expression: non-greedy: in general:

{value}+

---
---

As regular expression: greedy:

{book}#

---
---

As regular expression: greedy: in general:

{value}#

---
---

Note: So you use a repeat loop, because of this corresponds also to a
loop which might be executed at least once and possibly more times.

---
---

Internet: see also:

TSE: Parser: Syntax: Structure: Serial: Occurrence: &: And: How create 
parser for serial occurrence?
http://www.faqts.com/knowledge_base/view.phtml/aid/24710/fid/1236

---

TSE: Parser: Syntax: Structure: If: Occurrence: ?: How to create a 
parser for 0 or 1 occurrences?
http://www.faqts.com/knowledge_base/view.phtml/aid/24708/fid/1236

---

TSE: Parser:Syntax:Structure:Parallel:Occurrence: |: How create parser 
for 1 or more parallel cases?
http://www.faqts.com/knowledge_base/view.phtml/aid/24705/fid/1236

---

TSE: Parser: Syntax: Structure: While: Occurrence: *: How create 
parser for 0 or more occurrences?
http://www.faqts.com/knowledge_base/view.phtml/aid/24700/fid/1236

----------------------------------------------------------------------