Lexical Tools

Command Line Syntax

Design

> Command [Option1 Option2 ...] Data

or

> Command [Option1 Option2 ...]
> Data

where option is -flag[:argument1:argument2: ...]

Option separators:

1st Layer "-"
2nd Layer ":"
3rd Layer "~"
4th Layer "^"
5th Layer "#"

Arguments separator: "+"

An option can be represented by a syntaxed string.
=> An option string consists of a series if option items.
=> An option item consists of flag & argument.
=> An argument can be an option item, and thus it constrains lower level of flags and arguments.

< Example >
lvg -a:aa:abc~abb -b:ba:bb:12
=> Option String: "-a:aa~abc~abb -b:ba:bb:12"
=> Option Items (1st level): "-a:aa:abc~abb", "-b:ba:bb:12".
=> Flag for option items (-a:aa~abc~abb): "a"
=> Argument for Option items (-a:aa~abc~abb): ":aa~abc~abb"
=> Argument (:aa~abc~abb) is a option item.
"aa" and "~abc~abb" are lower level of flag and arguments.

An option can be represented by a linked list (OptionList).
=> An OptionList consists of a number of OptionFlags.
=> An OptionFlag may contain a lower level of OptionList as its child.
=> Accordingly, the child of an OptionFlag is an OptionList.
=> All the OptionFlag in a same OptionList should have a same parent (OptionFlag).

< Example >
lvg -a:aa:abc~abb -b:ba:bb:12

lvg
 |
 +--a
 |    |
 |    +--aa
 |          |
 |          +--abc
 |          +--abb
 +--b
 |
 +--ba
 +--bb
 +--INT

Table

Level OptionList OptionFlgas
1st lvg(a, b) a, b
2nd a(aa) aa
3rd aa(abc, abb) abc, abb
2nd b(ba, bb, INT) ba, bb, INT