| +Makefile | ||
| +bnfc.log make.log | ||
| +# Overview | ||
| + | ||
| +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, | ||
| +^, # return to previous context | ||
| +address > address, | ||
| +.*; # * globs all columns. ; is WHERE | ||
| + | ||
| +# 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 = 'text' # string equality comparison | ||
| +account.id = -42 # numeric equality comparison | ||
| +account.id < 42 # numeric less than comparison | ||
| +account.id > 42 # numeric greater than comparison | ||
| +account.id <= 42 # numeric less than or equal to comparison | ||
| +account.id >= 42 # numeric greater than or equal to comparison | ||
| + | ||
| #!/bin/bash | ||
| -make clean | ||
| +echo "Requires bnfc v2.7.1 (or greater)" | ||
| -bnfc -m -java -p com.whitemagicsoftware rxm.cf | ||
| +echo -n "bnfc version: " | ||
| +bnfc --version | ||
| -make DVIPS="echo" JAVA_FLAGS="-cp .:lib/*" JAVAC_FLAGS="-cp .:lib/*" LATEX="pandoc -s -t context rxm.tex -o rxm-ctx.tex ; context --purge-all rxm-ctx.tex ; mv rxm-ctx.pdf rxm.pdf ; rm rxm-ctx.*" | ||
| +echo "Converting BNFC to Java..." | ||
| +bnfc -m -java -p com.whitemagicsoftware rxm.cf > bnfc.log 2>&1 | ||
| + | ||
| +CLASSPATH="-cp .:lib/*" | ||
| + | ||
| +mkdir build | ||
| + | ||
| +echo "Building files..." | ||
| +make JAVA_FLAGS="$CLASSPATH" JAVAC_FLAGS="$CLASSPATH -d build" > make.log 2>&1 | ||
| -# Overview | ||
| - | ||
| -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 | ||
| - | ||
| -# Wildcard | ||
| - | ||
| -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 = 'text' # string equality comparison | ||
| -account.id = -42 # numeric equality comparison | ||
| -account.id < 42 # numeric less than comparison | ||
| -account.id > 42 # numeric greater than comparison | ||
| -account.id <= 42 # numeric less than or equal to comparison | ||
| -account.id >= 42 # numeric greater than or equal to comparison | ||
| - | ||
| Author | Dave Jarvis <email> |
|---|---|
| Date | 2015-02-08 11:21:30 GMT-0800 |
| Commit | e9d4f8df89e86d52973f90a95bad2e9c6793da62 |
| Parent | fa715eb |
| Delta | 50 lines added, 42 lines removed, 8-line increase |