{"id":27057921,"url":"https://github.com/mrange/hron","last_synced_at":"2025-04-05T11:34:04.137Z","repository":{"id":5474785,"uuid":"6671224","full_name":"mrange/hron","owner":"mrange","description":"hron - human readable object notation","archived":false,"fork":false,"pushed_at":"2015-05-12T19:48:17.000Z","size":1124,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-30T00:36:24.777Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrange.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.html","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-13T13:47:35.000Z","updated_at":"2019-08-20T07:35:02.000Z","dependencies_parsed_at":"2022-07-06T19:33:38.254Z","dependency_job_id":null,"html_url":"https://github.com/mrange/hron","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrange%2Fhron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrange%2Fhron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrange%2Fhron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrange%2Fhron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrange","download_url":"https://codeload.github.com/mrange/hron/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247325628,"owners_count":20920713,"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":[],"created_at":"2025-04-05T11:34:01.792Z","updated_at":"2025-04-05T11:34:04.104Z","avatar_url":"https://github.com/mrange.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"hron\n====\n\nhron - Human Readable Object Notation\n\nXML and JSON (and others) aim to be human-readable, language independent, data interchange \nformats. However they are not without flaws:\n\nXML\n---\n1. The XML author has to take care avoiding letters such as \u0026\u003c\u003e and make sure to encode them properly. \n   This hurts readability and writeability.\n\nJSON\n----\n1. JSON struggles with multi-line texts.\n2. JSON number values are, depending on platform, unserialized as double, long or decimal. \n   This makes JSON number values less useful as, depending on how the value is unserialized,\n\t information may be lost. We have personally encountered this in a financial application \n   with disastrous end results.\n3. JSON lacks strong deserializers on the .NET platform. There are many attempts but\n   none feel as strong as the XMLDOM did already in 1998. \n\nhron\n----\n\nhron stands for human readable objection notation:\n\n1. we put human readable in the acronym to remind us why we started thinking about \n   hron in the first place.\n2. hron supports multi-line texts\n3. hron doesn't require you to escape \"special\" characters\n4. In hron, we made indention significant (as in python) in order to eliminate end tags and \n   to improve readability\n5. hron has objects and values. Objects consist of other objects or values.\n   Values are always text values. \n6. There is no special array type. Arrays are created by first adding a named object or value \n   and then just adding another one witout a name. This creates a two element array.\n\nhron sample\n-----------\n\n```hron\n\n# This is an ini file using hron\n\n# object values are started with '@'\n@Greeting\n\t=Title\n\t\tHello World from hron!\n\t=WelcomeMessage\n\t\tHello there!\n\n\t\tString values in hron are started with '='\n\n\t\tJust as in Python, indentation is significant in hron\n\n\t\tIndentation promotes readability but also allows hron string values \n\t\tto be multi-line and relieves them from the need for escaping. \n\n\t\tLet us say that again, there exists _no_ character escaping in hron. \n\t\t\n\t\tLetters like this are fine in an hron string: \u0026\u003c\u003e\\\"'@=\n\n\t\tThis helps readability!\n@DataBaseConnection\n\t=Name\n\t\tCustomerDB\n\t=ConnectionString\n\t\tData Source=.\\SQLEXPRESS;Initial Catalog=Customers\n\t=TimeOut\n\t\t10\n\t@User\n\t\t=UserName\n\t\t\tATestUser\n\t\t=Password\n\t\t\t123\n```\n\nThe above would (in groovy/java lingo, replace Map with dictionary for .Net) parse to a map with\ntwo keys: 'Greeting' and 'DataBaseConnection' where the value for key Greeting is a map with two string \nvalues and the value for key DataBaseConnection is a list which contains two map objects. For a good examlpe\nof what is an is not valid, take a look at \n[the parser unit tests](https://github.com/mbjarland/hron/blob/master/languages/groovy/src/test/groovy/org/m3/hron/HronParserSpecification.groovy)\n, some of which are quite descriptive. \n\nIs There a Parser for Language X?\n---------------------------------\nPossibly! Check in the [languages sub directory](https://github.com/mrange/hron/tree/master/languages).\n\nWe are busy implementing parsers in various languages, some as reference implementations with little \nconcern for parser performance (i.e. the groovy parser), others with specific performance metrics \nin mind (like the java one). Shortly upcoming parsers include scala and c++. \n\nIf you can not find a parser in your language, fork the repo and write one! We welcome all contributions. \nWe would especially welcome an implementation in javascript and any insane implementations in long forgotten \nor obscure languages, because...well because we like computer languages (hey lispers, you listening?). \n\nWe are also working on a standardized set of test files, both positive and negative, which will\nconstitute a smoke test for new parsers. \n\nhron grammar (EBNF)\n-------------------\nRules for the grammar notation: \n\n1. The symbol \"::=\" serves the same purpose as colon in Bison. \n2. Unquoted parentheses group expressions. \n3. A trailing unquoted asterisk (*) indicates 0 or more repetitions. \n4. A trailing unquoted plus (+) indicates 1 or more repetitions. \n5. Unquoted square brackets indicate an optional expression. \n6. \"p EXCEPT q\" means that parser succeeds if p succeeds and q fails\n\nEBNF \n----\n\n```ebnf\n\nanychar         ::= \u003cparses any character\u003e\nwhitespace      ::= \u003cparses any whitespace character\u003e\neos             ::= \u003cparses END OF STREAM\u003e\neol             ::= \u003cparses END OF LINE (END OF STREAM counts as END OF LINE)\u003e\nany_indention   ::= \u003cparses any indention\u003e\nindention       ::= \u003cparses the current indention\u003e\nindent          ::= \u003cincreases indention by one\u003e\ndedent          ::= \u003cdecreases indention by one\u003e\n\nempty_string    ::= (whitespace EXCEPT eol)*\nstring          ::= (anychar EXCEPT eol)*\ncomment_string  ::= any_indention \"#\" string\n\npreprocessor    ::= \"!\" string eol\npreprocessors   ::= preprocessor*\n\nempty_line      ::= empty_string eol\ncomment_line    ::= comment_string eol\nnonempty_line   ::= indention string eol\nvalue_line      ::= nonempty_line | comment_line | empty_line\nvalue_lines     ::= (value_line EXCEPT eos)*\n\nvalue           ::= indention \"=\" string eol indent values_lines dedent\nempty           ::= empty_string eol\ncomment         ::= comment_string eol\nobject          ::= indention \"@\" string eol indent members dedent\nmember          ::= value | object | comment | empty\nmembers         ::= (member EXCEPT eos)* \n\nhron ::= preprocessors members\n\n```\n\nWho Are We?\n-----------\nJust a few guys who got tired of name spaces and entity escaping and figured the world \nwould be a better place with a simple, human readable data interchange format. \n\nCurrent contributors: \n\n#### [Mårten Rånge](https://github.com/mrange)\nhron language specification, BNF, and implementations in C#, C++ and F#. \n\n#### [Matias Bjarland](https://github.com/mbjarland)\nContributions to hron language specification, implementations in groovy and java.\n\n#### [Mattias Karlsson](https://github.com/devlead)\nTogether with Mårten responsible for spawning the idea for hron. Contributions to language \nspecification, invaluable feedback. \n\n### [Daniel Brännström](https://github.com/codecontemplator)\nContributed hron parsers for numerous languages such as Haskell, JavaScript, Python and PowerShell.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrange%2Fhron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrange%2Fhron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrange%2Fhron/lists"}