[langsec-discuss] TJSON: Tagged JSON with Rich Types

Tony Arcieri bascule at gmail.com
Fri Nov 4 02:09:24 UTC 2016


Err whoops, ignore that extra <alphanumeric-lower> ::= <alpha> | <digit> at
the bottom ;)

On Thu, Nov 3, 2016 at 7:08 PM, Tony Arcieri <bascule at gmail.com> wrote:

> On Thu, Nov 3, 2016 at 2:46 AM, Sven M. Hallberg <pesco at khjk.org> wrote:
>
>> >     {"dialpad:A<A<i>>": [["1","2","3"], ["4","5","6"], ["7","8","9]]}
>>
>> Now this looks definitely context-sensitive. One nested structure on the
>> right of the ':' depending on another to the left. You can no longer get
>> away with a grammar but you'll have all the fun of a type system.
>>
>
> The grammar is certainly still context-free:
>
>     <member> ::= <tagged-string> <name-separator> <value>
>     <tagged-string> ::= '"' *<char> ':' <tag> '"'
>     <tag> ::= <non-scalar-expr> | <scalar-tag>
>     <non-scalar-expr> ::= <non-scalar-tag> '<' <tag> '>'
>     <non-scalar-tag> ::= <alpha-upper> *<alphanumeric-lower>
>     <scalar-tag> ::= <alpha-lower> *<alphanumeric-lower>
>     <alphanumeric-lower> ::= <alpha-lower> | <digit>
>     <alpha-upper> ::= 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' |
>                       'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' |
>                       'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' |
>                       'Y' | 'Z'
>     <alpha-lower> ::= 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' |
>                       'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' |
>                       'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' |
>                       'y' | 'z'
>     <digit> ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
>     <alphanumeric-lower> ::= <alpha> | <digit>
>
> But, as you noted, this does add a sort of type system to the language,
> such that it's now possible to express documents which don't typecheck.
>
> I agree this makes the format more complicated, but it does make the
> format more amenable to mapping to statically typed programming language.
> Also, it's a rather simple type system, and one that can typecheck things
> in the same pass as processing it (I believe, I'm still yet to implement
> it).
>
> Wait a minute, why are you stopping at objects with the type
>> refinement? Shouldn't you put your entire schema into the type?
>>
>
> Objects as self-describing product types, so no further type information
> is necessary.
>
> --
> Tony Arcieri
>



-- 
Tony Arcieri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.langsec.org/pipermail/langsec-discuss/attachments/20161103/c27ad419/attachment.html>


More information about the langsec-discuss mailing list