{"id":18391087,"url":"https://github.com/fragglet/yocton","last_synced_at":"2025-04-07T02:35:32.224Z","repository":{"id":167703158,"uuid":"496068294","full_name":"fragglet/yocton","owner":"fragglet","description":"Stringly-typed Minimalist Object Notation","archived":false,"fork":false,"pushed_at":"2024-11-26T04:32:36.000Z","size":501,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"trunk","last_synced_at":"2025-04-06T08:11:38.722Z","etag":null,"topics":["c","encoding","minimalist"],"latest_commit_sha":null,"homepage":"https://fragglet.github.io/yocton/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fragglet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-25T03:24:47.000Z","updated_at":"2024-11-26T04:32:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"5df3634b-5f8e-4b56-888d-4b2a1dc7e80a","html_url":"https://github.com/fragglet/yocton","commit_stats":null,"previous_names":["fragglet/yocton"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fragglet%2Fyocton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fragglet%2Fyocton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fragglet%2Fyocton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fragglet%2Fyocton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fragglet","download_url":"https://codeload.github.com/fragglet/yocton/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247583715,"owners_count":20962068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","encoding","minimalist"],"created_at":"2024-11-06T01:50:36.959Z","updated_at":"2025-04-07T02:35:31.692Z","avatar_url":"https://github.com/fragglet.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nYocton is a minimalist, typeless object notation, intended to fit nicely\nwith the C programming language and intended for situations where the features\nof other formats such as JSON or protocol buffers are not necessary.\n\n![Captain Yocton](cpt-yocton.png)\n\nThe mascot for Yocton is Captain Yocton, who is a tiny alien superhero.\n\n## Data model\n\nA Yocton document consists of an object. Every object has a number of\nproperties. Each property has a name and either a string value or an inner\nobject. For example:\n```\nproperty_name1: \"hello\"\nstring_property: \"world\"\nobject_property {\n  inner_property1: \"foo\"\n  inner_property2: \"bar\"\n}\n```\nStrings can be represented in two different ways:\n\n1. The first is the traditional C-style syntax, with surrounding double-quotes\n   and backslash-escaping for special characters.\n2. The second is \"symbol\" format. The surrounding quotes can be omitted\n   if the string matches `^[A-Za-z0-9_+-\\.]+$`, or in plain English, if every\n   character is either alphanumeric, or one of underscore, plus, minus,\n   or period.\n\nTaking into account the above two representations, here is another example:\n```\n// This is a comment\nmy_integer: 12345\nmy_float: 1.234e-10\nmy_boolean: true\nerror: EAGAIN\ntemperature_map {\n  \"ice cream\": -18C\n  \"room temperature\": 20C\n}\nip_address: 192.168.4.10\nmy_list {\n  element: 123\n  element: 456\n  element: 789\n}\n```\n\nAs seen in this example:\n\n* The symbol notation allows a variety of different formats to be concisely\nrepresented, including C symbol names, floating-point numbers, IP addresses or\neven temperatures.\n\n* There is no requirement that an object can only have one property of a\nparticular name; this provides a way of representing lists even though there is\nno special syntax for them.\n\n## Strings\n\nStrings are represented using a subset of the familiar C syntax with the\nfollowing escape sequences:\n\n| Escape | Description            |\n|--------|------------------------|\n| \\\\n    | Newline                |\n| \\\\t    | Tab                    |\n| \\\\\\\"   | Double quotes (\\\")     |\n| \\\\\\\\   | Literal backslash (\\\\) |\n| \\\\xDD  | ASCII control character by hexadecimal number, in range 01h-1Fh (characters outside this range are not valid). |\n\nControl characters are not valid in bare form inside a string and must be\nescaped. There is no way of representing a NUL character (ASCII 00h); this is a\ndesign decision. Strings are intended for storing textual data; binary data can\nbe stored using an encoding like base64 if necessary.\n\nA special syntax using the '\u0026' character allows strings to be specified in\nmultiple \"chunks\" that get concatenated together. For example:\n```\nspecial_syntax: \"to support \" \u0026 \"strings\\n\" \u0026\n                \"that span \" \u0026 \"multiple lines\"\n\" you can even\\n\" \u0026\n\"do this with property names\": 12345\n```\n\n## Unicode\n\nYocton is \"UTF-8 friendly\" but does not include special support for\nUnicode. This is in keeping with its typeless format - strings are really\njust arbitrary sequences of bytes. The encoding ought to be UTF-8 nowadays,\nbut could also be a different encoding like ISO-8859-1 (although not\nsome multi-byte formats like Shift-JIS unfortunately, for\n[technical reasons](https://en.wikipedia.org/wiki/Shift_JIS#Description:~:text=0x5C%20byte%20will%20cause%20problems)).\nThere isn't any validation of the input encoding that forces you to use UTF-8\nor any other format, though UTF-8 is strongly recommended.\n\nAs a result, Yocton does not include any special support for Unicode; most\nnotably it does not include support for the `\\u` or `\\U` escape sequences that\nJSON has. This is deliberate; simply encode your file as UTF-8 and put the\ncharacters that you want in the file. These days it is reasonable to assume\nUTF-8 as an encoding, all modern text editors support it, and there is no need\nto encode everything in plain ASCII.\n\nThe one minor piece of special handling for UTF-8 is that Yocton recognizes\n(and ignores) the UTF-8\n[BOM](https://en.wikipedia.org/wiki/Byte_order_mark), ensuring that any\nvalid UTF-8 input file should be parsed correctly.\n\n## API\n\nThe Yocton API is a \"pull parser\" that is designed to work nicely for\nstatically compiled languages like C. There is a [guide](parse_api.md) to the\nAPI that explains how to use it.\n\n## What Yocton doesn't have\n\nCompared with JSON:\n\n* Types: Yocton is [\"stringly typed\"](https://wiki.c2.com/?StringlyTyped),\n  only providing a basic hierarchical structure for strings to be arranged\n  in. It is up to the programmer to interpret the content of these strings,\n  placing some additional burden not found with other formats.\n* Arrays: since there is no restriction that an object can only have one\n  property with a particular name, repeated values can be represented as\n  repeated properties with the same name. An alternative is an object where\n  sequential numbers are used as property names.\n* Number types: strings can be used to store a representation of a number.\n  The set of characters allowed in symbols includes alphanumeric\n  characters, period, plus and minus, allowing natural representation of\n  numbers in almost any format - integer, decimal, hexadecimal,\n  exponential/scientific, etc. without the need for quotes.\n* Booleans: strings can be used to store the word \"true\" or \"false\". The\n  symbol format allows a natural representation.\n* Null: strings can be used to store the word \"null\". The symbol format\n  allows a natural representation.\n\n## What's with the name?\n\nyocto- is the Si unit prefix for a factor of 10\u003csup\u003e−24\u003c/sup\u003e. The -on suffix\nis the same as in JSON where it stands for Object Notation. So it's a very\nsmall object notation.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffragglet%2Fyocton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffragglet%2Fyocton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffragglet%2Fyocton/lists"}