Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/rxm.git

Started simplest form of BNF.

Author Dave Jarvis <email>
Date 2015-02-05 23:02:53 GMT-0800
Commit 986fba028dff21c1dce48d8d8ff8dae18bebe0a3
Parent bba3633
Delta 64 lines added, 21 lines removed, 43-line increase
example.txt
-# Syntax does not include comments.
+# Overview
-root > people, # "root" is a special keyword
-person > person, # > is a node to table relation
-person.first_name -> name/first, # -> is a node/attribute to column relation
-person.last_name -> name/last,
-person.age -> [@age],
-account.person_id => person.person_id, # => is a join
-account > person/account,
-account.id -> [@id]; # ; starts the WHERE clause
+root > people, # "root" is a keyword
+person > person, # maps a node to table context
+.first_name > first, # maps a node to column
+.last_name > name/last, # maps an ancestor node to a column
+.age > @age, # @ maps an attribute to table node
+account.person_id > person.person_id, # performs an inner join
+account > account, # context is now "account" node
+.id > @id; # ; starts the WHERE clause
-# Where clause syntax
+# Wildcard
-account.id = :id # : starts a named parameter
-account.id != :id # inequality parameter comparison
-account.id = {:id, 1} # { ... } denotes set (IN)
-account.id = null # null keyword
+root > people,
+person > person,
+.*; # Columns mapped to correspondingly named elements.
+
+# Namespaces
+
+root > people(html, http://www.w3.org/TR/html4/),
+person > html:person,
+
+person.id > people:id( people, http://www.people.com ),
+
+# Where clause
+
+account.id = $id # $ starts a named parameter
+account.id <> $id # inequality parameter comparison
+account.id = {$id, 1} # IN set
+account.id <> {$id, 1} # NOT IN set
account.id = null # becomes IS NULL
-account.id != null # becomes IS NOT NULL
+account.id <> null # becomes IS NOT NULL
account.id = 'text' # string equality comparison
account.id = -42 # numeric equality comparison
rxm.cf
-EAdd. Exp ::= Exp "+" Exp1 ;
-ESub. Exp ::= Exp "-" Exp1 ;
-EMul. Exp1 ::= Exp1 "*" Exp2 ;
-EDiv. Exp1 ::= Exp1 "/" Exp2 ;
-EInt. Exp2 ::= Integer ;
-coercions Exp 2 ;
+token Identifier (letter (letter | digit | '_')*) ;
+token Column ('.' Identifier) ;
+token Attribute ('@' Identifier) ;
+token Parameter ('$' Identifier) ;
+
+Query ::= Start "," Map ";" Where ;
+
+Start ::= "root" ">" Element ;
+
+Map ::= Glob | Line;
+
+Glob ::= ".*" ;
+
+Line ::= Entity ">" XPath "," ;
+
+Entity ::= Table | Column ;
+
+Table ::= Identifier ;
+
+XPath ::= Element | Attribute ;
+
+Element ::= Identifier | Identifier "/" Element ;
+
+Where ::= Expression LogicalOp Where ;
+
+Expression ::= Table Column "=" ExpressionValue ;
+
+ExpressionValue ::= Value | Set ;
+
+Value ::= Parameter | "null" | String | Double ;
+
+Set ::= "{" SetValues "}" ;
+
+SetValues := Value | Value "," ;
+
+LogicalOp ::= "&&" | "||" ;