Skip to main content
14 events
when toggle format what by license comment
May 24, 2018 at 17:44 vote accept Lance Pollard
May 24, 2018 at 6:30 answer added Doc Brown timeline score: 3
May 24, 2018 at 4:44 comment added Robert Harvey Javascript supports this natively with JSON using Stringify and parse, no further effort required. If you want to handle custom representations, you have to write your own stringify and parse functions. I've never heard of this being done with a grammar, though I suppose you could.
May 24, 2018 at 4:32 comment added Lance Pollard @RobertHarvey I am using JavaScript. Just thinking of the URL example, parsing/serializing that since it's a standard object with named properties (protocol, domain, pathname, query, etc.).
May 24, 2018 at 4:32 comment added Lance Pollard @unifiedmodelingsandwich I am considering just a general parsing/serializing of my own arbitrary/custom representation (which can def be part of the answer, how the representation should be, but doesn't need to go into that as that's more impl specific).
May 24, 2018 at 4:11 comment added unified modeling sandwich Lance, please provide more info. Are you looking for a way to export and import a representation of internal objects, where the representation is chosen by the system? Or are you asking a general question about parsing and serialising an external representation of your choice?
May 24, 2018 at 4:06 comment added Robert Harvey What programming language are you using?
May 24, 2018 at 4:05 comment added Lance Pollard Please explain more that sounds like what I'm looking for :)
May 24, 2018 at 4:00 comment added Robert Harvey Generalized serialization/deserialization of objects (without having to know the type being serialized/deserialized ahead of time) is already a thing in several programming languages. It is accomplished using a variety of techniques, including Reflection.
May 24, 2018 at 3:12 comment added unified modeling sandwich If the mapping from strings to tokens, as well as the rules for creating an abstract syntax representation from the sequence of tokens, are both bijective, then an algorithm can revert the lexical and grammatical analysis based on data structures representing the mapping and rules. All other cases require analysis and then usually serialisation code is the best option, because you have to know whether your alternatives can all be represented by a normal form (which no algorithm can guess from your injective rules, although in theory the data can be extended to include such information).
May 24, 2018 at 3:04 history edited Lance Pollard CC BY-SA 4.0
added 167 characters in body
May 24, 2018 at 2:55 comment added Telastyn What? This doesn’t make any sense. Types by definition define the legal values a variable can have. Product types allow you to combine multiple variables. Generating the possible strings is simply iterating the possible values (in string form; all possible combinations for product types). That doesn’t require any fancy data structure, and is near useless in any case.
May 24, 2018 at 2:47 history edited Lance Pollard CC BY-SA 4.0
added 113 characters in body
May 24, 2018 at 2:39 history asked Lance Pollard CC BY-SA 4.0