{"id":13608532,"url":"https://github.com/catseye/beta-Juliet","last_synced_at":"2025-04-12T17:32:02.852Z","repository":{"id":3353942,"uuid":"4399190","full_name":"catseye/beta-Juliet","owner":"catseye","description":"MIRROR of https://codeberg.org/catseye/beta-Juliet : A minimal event-oriented language","archived":false,"fork":false,"pushed_at":"2023-11-09T18:13:23.000Z","size":81,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-05T04:44:57.999Z","etag":null,"topics":["esolang","event-driven-behavior","event-driven-programming","experimental-language","state-machine"],"latest_commit_sha":null,"homepage":"https://catseye.tc/node/beta-Juliet","language":"C","has_issues":false,"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/catseye.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2012-05-21T21:51:44.000Z","updated_at":"2023-10-27T14:19:54.000Z","dependencies_parsed_at":"2024-08-01T19:42:15.560Z","dependency_job_id":"51816e89-302b-4e75-bcf3-aa42bef4c31c","html_url":"https://github.com/catseye/beta-Juliet","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2Fbeta-Juliet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2Fbeta-Juliet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2Fbeta-Juliet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2Fbeta-Juliet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/catseye","download_url":"https://codeload.github.com/catseye/beta-Juliet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248605176,"owners_count":21132123,"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":["esolang","event-driven-behavior","event-driven-programming","experimental-language","state-machine"],"created_at":"2024-08-01T19:01:28.039Z","updated_at":"2025-04-12T17:31:57.844Z","avatar_url":"https://github.com/catseye.png","language":"C","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"β-Juliet\n========\n\nVersion 2.0\n| _Entry_ [@ catseye.tc](https://catseye.tc/node/beta-Juliet)\n| _Wiki entry_ [@ esolangs.org](https://esolangs.org/wiki/2iota)\n| _See also:_ [Squishy2K](https://codeberg.org/catseye/Squishy2K#squishy2k)\n∘ [Nested Modal Transducers](https://codeberg.org/catseye/The-Dossier/src/branch/master/article/Nested-Modal-Transducers/README.md)\n\n- - - -\n\nβ-Juliet is a minimal event-oriented language which, as of version 2.0\n(see [historical note](#historical-note) below), is probably Turing-complete.\n\nDescription\n-----------\n\nβ-Juliet is a fairly minimal event-oriented language.  In β-Juliet, the world\nis modelled as a set of _events_ which have no inherent organization or order.\nEach event can be denoted with a _symbol_, such as `DominoFalls`, `CatMeows`,\nor `SunSets`, or (in version 2.0) a string of symbols, such as `Address Line\nSix Goes High` or `Greengrocer Falls Asleep on Subway`.\n\nEach event can cause other events to occur — these are termed _consequences_\nof the event.  In addition, this causation may be conditional, but the only\ncondition that is possible to check is: _given two events, which one happened\nmore recently?_\n\nExample\n-------\n\n    // Description of a weather-sensitive robot tarpaulin in beta-Juliet\n\n    event RainBegins;\n    event RainEnds;\n\n    event SystemActivated;\n    event SystemDeactivated;\n\n    event CloseTarpaulin,\n     caused after RainBegins when SystemActivated \u003e SystemDeactivated;\n\n    event OpenTarpaulinTimer,\n     duration 10 m,\n     caused after RainEnds when SystemActivated \u003e SystemDeactivated;\n\n    event OpenTarpaulin,\n     caused after OpenTarpaulinTimer.\n\nBasic Grammar\n-------------\n\nThe basic grammar of β-Juliet is given here in EBNF.  Version 1.0 uses this\ngrammar as it stands; version 2.0 extends many of the productions.\n\n    betaJuliet ::= Decl {\";\" Decl} \".\".\n    Decl       ::= Event.\n    Event      ::= \"event\" EventDecl {\",\" Property}.\n    EventDecl  ::= Symbol.\n    Property   ::= Caused | Causes | Duration.\n    Caused     ::= \"caused\" TimePrep EventAppl {WhenTerm}.\n    Causes     ::= \"causes\" EventAppl [\"immediately\"] {WhenTerm}\n    Duration   ::= \"duration\" TimeSpec.\n    TimePrep   ::= \"before\" | \"after\" | \"by\".\n    TimeSpec   ::= RationalNumber TimeUnit.\n    TimeUnit   ::= \"ms\" | \"s\" | \"m\" | \"h\" | \"d\".\n    EventAppl  ::= Symbol.\n    WhenTerm   ::= \"when\" EventAppl \"\u003e\" EventAppl.\n    Symbol     ::= \u003c\u003cone or more alphanumeric characters\u003e\u003e.\n    Number     ::= \u003c\u003crational number in decimal format\u003e\u003e.\n\n### Some Explanations ###\n\nThe syntax `A \u003e B` can be read as \"`A` has occurred more recently than `B`\".\nIf `A` has occurred but `B` has never occurred, `A \u003e B` is still true;\nhowever, if neither event has ever occurred, both `A \u003e B` and `B \u003e A` are\nfalse.\n\n`caused` and `causes` are two equivalent ways of expressing the causality\nrules between events.  If we say one event is `caused by` or `caused after`\nsome other event, that is equivalent to saying the other event `causes` the\none event.  Similarly, if we say one event is `caused before` some other\nevent, that is equivalent to saying the other event `causes` the one event\n`immediately`.\n\nWhen we define an event like\n\n    event Foo,\n        causes Bar,\n        causes Baz.\n\nor like this\n\n    event Bar, caused by Foo;\n    event Baz, caused by Foo.\n\n...and during execution, after `Foo` happens, it is not guaranteed that\neither `Baz \u003e Bar` or `Bar \u003e Baz` is true; the order in which these two\nconsequences occur does not necessarily follow source code order.  (But it\nis guaranteed that one or the other will be true, as both events will have\nhappened.)\n\nIf you require an ordering guarantee in a case like this, you should use\nan intermediate event, like\n\n    event Foo,\n        causes Temp,\n        causes Bar;\n    event Temp,\n        causes Baz.\n\nAfter `Temp` happens, `Baz \u003e Bar` should be true.\n\n### `caused before` ###\n\nAlternately, in theory, you can use `caused before`, as in:\n\n    event Bar, caused before Foo;\n    event Baz, caused after Foo.\n\nAfter `Foo` happens, `Baz \u003e Bar` should be true.\n\nSome words on the purpose of `caused before` are in order.  In the original\nvision, `after` and `by` were synonyms, but `before` was meant to actually\ncause the event on which the `caused before` clause was attached, strictly\n*before* the event named in the clause.\n\nHowever, unless the event being caused can somehow *cancel* the event that\nit's being caused before, there is no semantic difference between `before`\nand `after` when it comes to \"when\" the event is triggered -- except, as we\nnote here, the ordering guarantee.\n\nSo `before` does not now necessarily mean strictly before the event; it could\nmean after the event, but before any other consequences that are given in\n`after` clauses.\n\nStill, multiple `before` consequences are nondeterministic, so in\n\n    event Bar, caused before Foo;\n    event Baz, caused before Foo.\n\n...after `Foo` happens, it is still not guaranteed that either `Baz \u003e Bar`\nor `Bar \u003e Baz` is true.\n\nPortia\n------\n\n*Portia* is a pre-processor language designed specifically for β-Juliet\nversion 1.0.  It is solely concerned with expanding parameterized events\ninto series of concrete events, for example creating events `DominoOneFalls`,\n`DominoTwoFalls`, etc., from the generalized event schema\n`Domino(N=Domino)Falls` where `Domino` is an _alphabet_ over the range of\ndominoes.\n\nThis mechanism (in fact, an extended form of it) is included in version 2.0\nof the β-Juliet language itself, so no pre-processor is needed for it.\n\nComputational Power\n-------------------\n\nThe state space of a system described in β-Juliet version 1.0 is always\nfinite, so β-Juliet version 1.0 cannot be Turing-complete.  The state space\nof a system described using Portia and β-Juliet version 1.0 may be much,\nmuch bigger than one described using just β-Juliet version 1.0, but it is\nstill finite.\n\nSince β-Juliet version 2.0 allows unbounded sets of events to be described,\nit is more likely that it is Turing-complete.\n\nPatterns\n--------\n\nβ-Juliet version 2.0 introduces _event patterns_.  When the name of an event\nis given by a string of symbols, some of those symbols may actually be\n_parameters_ which act something like wildcards.  Each parameter ranges over\na specified _alphabet_.  When an event occurs which matches the name of an\nevent, the parameters in that name are bound to the literal symbols in the\noccurring event.  These bound parameters may then be used in substitutions in\nthe consequences.\n\nFor example, if we have an alphabet called `Animal` that consists of the\nsymbols `Dog` `Cat` `Ferret`, we can have an event `(X=Animal) Licks Itself`\nwhich has, as a consequence, `(X) Becomes Clean`.  Here `X` is a parameter.\nThis event will happen should some other event cause `Cat Licks Itself`, and\nin this case, `X` will be bound to `Cat`, and this event will thus\nsubsequently cause the event `Cat Becomes Clean`.\n\nModifiers\n---------\n\nUnlike events, alphabets are ordered.  Each symbol (except the first) in an\nalphabet has one and only one _predecessor_, and each symbol (except the last)\nhas one and only one _successor_.\n\nSo the range of symbols in an alphabet is bounded.  However, when considering\na string of symbols (which I'll call a _symbol-string_), such as the name of\nan event, we can use lexicographic ordering to concoct something resembling\nPeano arithmetic to generate an unbounded sequence of symbol-strings, so long\nas each symbol in a string is in the same alphabet.\n\nThus, for some alphabet, every symbol-string has one and only one successor.\nAgain, though, there is one symbol-string which has no predecessor — the\nsymbol-string which is one symbol long, where that symbol is the first symbol\nof the alphabet.\n\nThese concepts are implemented in β-Juliet version 2.0 with _modifiers_.\nWhen a parameter is named in a consequence, it is replaced by the value it is\nbound to, and this can be altered by one of the following modifiers:\n\n* `next` — assuming the value is a single symbol, use the next symbol\n  in its alphabet instead;\n* `prev` — assuming the value is a single symbol, use the previous symbol\n  in its alphabet instead;\n* `succ` — assuming the value is a symbol-string, use the successor\n  symbol-string over its alphabet;\n* `pred` — assuming the value is a symbol-string, use the predecessor\n  symbol-string over its alphabet instead.\n\nNote that all of these modifiers (except `succ`) can fail.  In this case,\nan alternate or `failure-mode` modifier or symbol can be given, and this\nwill be used instead.\n\nExtended Grammar\n----------------\n\nThe grammar for β-Juliet version 2.0 builds on the productions from\nversion 1.0, while replacing or adding the following productions.\n\nFirst, it allows alphabets as well as events to be declared.  It also\nexplicitly reserves syntax for implementation-specific pragmas and\nsystem events (but does not define the meaning of any of these itself.)\n\n    Decl          ::= Pragma | Alphabet | Event.\n    Pragma        ::= \"pragma\" \u003c\u003c\u003cimplementation-specific\u003e\u003e\u003e.\n    Alphabet      ::= \"alphabet\" AlphabetName {\",\" Symbol}.\n    AlphabetName  ::= Symbol.\n\nIt extends the `causes` syntax to include specifying a duration as part\nof it, using the `after` keyword.  The `duration` syntax is still supported;\nif it is given as a property of an event, the duration specified in it will\nbe applied to all `causes` clauses on the event which do *not* include their\nown `after` delay.\n\nNote also that `caused` clauses do not support an `after` delay.\n\n    Causes        ::= \"causes\" EventAppl [\"after\" TimeSpec] {WhenTerm}.\n\nLastly, it significantly extends the syntax for declaring, and using, an\nevent, to include multi-symbol events and event patterns.\n\n    EventDecl     ::= EventDeclComp {EventDeclComp}.\n    EventDeclComp ::= Symbol | \"(\" ParamName \"=\" MatchExpr \")\".\n    ParamName     ::= Symbol.\n    MatchExpr     ::= AlphabetName [\"+\"].\n\n    EventAppl     ::= EventApplComp {EventApplComp}.\n    EventApplComp ::= SymbolName | \"(\" AlphabetExpr \")\".\n\n    AlphabetExpr    ::= AlphabetTerm {\"|\" AlphabetTerm}.\n    AlphabetTerm    ::= \"succ\" ParamName\n                      | \"pred\" ParamName\n                      | \"next\" ParamName\n                      | \"prev\" ParamName\n                      | \"first\" AlphabetName\n                      | \"last\" AlphabetName\n                      | SymbolName\n                      .\n\nExtra conditions, however, are placed on `caused by` clauses.  Both the name\nof the event which is the cause, and the name of the event which is being\ncaused, must be literal symbol strings, not patterns.\n\nImplementations\n---------------\n\nThere is a crude implementation of β-Juliet version 1.0 in the form of a\nPerl 5 script.  It does not implement delays, but it does implement the\nordering guarantees between `caused before` and `caused after`.\n\nThe reference implementation of β-Juliet version 2.0, called `2iota`, is\nwritten in C.  It implements delays (when compiled as ANSI C they have\nsecond granularity; when compiled as C99 with POSIX, they have millisecond\ngranularity.)  It does not yet, however, properly implement the ordering\nguarantees between `caused before` and `caused after` clauses; nor does it\nparse `immediately`.\n\nHistorical Note\n---------------\n\nIn 2012 I decided that the languages β-Juliet and 2Iota are really too similar\nto be seperate languages.  So, as of this repo, they've been merged like this:\n\n* This language is called β-Juliet (a.k.a. beta-Juliet).\n* The language previously referred to as β-Juliet is now β-Juliet 1.0.\n* The language previously referred to as 2Iota (plus minor modifications) is\n  now β-Juliet 2.0.\n* The reference interpreter for β-Juliet 2.0 is called `2iota`.\n* The file extension of a β-Juliet source file is typically `.bj`,\n  although you may see `.2i` used as well.  The latter suggests that\n  the source relies on features only in version 2.0.\n* The optional pre-processor for β-Juliet 1.0 is still called Portia.\n  Portia is not needed with β-Juliet 2.0, and may or may not work with it; I\n  don't know yet.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatseye%2Fbeta-Juliet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatseye%2Fbeta-Juliet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatseye%2Fbeta-Juliet/lists"}