{"id":18374931,"url":"https://github.com/grieferatwork/deemon","last_synced_at":"2025-04-06T20:30:48.287Z","repository":{"id":37934498,"uuid":"143714050","full_name":"GrieferAtWork/deemon","owner":"GrieferAtWork","description":"Deemon Programming Language (v200+)","archived":false,"fork":false,"pushed_at":"2024-04-13T19:35:10.000Z","size":29511,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-13T23:55:45.228Z","etag":null,"topics":["c","compiler","deemon","interpreted-programming-language","interpreter","language","programming-language","regex","scripting-language","sequence","unicode"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GrieferAtWork.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}},"created_at":"2018-08-06T10:38:15.000Z","updated_at":"2024-04-19T12:30:33.898Z","dependencies_parsed_at":"2024-01-13T17:39:47.990Z","dependency_job_id":"a647ba19-cea0-4d54-8e4c-d2fd38b96945","html_url":"https://github.com/GrieferAtWork/deemon","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/GrieferAtWork%2Fdeemon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrieferAtWork%2Fdeemon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrieferAtWork%2Fdeemon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrieferAtWork%2Fdeemon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GrieferAtWork","download_url":"https://codeload.github.com/GrieferAtWork/deemon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247547073,"owners_count":20956481,"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","compiler","deemon","interpreted-programming-language","interpreter","language","programming-language","regex","scripting-language","sequence","unicode"],"created_at":"2024-11-06T00:16:42.372Z","updated_at":"2025-04-06T20:30:48.274Z","avatar_url":"https://github.com/GrieferAtWork.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deemon - Deemon scripting language\n\n[![Linux](https://github.com/GrieferAtWork/deemon/actions/workflows/linux.yml/badge.svg)](https://github.com/GrieferAtWork/deemon/actions/workflows/linux.yml) [![Windows (x32)](https://github.com/GrieferAtWork/deemon/actions/workflows/windows-x32.yml/badge.svg)](https://github.com/GrieferAtWork/deemon/actions/workflows/windows-x32.yml) [![Windows (x64)](https://github.com/GrieferAtWork/deemon/actions/workflows/windows-x64.yml/badge.svg)](https://github.com/GrieferAtWork/deemon/actions/workflows/windows-x64.yml)\n\nDeemon is a scripting language with a syntax inspired by C and other languages derived from C, whilst featuring a python-like runtime.\n\n```\nimport * from deemon;\n\nprint \"Deemon is totally rad, right?\";\nprint \"\u003e \",;\nlocal l = File.stdin.readline().strip().lower();\nif (l in { \"y\", \"yes\" }) {\n\tprint \"Thank you! :D\";\n} else if (l in { \"n\", \"no\" }) {\n\tprint \"Aww... You're hurting my feelings :(\";\n} else {\n\tprint \"Huh?\";\n}\n```\n\nDeemon is designed with the following features in mind:\n- Being portable to any Unix-like operating system (obviously including Linux), as well as Windows\n- Working with, and processing data via sequences and sequence proxies, rather than individually or by always creating new list objects\n- Being faster than python while still offering similar runtime functionality (mainly by not having a GIL, a more powerful instruction set, and using static symbol resolution, rather than having locals/globals be runtime hash-mappings)\n\n\n## Building\n\n**NOTICE**: Deemon uses git submodules (which are required to build deemon), so if you use the *download zip* function, you won't end up with everything that goes into building deemon. So in order to clone deemon in its entirety, you must clone this [git](https://git-scm.com/) through use of:\n\n```sh\ngit clone --recursive https://github.com/GrieferAtWork/deemon.git\n```\n\nWith configure  \n```sh\nbash ./configure\nmake -j $(nproc)\n```\n\nCross-compiling deemon (using `/opt/kos/binutils/i386-kos/bin/i686-kos-gcc`)  \n```sh\nbash ./configure --cross-prefix=/opt/kos/binutils/i386-kos/bin/i686-kos-\nmake -j $(nproc)\n```\n\nWith visual studio  \n\n- Open `/.vs/deemon-{PlatformToolset}.sln`\n\t- Select whichever `PlatformToolset` you have installed\n\t- Deemon *should* be able to compile for any toolset, but sadly there's no way to just tell VS to \"use whatever you have installed\"\n- Select your preferred build configuration and architecture\n- `CTRL+SHIFT+B`\n\n\n\n## Features\n\n### Core syntax features\n\n- Modular code design with one script able to import another script's globals\n- Sequences anywhere: anywhere expressions appear as `,`-separated lists, it's possible to use a sequence as `seq...`, causing its elements to appear as distinct elements. E.g. to concat two sequences, do `{ a..., b... }`\n- Object-oriented programming and classes\n\t- Polymorphism\n\t- Type inheritance, and multiple base classes\n\t- Member functions and properties (getsets)\n\t- Private and public members\n\t- User-defined constructors and destructors\n\t- User-definable operators\n- All of your usual C-like statements/expressions\n- Co-routines (aka. \"yield\"-functions)\n- Generator expressions (`x = for (local elem: y) if (elem) elem + 1;`)\n- Java-like lambda functions (`list.sort(key: e -\u003e e.casefold())`)\n- Type annotations (`local x: {string: int} = Dict();`)\n- Exceptions and try-catch/finally\n- With-statements (`with (lock) { ... }`)\n- GCC-style statements-in-expressions (`local x = ({ local y = 10; y + 20; });`)\n- Optionally assigned variables (`local x; if (y) { x = 10; } print x is bound;`)\n- Default/optional/keyword arguments in functions (`function foo(x, y = 10, z?) {} foo(1, z: \"Hello\");`)\n- ...\n\n### Core runtime library\n\n- Full Unicode support (`assert \"²\".asnumeric() == 2`)\n\t- Fully featured string API (for doing anything you might think of)\n\t- Built-in regular expression support\n- Infinite-precision integers\n- Sequence, Set, and Map-like built-in containers\n\t- Mutable/Immutable sequences (`List` / `Tuple`)\n\t- Mutable/Immutable mappings (`Dict` / `Dict.Frozen`)\n\t- Mutable/Immutable sets (`HashSet` / `HashSet.Frozen`)\n\t- Everything inherits from a common `Sequence` class providing a fully-featured sequence API\n- Everything is reference-counted (automatic cleanup)\n- Modules are compiled on first use and automatically re-compiled if modified\n- Deemon scripts are compiled and executed as bytecode for better performance\n- Full multi-threading support everywhere (everything is thread-safe by default)\n\t- And I mean *real* multi-threading (i.e. deemon doesn't have a GIL)\n- Floating point numbers\n- File/std I/O\n- Dynamic module imports (`local x = \"deemon\"; local y = import(x);`)\n- Execute strings as code (`print exec(\"(a, b) -\u003e a + b\")(10, 20);`)\n\n### Extended runtime library\n- Modules are either native shared libraries (`.so` or `.dll`), or deemon scripts (`.dee`)\n- Modules for:\n\t- Extra sequence types (`collections`)\n\t- Interfacing with C functions and native system libraries (`ctypes`)\n\t- Disassembling deemon bytecode (`disassembler`)\n\t- System APIs (`fs`, `posix`, `win32`)\n\t- Spawning and controlling sub-processes (`ipc`)\n\t- Mathematic functions like `sin`, `cos`, etc. (`math`)\n\t- Low-level networking and sockets (`net`)\n\t- Extra threading functionality like locks and TLS variables (`threading`)\n\t- Timestamps and time deltas (`time`)\n\t- Interfacing with doc strings and other RTTI (`doc`, `doctext`, as well as `/util/doc-server.dee`)\n\t- ...\n\nCode examples can be found in */util/tut*\n\n\n\n\n## Comparison with deemon100+\n\n\n### Major improvements\n\n- Introduction of a module-based dependency system that allows code reuse without relying on preprocessor functionality that really didn't fit a scripting language all too well.\n- With more emphasis on documentation, deemon now comes shipped with a documentation server accessible via web-browser\n\t- It should be noted that the documentation server, as well as the RTTI parser are written entirely in deemon.\n\t- Links listed below require this server to be running locally.\n- A complete overhaul of the builtin [`string`](http://localhost:8080/modules/deemon/i:string) type\n\t- Full unicode support all packed together into a single string type\n\t- Separation between raw data [`Bytes`](http://localhost:8080/modules/deemon/i:Bytes) and [`string`](http://localhost:8080/modules/deemon/string)s, as well as functionality to decode/encode data and strings\n\t- Builtin support for regular expressions\n\t- Addition of miscellaneous functions such as [`indent()`](http://localhost:8080/modules/deemon/i:string/i:indent) or [`findmatch()`](http://localhost:8080/modules/deemon/i:string/i:findmatch) to help in situation where the old string type was struggling\n\t- Addition of case-insensitive variants of many functions, such as [`casefind()`](http://localhost:8080/modules/deemon/i:string/i:casefind)\n- Introduction of a common base class for any [`Sequence`-like type](http://localhost:8080/modules/deemon/i:Sequence)\n\t- Includes emulation of any kind of sequence operator, as well as a huge set of member functions, including [`find()`](http://localhost:8080/modules/deemon/i:Sequence/find), [`sum()`](http://localhost:8080/modules/deemon/i:Sequence/sum), [`operator add`](http://localhost:8080/modules/deemon/i:Sequence/op:add) or comparisons\n\t- Also introduced are common base classes for set-like, and mapping-like objects\n- Introduction of ASP (Abstract Sequence Proxy)-like objects to allow for lazy computation in functions like [`string.split()`](http://localhost:8080/modules/deemon/i:string/i:split), distributing work load across usage and essentially making such functions O(1) when invoked\n- Introduction of default, optional, and named function arguments\n\t- `function foo(a, b = 10, c?)`\n\t\t- `foo(\"Hello\")` Called as `foo(a: \"Hello\", b: 10, c: /unbound/)`\n\t\t- `foo(\"Hello\", \"World\")` Called as `foo(a: \"Hello\", b: \"World\", c: /unbound/)`\n\t\t- `foo(\"Hello\", c: \"Universe\")` Called as `foo(a: \"Hello\", b: 10, c: \"Universe\")`\n- Introduction of a same-object / different-object operators `===` and `!==`\n- Introduction of a new syntax for constructing a [super-view](http://localhost:8080/modules/deemon/i:Super) `foo as Sequence`\n- Introduction of a new syntax for checking if variables or attributes are bound `if (x is bound) print x;`\n- Introduction of `with`-statements, useful when dealing with files or locks\n\t- To go alongside, 2 new operator `operator enter()` and `operator leave()` were introduced\n- Introduction of an interactive excution mode `deemon -i` where code is executed, and results are printed in real time\n- Introduction of a `deepcopy` keyword and operator to go alongside the `copy` keyword\n\t- Also includes automatic tracking of recursive objects such as a list containing itself.\n- Added support for raw string literals `r\"the following are 2 seperate characters: \\n\"`\n- Overhaul of exception handlers in user-code now introduces zero-effort exception and finally handlers (as opposed to having a stack of active handlers)\n- Overhaul of user-classes which now require member variables to also be declared, significantly improving runtime performance\n- Lazy compilation of module source files into pre-compiled file caches improves load time significantly\n- Extremely powerful peephole optimization of generated bytecode\n- The bytecode generated by deemon has grown so powerful that you can actually write code using it, or have it be printed back to you by a powerful, builtin disassembler (try `deemon -S lib/doc.dee`)\n\t- If you look at it, it really has more in common with that of a CISC architecture, featuring admirable text compression rates, while still executing assembly as fast as possible\n- Added compiler warnings for various questionable cases (including use of reserved keywords as symbol names)\n- I actually took the time to write a copy of the entire interpreter in i386 assembly (by hand), providing a significant performance boost on 32-bit Intel machines.\n- The builtin [`int`](http://localhost:8080/modules/deemon/i:int) type can have arbitrary precision now, allowing operations with a practically infinite number of digits (though I'm not claiming credit for the implementation; only for the integration and new design centered around it)\n- Introduction of type annotations\n\t- `function add(x: int, y: int): int`\n\t- Mainly intended for simplified and less redundant documentation, but may also be used for other purposes\n- Addition of runtime functionality to execute strings as code\n\t- `print ([exec from deemon](http://localhost:8080/modules/deemon/i:exec))(\"10 + 20\");`\n\t- Uses a seperate JIT compiler that directly executes source text, rather than having to preprocess, parse, assembly and link, before finally executing code.\n\n\n### Noteworthy changes and fixes\n\n- Inplace operators now have significantly different operation protocols than regular operators (`x += y;` is emulated as `x = x + y;` at runtime when no inplace operator exists)\n\t- As a result of this, strings and other immutable types will appear as though they can be used in inplace operations, when in reality they can't.\n\t- As a consequence of this, r-values (such as function return values) cannot be used in inplace operations\n- The builtin [`int`](http://localhost:8080/modules/deemon/i:int) type is now immutable, meaning that use of integers no longer requires seemingly out of place `copy` statements when passing around integers, or having to create copies when loading them as constants.\n- Classes now require the user to declare member variables (also: I actually implemented a syntax for super-initialization in constructors)\n- Introduction of new symbol classes for extern (aka. imported) and global (aka. exported) objects\n\t- Global variables are created when defining a symbols without a `local` prefix in the global scope, or when explicitly prefixed with `global`\n\t- Global variables (symbols) can be modified by other modules or functions without the need of placing their values inside of a cell (as was, and is still required for local variables referenced in inner functions, or lambda expressions)\n\t- Symbol and module import works the same way it does in python, in addition to allowing you to write either `import symbol from module` or `from module import symbol`.\n\t- Additionally, anywhere a variable can appear, you can also write `foo from bar` which will reference a symbol `foo` from a module `bar` without you having to explicitly import that symbol beforehand.\n- New style guidelines discourage the use of underscores in symbol names (e.g. it's [`seq.nonempty`](http://localhost:8080/modules/deemon/i:Sequence/i:nonempty) now, instead of [`seq.non_empty()`](http://localhost:8080/modules/deemon/i:Sequence/i:non_empty), which is deprecated)\n- New style guidelines discourage the use of functions for state checks, or alternate representations (e.g. it's [`Thread.hasstarted`](http://localhost:8080/modules/deemon/i:Thread/i:hasstarted) now, instead of [`Thread.started()`](http://localhost:8080/modules/deemon/i:Thread/i:started), which is deprecated)\n- Builtin types such as [`List`](http://localhost:8080/modules/deemon/i:List) or [`Dict`](http://localhost:8080/modules/deemon/i:Dict) must now be `import * from deemon;`-ed before they appear as symbols\n- The builtin type [`Set`](http://localhost:8080/modules/deemon/i:Set) has been renamed to [`HashSet`](http://localhost:8080/modules/deemon/i:HashSet). [`Set from deemon`](http://localhost:8080/modules/deemon/i:Set) is now the base-class for set-like objects\n\t- Shouldn't really cause any problems in old code though, because deemon 100+'s `Set`-type has always been broken, and never got fixed\n\t- That said, the builtin `Set` object (now called [`HashSet`](http://localhost:8080/modules/deemon/i:HashSet)) actually works\n- Not every object can be weakly referenced, and instead of a dedicated keyword `weak`, [`WeakRef from deemon`](http://localhost:8080/modules/deemon/i:WeakRef) is used to construct weak references\n- Single-element [Tuples](http://localhost:8080/modules/deemon/i:Tuple) can now be constructed as `(foo,)`\n- While deemon 100's compiler configuration handled pretty much any syntax problem as a warning, deemon 200 is default-configured to produce errors, thus preventing faulty code from accidentally being executed\n\n\n### Noteworthy maintained features (that will stay)\n\n- Inplace source formatting `deemon -F`\n- `pack`-expressions to omit parenthesis (`foo pack 10, 20` is the same as `foo(10, 20)`)\n- A fully featured C preprocessor (it's a highly advanced version of tpp, including all of its extensions)\n- The `__nth` keyword being used to select secondary variable matches.\n\n\n### Deprecated features (discouraged usage, but continued maintainance for now)\n\n- `#include \u003c...\u003e` You really shouldn't be including files any more. - Use modules instead (they're way better)\n- Various minor syntax changes to steer usercode to being more uniform (warned about in new code; ignored in legacy code)\n- The dedicated syntax for cells (`\u003cfoo\u003e` is deprecated and very much discouraged)\n\t- Use [`Cell from deemon`](http://localhost:8080/modules/deemon/i:Cell) instead.\n\t- Also note that with the introduction of global variables, cell indirection is no longer required in most cases\n\n\n### Dropped features\n\n- C-emulation of `struct`, `extern`, `union`, etc.\n\t- The runtime-aspect is still available through [ctypes](http://localhost:8080/modules/ctypes), however no longer has a dedicated syntax\n\t- Maintained C-like features that won't go away:\n\t\t- C-like casts `(int)x` (same as `int(x)`)\n\t\t- C-like variable declarations `int x = y;` (same as `local x = int(y);`)\n\t\t- Struct-initializers in mappings `Dict { .x = \"foo\" }` (same as `Dict { \"x\": \"foo\" }`)\n- `alias`-symbol declarations no longer exist\n- `const`-symbol declarations no longer exist (optimization automatically detects `local` / `global` variables written only once as constant, and you can use `final` to enforce write-once behavior)\n- `operator ! ()` has been removed, and `!foo` invokes `operator bool()` and logically inverts its result (`!foo` is the same as `foo ? false : true`)\n- The `operator move()` constructor has been removed, as well as the `move` keyword (emulated with sightly different semantics for legacy code; see below)\n\t- Note however that `operator move := ()` (move-assign) hasn't been removed\n- Removed the logical XOR operator `^^` (just cast both operands to bool, then use the regular XOR)\n\n\n### Dropped features that are emulated in legacy code\n\nLegacy code being detected by it #including any of the old headers\n\n- C-like syntax for attributes `__attribute__((attrib))`, `__declspec(attrib)`, `[[attrib]]`\n\t- Deemon 200 relies less than ever on attributes, and where they are still needed, tags are used `@[attrib]`\n- The millions of `__builtin*` functions have all been removed\n\t- Most notable, even `__builtin_object()` is emulated\n- The `move` keyword is defined as an alias for `copy`\n- Removed the `weak` keyword\n- Various keywords that all start with 2 underscores (`__static_if`, `__if_true`, etc.)\n- The old notion of modules no longer exist (The `module` keyword was removed, and the `import` keyword now has a different meaning)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrieferatwork%2Fdeemon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrieferatwork%2Fdeemon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrieferatwork%2Fdeemon/lists"}