[Ur] Grammar inconsistencies

Ron de Bruijn rmbruijn at gmail.com
Sat Nov 5 05:59:56 EDT 2011


Hi,

I made some examples showing some apparent inconsistencies between the 
documented SQL grammar and the implemented SQL grammar.

The 'rules' I talk about below refer to how the manual calls the non-terminals 
in section 9.1.2 'Queries' of the Ur/Web manual.

type a = string
type b = string

table t : { A : a,
             B : b}

con c = [A = a, B = b]

(*  this is fine *)
val ok:transaction (option {T : {A : a, B : b}}) = oneOrNoRows (SELECT t.{{c}} 
FROM t)

(* now, pick rule Q -> q -> P -> p,+  , this doesn't work. *)

val notok:transaction (option {T : {A : a, B : b}}) = oneOrNoRows (SELECT 
t.{{c}},  FROM t)

(* let's take another derivation:
Q -> q -> P -> p -> E AS f
                .....      .....
               ..              ....
             ...                  ..
            ..                     ...
          t.{{c}}                    Whatever


=> t.{{c}} AS MyColumnName is a valid derivation

This is correct w.r.t. my reading of the grammar, but what does the compiler 
tell us?

syntax error: replacing  AS with  COMMA
Parse failure

(Pay no attention to the wrong return type, since that is of no interest in this 
example. )
*)

val not_ok2 : transaction (option {T : {A : a, B : b}}) = oneOrNoRows (SELECT 
t.{{c}} AS Whatever FROM t)

-- 
Best regards,
   Ron de Bruijn



More information about the Ur mailing list