- Added test script and initial grammar file.
This commit is contained in:
Paul Beckingham 2013-08-30 11:25:04 -07:00
parent 6ebee13fa4
commit 888a77213a
3 changed files with 85 additions and 0 deletions

2
src/parser/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
libparser.a
parser

82
src/parser/grammar.bnf Normal file
View file

@ -0,0 +1,82 @@
# The command line needs to obey a grammar. It is against this grammar that
# bugs will be identified.
#
# Conventions:
# - Literals are always double-quoted.
# - "*", "+" and "?" suffixes have POSIX semantics.
# - Low-level primitives are in <brackets>.
# - @name for entity lists such as custom report names.
#
# The general form of commands is:
# task [ all-commands ]
#
grammar ::= all-commands?
;
all-commands ::= report-command
| read-command
# | write-command
| special-command
;
report-command ::= filter @report ;
read-command ::= filter @readcmd ;
# write-command ::= filter @writecmd modifiers ;
special-command ::= ;
filter ::= expression? ;
expression ::= term "and" expression
| term "or" expression
| term
;
# modifiers ::= ;
# Low-level:
# dom ::= context-value
# | system-value
# | rc-value
# | task-value
# ;
# context-value ::= "context.program"
# | "context.args"
# | "context.width"
# | "context.height"
# ;
# system-value ::= "system.version"
# | "system.os"
# ;
# rc-value ::= /rc\.[a-zA-Z.]+/
# ;
# task-value ::= <id> "." @attribute
# | <uuid> "." @attribute
# ;
# literal ::= <string>
# | <numeric>
# | <date>
# | <duration>
# ;
# Supported primitives:
#
# <id>
# <uuid>
# <override> "rc." name "=" string
# <string> " ... "
# <numeric>
# <date> ISO-8601 date
# <duration> ISO-8601 duration
# @command all commands
# @report all custom reports
# @attribute all attributes, UDAs
# @readcmd all read-only commands
# @writecmd all write commands

1
src/parser/run Executable file
View file

@ -0,0 +1 @@
./parser $* grammar.bnf 123 mod pro:H