{"id":13466255,"url":"https://github.com/dino-lang/dino","last_synced_at":"2025-03-25T21:32:09.983Z","repository":{"id":32932564,"uuid":"36528464","full_name":"dino-lang/dino","owner":"dino-lang","description":"The programming language DINO","archived":false,"fork":false,"pushed_at":"2019-12-21T19:41:26.000Z","size":29720,"stargazers_count":71,"open_issues_count":9,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-29T19:18:07.414Z","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":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dino-lang.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-29T20:51:13.000Z","updated_at":"2024-09-12T13:19:16.000Z","dependencies_parsed_at":"2022-08-07T18:16:37.669Z","dependency_job_id":null,"html_url":"https://github.com/dino-lang/dino","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/dino-lang%2Fdino","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dino-lang%2Fdino/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dino-lang%2Fdino/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dino-lang%2Fdino/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dino-lang","download_url":"https://codeload.github.com/dino-lang/dino/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245548164,"owners_count":20633528,"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":"2024-07-31T15:00:41.592Z","updated_at":"2025-03-25T21:32:05.677Z","avatar_url":"https://github.com/dino-lang.png","language":"C","funding_links":[],"categories":["C","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Programming language Dino and its implementation\n\n### Develepment version of future release 0.98\n\n### Vladimir Makarov, vmakarov@gcc.gnu.org\n\n### Apr 2, 2016\n\n# Description Layout\n* Introduction to Dino\n    * History\n    * Dino as a high-level scripting language\n    * Dino as a functional language\n    * Dino as an object-oriented language\n* Dino Implementation\n    * Overall Structure\n        * Used implementation tools\n        * Byte code compiler (optimizations)\n        * Byte code Interpreter (GC, Concurrency, REPL)\n        * JIT, Type inference\n  * Performance comparison with Python, PyPy, Ruby, JS, Scala, OCAML\n    on x86-64, AARH64, ARM, PPC64.\n\n---\n\n# Some history\n* 1993: Original language design and implementation ![Dino logo](Dino.jpg \"Dino logo\")\n    * Was used in russian computer game company ANIMATEK as a simple\n      scripting language for describing dinosaurus movements\n* 1998, 2002, 2007, 2016 : Major language and implementation revisions\n* This document describes the current state of Dino language and\n  its implementation.\n\n# The first taste of Dino\n  * Eratosthenes sieve:\n\n```\n      var i, prime, k, count = 0, SieveSize = 8191, flags = [SieveSize : 1];\n      for (i = 0; i \u003c SieveSize; i++)\n        if (flags[i]) {\n          prime = i + i + 3;\n          k = i + prime;\n          for (;;) {\n            if (k \u003e= SieveSize)\n              break;\n            flags[k] = 0;\n            k += prime;\n          }\n          count++;\n        }\n      putln (count);\n```\n    \n---\n\n# DINO as a scripting language\n* Dino aims to look like C language\n* High-Level scripting object-oriented language:\n    * Multi-precision integers\n    * Heterogeneous extensible arrays, array slices\n    * Associative tables with possibility to delete elements\n    * Powerful and safe class composition operation for (multiple)\n      inheritance and traits description\n    * First class functions, classes, and fibers with closures,\n      anonymous functions, classes, fibers\n    * Exception handling\n    * Concurrency\n    * Pattern matching\n    * Unicode 8 support\n\n\n---\n\n# Arrays and Tables\n* Associative tables\n    * elements can be added and deleted\n    * elements can be any values, e.g. other tables\n    * Implemented as hash tables without buckets for compactness\n      and data locality\n      * Secondary hash for conflict resolutions\n      * Murmur hash function for most values\n\n---\n\n# Array Slices\n* Eratosthenes sieve with slices:\n\n```\n      var i, prime, count = 0, SieveSize = 8191, flags = [SieveSize : 1];\n      for (i = 0; i \u003c SieveSize; i++)\n        if (flags[i]) {\n          prime = i + i + 3;\n          flags[i + prime:SieveSize:prime] = 0;\n          count++;\n        }\n      putln (count);\n```\n\n---\n\n# Functions\n* Example:\n\n```\n      fun even;\n      fun odd  (i) {i == 0 ? 0 : even (i - 1);}\n      fun even (i) {i == 0 ? 1 : odd (i - 1);}\n      putln (odd (1_000_000));\n```\n\n* Anonymous functions:\n\n```\n      filter (fun (a) {a \u003e 0;}, v);\n      fold (fun (a, b) {a * b;}, v, 1);\n```\n\n* Function closures:\n\n```\n      fun incr (base) {fun (incr) {base + incr;}}\n```\n\n---\n\n# Threads\n* Fiber: a function with concurrent execution\n\n```\n      fiber t (n) {for (var i = 0; i \u003c n; i++) putln (i);}\n      t(100); // the following code don't wait for t finish\n      for (var i = 0; i \u003c 1000; i++) putln (“main”, i);\n```\n\n* Implemented as green threads:\n    * Much faster than OS threads with Global Interpreter Lock (Python/Ruby)\n    * Deterministic behaviour and automatic deadlock recognition\n    * Plans to implement through OS threads without GIL for parallelism\n* There is a low level sync-statement wait\n\n```\n      wait (cond) [stmt];\n```\n\n* Simple statements are atomic\n\n\n---\n\n# Object orientation\n* Class is just a special type of function:\n    * Returns closure, public visibility by default\n\n```\n          class num (i) {fun print {put (i);}}\n          class binop (l, r) { fun print_op;\n            fun print {l.print(); print_op (); r.print ();}\n          }\n```\n\n* Special class/function composition:\n    * emulates (multiple) inheritance, traits, and dynamic dispatching\n\n```\n          class add (l, r) {\n            use binop former l, r later print_op;\n            fun print_op {put (“ + “);}\n          }\n```\n\n---\n\n# Object orientation -- continuation\n  * A safe and powerful way to support object orientation\n      * Declarations of class mentioned in **use** are inlayed\n      * Declarations before the use rewrite corresponding inlayed\n        declarations mentioned in **former**-clause\n      * Declarations after the use rewrite corresponding inserted\n        declarations mentioned in **later**-clause\n      * The declarations should be **matched**\n      * The original and new declarations should be **present**\n        if they are in former- or later-clause\n      * The original declaration can be **renamed** and still used\n        instead of just rewriting if necessary\n\n---\n\n# Object orientation -- continuation\n* Special function **isa** to check subtyping of class or object:\n\n```\n      isa (add, binop);\n      isa (add (num (1), num (2)), binop);\n```\n\n* Optimization for removing code duplication\n* Syntactic sugar for a singleton object (it is implemented as\n  anonymous class and corresponding object creation)\n\n```\n      obj int_pair {\n        val min = 0, max = 10;\n      }\n```\n\n---\n\n# Object orientation -- continuation\n* Optimizations for access to object members permit to use\n  objects as **name spaces**\n\n```\n      obj sorts {\n        var compare_fun;\n        fun quick_sort (...) {...}\n        fun heap_sort (...) {...}\n      }\n      ...\n      sorts.fft (...);\n```\n\n* To make access to object more brief an **expose**-clause exists\n* Exposing an object member\n\n```\n      expose sorts.quick_sort;\n      quick_sort (...);\n```\n\n* You can have a member access with a different name\n\n```\n      expose sorts.quick_sort (asort);\n      asort (...);\n```\n\n* You can expose all public declarations of an object\n\n```\n      expose sorts.*;\n      compare_fun = ...; quick_sort (...); heap_sort (...);\n```\n\n---\n\n# Standard spaces\n\n* Dino has 5 standard spaces (singleton objects) avalaible by default\n  to any Dino program\n  * `lang` -- provides interface to fundamental Dino features\n  * `io` -- provides interface for input/output and to work with file system\n  * `sys` -- provides interace to some features of underlying OS\n  * `math` -- mostly provides some mathematical functions\n  * `re` -- provides regular expression matching functions\n  * `yaep` -- provides interface to Yet Another Earley Parser\n* All items in spaces `lang` and `io` are always exposed\n* If you redefine some exposed item, you still can have access to it\n  as a member of the space.\n\n---\n\n# Pattern matching\n* Pattern can be\n  * pattern matching anything `_`\n  * pattern variable matching any value, e.g. `a`\n    * the value is assigned to the variable\n  * **vector pattern** matching vectors, e.g. `[v, _, 5, ...]`\n  * **table pattern** matching tables, e.g. `tab [\"a\": v, ...]`\n  * **object pattern** matching objects of given class or\n    its derived class, e.g. `node (a, 10)`\n  * `...` in a pattern list matching zero or more values\n  * expression which looks different from the above and matches the equal value\n  * pattern can be nested, e.g. `node ([v, ...], 10)`\n* Pattern matching in variable declaration, e.g. `var [a, b, ...] = v;`\n  * `v` should be a vector with at least 2 elements, new declared variables\n    `a` and `b` will hold values of the two first elements\n\n---\n\n# Pattern matching -- pmatch statement\n\n```\n    pmatch (v) {\n      case [...]: putln (\"array\"); continue;\n      case [a, ...]: if (a == 0) break; putln (\"array with non-zero 1st element\");\n      case node (v) if v != 0: putln (\"object of class node with nozero parameter\");\n      case _: putln (\"any but array\");\n    }\n```\n\n  * Try to match value with case patterns in a particular order,\n    execute the corresponding code for the first matched pattern\n  * Scope of pattern variables is the corresponding case\n  * Continue means continue to try subsequent patterns\n  * Break means finish the match statement execution\n    * There is an implicit break at the end of each case\n\n---\n\n\n# Example: classes and functions with pattern matching\n* Simple binary tree and its check:\n\n```\n      class tree {}\n      class leaf (i) {use tree;}\n      class node (l, r) {use tree;}\n```\n\n```\n      fun exists_leaf (test, t) {\n        pmatch (t) {\n          case leaf (v): return test (v);\n          case node (l, r):\n            return exists_leaf (test, l) || exists_leaf (test, r);\n        }\n      }\n```\n\n```\n      fun has_odd_leaf (t) {\n        exists_leaf (fun (n) {type (n) == int \u0026\u0026 n % 2 == 1;}, t);\n      }\n```\n\n# Regular expression matching -- rmatch statement\n\n```\n    rmatch (str) {\n      case \"[a-zA-Z]+\": putln (\"word starting at \", m[0]);\n      case \"[0-9]+\": putln (\"number starting at \", m[0]);\n      case _: putln (\"anything else, m is undefined\");\n    }\n```\n\n  * Try to match string with case regular expressions in a particular order,\n    execute the corresponding code for the first matched regular expression\n  * Implicitly declared variable `m` contains integer vector\n    describing successfully matched sub-string\n  * Scope of variable `m` is the corresponding case\n  * Continue and break statements behave the same way as\n    in pattern match statement\n\n---\n\n# Exception handling\n  * Exceptions are objects of sub-classes of class **except**\n    * Exceptions can be generated by Dino interpreter, e.g. floating point exception\n    * or by *throw*-statement:\n\n```\n            class my_except (msg) {use except;}\n            throw my_except (\"my special exceptions\");\n```\n\n  * Exceptions can be processed by *try*-block or *try*-operator\n    * Exceptions are propagated to previous blocks on the block stack until they are processed\n    * Unprocessed exceptions finish the program execution\n\n# Exception handling -- continuation\n  * *Try-block*\n    * Exception occurring inside the block is processed in the first catch-block\n      whose class mentioned in the catch clauses is a super-class of the processed exception class\n    * The processed exception is in variable *e* implicitly defined in\n      the corresponding catch-block\n    * If there is no matched catch-block, the exception is propagated further\n\n```\n            try {\n              var ln;\n              for (;;) {\n                var ln = getln (); putln (ln);\n              }\n            } catch (eof) { putln (\"end of file\"); }\n```\n\n  * *Try-operator*\n    * The operator returns non-zero if no exceptions occurs in the statement given as the first argument\n    * The operator returns zero if an exception occurs and its class is a sub-class (see *isa*)\n      of one exception class given by the subsequent arguments\n    * If there is no matched argument class, the exception is propagated further\n\n```\n            var ln;\n            for (; try (ln = getln (), eof);) putln (ln);\n```\n\n  * In the previous example, `try (ln = getln (), eof)` can be considered as\n    abbreviation of anonymous function call:\n\n```\n            fun {try {ln = getln (); return 1;} catch (eof) {return 0;} ()\n```\n\n# Earley parser\n* Predefined class for language prototyping:\n    * Fast.  Processing ~400K lines/sec of 67K lines of C program\n      using 26MB memory on modern CPUs\n    * Simple syntax directed translation\n    * Parsing input can be described by ambiguous grammar:\n        * Can produce compact representation of all possible parse trees\n        * Can produce minimal cost parsing tree\n    * Syntax recovery with minimal number of ignored tokens\n      still producing a correct AST\n\n---\n\n# Earley parser -- tiny language example\n\n```\nexpose yaep.*;\nval grammar =\n \"TERM ident=301, num=302, if=303, then=304, for=305, do=307, var=308;\n  program = program stmt                     # list (0 1)\n  stmt = ident '=' expr ';'                  # asgn (0 2)\n       | if expr then stmt else stmt         # if (1 3 5)\n       | for ident '=' expr expr do stmt     # for (1 3 4 6)\n       | '{' program '}'                     # block (1)\n       | var ident ';'                       # var (1)\n       | error\n  expr = expr '+' factor                     # plus (0 2)\n  factor = factor '*' term                   # mult (0 2)\n  term = ident                               # 0\n       | '(' expr ')'                        # 1\";\nval p = parser ();       // create an Earley parser\np.set_grammar (grammar); // set grammar\nfun syntax_error;        // forward decl of syntax error reporting func\nval asbtract_tree = p.parse (token_vector, syntax_error);\n```\n\n---\n\n# Implementation -- General Structure\n![Dino Flow](Dino_Flow.png \"Dino Flow\")\n\n* In usual mode, all program files are processed.\n* In REPL mode, a statement goes all processing.\n* All program Byte Code (Bcode) can be saved in a readable form,\n  modified, and read for execution.\n* Function level JIT is implemented with the aid of C compiler.\n* The program can use object files created from a C code\n  (through Foreign Function Interface).\n\n---\n\n# Implementation -- Byte Code\n* Byte Code (Bcode) consists of\n    * Declarations\n        * vdecl (variable)\n        * fdecl (functions, classes, fibers)\n    * Multi-operand instructions\n        * Operations (1-5 ops, usually 3-ops)\n        * Control flow insns (blocks, branches, calls etc)\n* 2 Bcode representations:\n    * one in memory (for execution)\n    * readable representation (can be modified manually)\n\n---\n\n# Implementation -- Byte Code example\n* Dino code\n\n```\n      var i, n = 1000;\n      for (i = 0; i \u003c n; i++);\n```\n\n* Readable BCode representation:\n\n```\n      0 block fn=\"ex.d\" ln=1 pos=1 next=730 vars_num=29 tvars_num=3 // ident=\n      ...\n      372 vdecl fn=\"ex.d\" ln=1 pos=5 ident=i ident_num=268 decl_scope=0 var_num=27\n      373 vdecl pos=8 ident=n ident_num=269 decl_scope=0 var_num=28\n      ...\n      788 ldi fn=\"ex.d\" ln=1 pos=12 op1=28 op2=1000 // 28 \u003c- i1000\n      789 ldi ln=2 pos=10 next=791 op1=27 op2=0 // 27 \u003c- i0\n      790 btltinc pos=15 next=792 op1=27 binc_inc=1 bcmp_op2=28 bcmp_res=29 pc=790\n                                          // goto 790 if 29 \u003c- (27 += i1) cmp 28\n      791 btlt pos=15 op1=27 bcmp_op2=28 bcmp_res=29 pc=790 // goto 790 if 29 \u003c- 27 cmp 28\n      792 bend pos=17 block=0\n```\n\n---\n\n# Implementation -- BC optimizations\n* Optimizations\n    * High-level dead code elimination\n    * Jump optimization\n    * Call tail optimization\n    * Inlining\n    * Pure function optimization\n    * Byte code combining (this is just an illustration, the readable\n      BCode representation has a bit different format -- see the previous slide)\n\n```\n            label: addi op1, op1, i1; lt res, op1, op2; bt res, label =\u003e\n            label: addi op1, op1, i1; blt res, op1, op2, label =\u003e\n            label: btltinc op1, op2, i2, res, label\n```\n\n---\n\n# Implementation\n* Fast optimizing interpreter\n* Memory Handling and Garbage Collection:\n    * Automatically extended heap\n    * Simple escape analysis to transform heap allocations into stack ones\n    * Combination of Mark and Sweep and fast Mark and Copy algorithm\n      permitting to decrease program memory requirement\n\n\n\n---\n\n# Implementation -- Continuation\n* JIT\n    * Function Level for functions marked by hint (! jit)\n\n```\n            fun fact (n) !jit {n \u003c=1 ? 1 : n * fact (n - 1);}\n```\n\n* JIT details:\n    * Triggered by the first call\n    * Portable implementation through C code generation\n        * memory file system is used (can be persistent memory in future)\n        * option --save-temps can be used for the C code inspecting\n    * Usage of the same code as interpreter to simplify implementation\n        * C code generator is less 100 lines on C\n        * a script used to minimize the code (about 1/10 of C code\n          interpreter definitions are used for generated code.)\n    * Small function code generation takes about 50-70ms\n      using GCC on modern Intel CPUs\n\n\n---\n\n# Implementation -- Type Inference\n* Dino is dynamic type programming language\n* Still many types of operations can be recognized during compilation time:\n    * E.g. general Bcode **add** can be changed by **iadd** (integer variant)\n      or **fadd** (floating point variant) which are executed\n      without operand type checking\n* Type recognition (inference) is very important for better\n  object code generation, **especially for JIT**\n    * It can speed up code in many times\n\n\n---\n\n# Implementation -- Type Inference 2\n* Major steps:\n    1. Building **CFG** (control flow graph) of **all program**:\n       basic blocks and CFG edges connecting them\n    2. Calculating **available** results of Bcode insns -- a forward\n       data-flow problem on CFG\n    3. Using the availability, building **def-use chains** connecting\n       operands and results of Bcode insns and variables\n    4. Calculating types of Bcode insn operands and results -- another\n       forward data flow problem on the built def-use graph\n    5. Changing Bcode insns on specialized ones, e.g. **add** on **iadd**\n\n\n---\n\n# Implementation -- Type Inference 3\n* Major complications:\n    * Higher order functions\n    * Closures\n    * Threads\n    * Possible use of variable (undefined) value before assigning a value to it\n* Therefore we don't recognize all types theoretically possible to recognize\n* Recognizing types of variable values even if the variable changes\n  its type -- difference to type inference in static type languages\n\n\n---\n\n# Implementation -- Tools and libraries\n* Dino is implemented with COCOM tools\n    * SPRUT - compiler of IR object oriented description.  Used for\n      implementation of semantic IR, Bcode and run-time data.\n      In debugging mode, it permits to check all described constraints and relations\n    * MSTA - faster superset of YACC with better error recovery\n    * SHILKA - fast keyword recognizer generator\n    * AMMUNITION - different packages (source position handling, error reporting,\n      Earley parser etc)\n* GMP - multi-precision integer library\n* Oniguruma regexp library (version 6.0.0)\n\n---\n\n# Implementation -- Profiling\n* Typical performance tuning: Profiling: dino -p meteor.d\n\n```\n      ** Calls *** Time **** Name **************************************\n        761087     0.43  --  search1: \"meteor.d\": 229\n        561264     0.07  --  ctz: \"meteor.d\": 28\n          1260     0.01  --  GoodPiece: \"meteor.d\": 37\n           ...\n                   0.51  --  All Program\n```\n\n* Adding hints: !inline for ctz and !jit for search1\n\n```\n      ** Calls *** Time **** Name **************************************\n        761087     0.15  --  search1: \"meteor.d\": 229\n           ...\n             0     0.00  --  ctz: \"meteor.d\": 28\n           ...\n                   0.17  --  All Program\n```\n\n---\n\n# Implementation -- C Interface\n* Dino has declarations to describe C functions and variables external\n  to Dino programs. For example, the following describes external\n  variable `v` and function `f`\n\n```\n      extern v, f ();\n```\n\n* The variable `v` in C code will be of type `val_t`.  The function\n  `f` in C code will have teh following prototype\n\n```\n      val_t f (int npars, val_t *args);\n```\n\n* The file `d_api.h` provides C descriptions of Dino internals (the\n  type `val_t`, functions to create vectors, tables etc).  The file is\n  generated from SPRUT description `d_extern.d`\n* The external C code is responsible for providing correct Dino\n  values\n* There are two ways to use C code: *pre-compiled* and *compiled on the\n  fly*\n\n---\n\n# Implementation -- C Interface 2\n* C code for *pre-compiled* way should look like\n\n```\n      #include d_api.h\n      ...\n      val_t v;\n      ...\n      val_t f (int n_pars, val_t *args) {\n        ER_node_t first_arg = (ER_node_t) \u0026args[0];\n        if (npars == 1 \u0026\u0026 ER_NODE_MODE (first_arg) == ER_NM_int)\n\t  \u003cdo something with integer value\u003e ER_i (first_arg);\n\t...\n      }\n```\n\n* External variables and functions in C code preliminary compiled\n  as *shared objects* can be used if Dino knows where the objects are located\n    * The option `-L` provides such knowledge.  For example, options\n      `-L/home/dino/obj1.so -L../obj2.so` says Dino to load the shared\n      objects\n    * Externals will be searched in some standard objects first, then in\n      objects provided by options `-L` in the same order as they stay on\n      the command line\n* A standard Dino external C code in file `d_socket.c` from Dino\n  sources can be used as an example of pre-compiled C code\n\n---\n \n# Implementation -- C Interface 3\n* C code *compiled on the fly* looks in Dino code like\n\n```\n      %{\n        ...\n        val_t f (int n_pars, val_t *args) {\n          ...\n        }\n      %}\n      extern f ();\n      val r = f(10);\n```\n\n* All C code between pairs of brackets `%{` and `%}` in one Dino file\n  is *concatenated*\n* The result code with pre-appended code from `d_api.h` is compiled\n  when the execution the first time achieves the location of the first\n  `%{`\n* The result shared object is loaded and external variables and\n  functions are searched lately also in this object as it was\n  described in pre-compiled C code\n* To check all C code before execution you can use option `--check`\n\n---\n\n# Code Metrics\n* `sloccount` output as of 2/18/2016 for Dino + tools:\n\n```\n\tTotals grouped by language (dominant language first):\n\tsh:          265452 (54.10%)\n\tansic:       194472 (39.64%)\n\tyacc:         23297 (4.75%)\n\tcpp:           7403 (1.51%)\n```\n\n* Dino directory only:\n\n```\n\tTotals grouped by language (dominant language first):\n\tsh:          161561 (62.13%)\n\tansic:        95124 (36.58%)\n\tyacc:          3365 (1.29%)\n```\n\n---\n\n# Benchmarking -- Programs\n* Some old computer language shootout benchmarks:\n    * loop - empty loop body\n    * hash - associative tables\n    * fact, fib - factorial and fibonacci (recursive functions with and\n      without tail recursion)\n    * exceptions, methods, objects - exception processing, object method calls,\n      and object instantiations\n    * sieve, sort - Eratosthenes sieve and heapsort (array benchmarking)\n    * statistics, random - statistical moments and random number generator\n     (general arithmetic)\n    * threads (producer-consumer threads)\n    * startup - compilation and execution of empty program\n    * compile - very long code of assignments\n\n---\n\n# Benchmarking -- Languages and CPUs\n* Benchmarking on x86-64 (i5-4670 - 3.4GHz Haswell), AARCH64 (X-gene),\n  ARM (Exynos 5410 - 1.6GHz Cortex-A15), PPC64 (3.5GHz power7) and comparison with:\n    * Other interpreters (Python-3.4.x, Ruby-2.1.x)\n    * Different JITs (PyPy-2.2.x - trace JIT for Python, JavaScript-1.8.x\n      - SpiderMonkey/TraceMonkey, Scala-2.10.x - JVM)\n    * Byte code compiler and interpreter (OCAML-4.0.x)\n* Dino compilation and execution time is a **base** in the comparison\n\n\n---\n\n# Benchmarking -- x86-64\n\n|       |Loop   |Hash|Fact   |Fib    |Except|Method|Object|Sieve|Sort   |Stat.|Random |Thread|Start|Compile|\n:-------|------:|---:|------:|------:|-----:|-----:|-----:|----:|------:|---: |------:|-----:|----:|------:|\nDino[^1]|1.0[^2]|1.0 |1.0[^3]|1.0[^3]| 1.0  |1.0   |1.0   | 1.0 |1.0[^2]|1.0  |1.0[^4]|  1.0 | 1.0 |  1.0  |\nDino    | 19    |1.0 |13.2   |112    | 1.0  |1.0   |1.0   | 1.0 | 1.4   |1.0  |  3.1  |  1.0 | 1.0 |  1.0  |\nPython  |257    |2.4 |90.4   |492    | 9.7  |5.8   |4.4   |37.9 |13.3   |2.6  | 26.9  |125   |10.9 |  3.3  |\nRuby    |157    |2.2 |25.2   |142    | 5.5  |1.5   |1.4   |  4.5| 4.5   |3.5  | 12.4  | 43.6 |29.4 |  1.8  |\nPyPy    | 8.1   |0.4 | 0.4   | 59    | 0.4  |0.2   |0.1   |  4.5| 1.4   |1.3  |  0.9  | 47.0 |22.1 | 17.8  |\nJS      |151    |1.4 |33.3   |211    |   -  |   -  |  -   |  5.5| 0.6   |  -  |  0.5  |  -   | 1.1 |  0.8  |\nScala   |  9.6  |1.6 | 2.8   |147    |60.3  |1.2   |0.7   |  2.4| 0.7   |9.4  |  1.2  |  -   |352  |  -[^5]|\nOcaml   | 34.4  |1.0 | 5.2   |  69   | 0.3  |0.5   |0.8   |  1.8| 1.8   |3.2  |  2.2  |  -   |  5,3|283    |\n\n[^1]: Dino best result.\n[^2]: Dino JIT hint was used.\n[^3]: Dino pure func hint was used.\n[^4]: Dino inline hint was used.\n[^5]: Scala can not even handle 10 times smaller code.\n\n\n---\n\n# Benchmarking -- AARCH64\n\n|       |Loop   |Hash   |Fact   |Fib    |Except|Method|Object|Sieve|Sort   |Stat.|Random |Thread|Start|Compile|\n:-------|------:|------:|------:|------:|-----:|-----:|-----:|----:|------:|---: |------:|-----:|----:|------:|\nDino[^1]|1.0[^2]|1.0    |1.0[^3]|1.0[^3]| 1.0  | 1.0  |1.0   | 1.0 |1.0[^2]|1.0  |1.0[^4]| 1.0  | 1.0 |1.0    |\nDino    |17.5   |1.7    |13.1   | 265   | 1.0  | 1.0  |1.0   | 1.0 | 1.4   |1.0  | 2.2   | 1.0  | 1.0 |1.0    |\nPython  |222    |0.5    | 68.8  |1116   |12.4  | 4.7  |2.8   |40.3 | 5.3   |2.5  |15.5   |149   |246  |2.6    |\nRuby    |170    |2.8    |32.3   |  542  |  6.0 | 1.7  |1.4   | 8.5 | 3.7   |3.8  |13.1   |118   |655  |1.6    |\nJS      |282    |1.4[^6]|31.6   |  471  |   -  |  -   |  -   | 16.2| 2.5   |  -  | 6.5   | -    | 1.0 |0.5    |\nOcaml   |44.7   |1.2    |  5.0  |  166  |  0.3 | 0.5  |0.9   | 2.6 | 2.1   |4.0  | 3.5   | -    |82.7 |232    |\n\n* Python v2.7.5 was used as Python3 is absent.\n* PyPy and Scala are not implemented yet.\n\n[^6]: Non-JIT JS was used as JIT failed.\n\n\n---\n\n# Benchmarking -- ARM\n\n|       |Loop   |Hash   |Fact   |Fib    |Except|Method|Object|Sieve|Sort   |Stat.|Random |Thread|Start|Compile|\n:-------|------:|------:|------:|------:|-----:|-----:|-----:|----:|------:|---: |------:|-----:|----:|------:|\nDino[^1]|1.0[^2]|1.0    |1.0[^3]|1.0[^3]| 1.0  | 1.0  |1.0   | 1.0 |1.0[^2]|1.0  |1.0[^4]| 1.0  | 1.0 |1.0    |\nDino    |4.2    |1.0    |18.1   | 490   | 1.0  | 1.0  |1.0   | 1.0 | 1.8   |1.0  | 2.5   | 1.0  | 1.0 |1.0    |\nPython  |28.2   |0.6    |  4.4  |1600   |11.7  | 3.4  |5.1   |19.3 | 6.7   |2.2  |17.5   |157   |10.9 |2.7    |\nRuby    |31.5   |2.6    |71.2   |  651  |  6.3 | 1.3  |1.7   | 4.8 | 4.0   |3.3  |11.3   |174   |12.7 |1.7    |\nPyPy    |103    |1.4    |151    |4158   |  9.9 |12.1  |7.9   |42.1 |11.7   |5.5  |30.4   |485   | 7.2 | [^7]  |\nJS      |29.8   |1.4[^6]|32.2   |  634  |   -  |  -   |  -   | 4.1 | 0.4   |  -  | 0.4   | -    | 1.1 |0.7    |\nScala   | 7.4   |8.2    |  6.4  |2396   |  6.9 | 1.2  |1.0   | 5.8 | 0.7   |19   | 1.2   | -    |109  | [^7]  |\nOcaml   |13.8   |1.0    |  8.8  |  327  |  0.4 | 0.6  |1.0   | 2.5 | 2.2   |3.3  | 1.7   | -    | 3.0 | [^7]  |\n\n[^7]: PyPy, Scala, and Ocaml failed to compile long code.\n\n\n---\n\n# Benchmarking - PPC64\n\n|       |Loop   |Hash   |Fact   |Fib    |Except|Method|Object|Sieve|Sort   |Stat.|Random |Thread|Start|Compile|\n:-------|------:|------:|------:|------:|-----:|-----:|-----:|----:|------:|---: |------:|-----:|----:|------:|\nDino[^1]|1.0[^2]|1.0    |1.0[^3]|1.0[^3]|1.0   |1.0   |1.0   |1.0  |1.0[^2]|1.0  |1.0[^4]|1.0   |1.0  |1.0    |\nDino    |23.2   |1.0    |16.2   |222    |1.0   |1.0   |1.0   |1.0  |4.3    |1.0  |4.4    |1.0   |1.0  |1.0    |\nPython  |182    |1.5    |51.0   |965    |15.1  |3.6   |4.1   |29.8 |7.5    |2.0  |15.7   |160   |5.1  |5.0    |\nRuby    |17.6   |1.7    |43.0   |390    |20.0  |1.6   |3.1   |7.6  |4.2    |5.2  |11.4   |62.8  |46.1 |1.5    |\nJS      |27.0   |3.0    |53.8   |453    |   -  |   -  |  -   |14.2 |2.8    |  -  |4.6    |  -   |2.7  |0.7    |\nOcaml   |33.2   |1.8    | 5.4   |133    |0.3   |0.4   |1.5   |3.7  |2.6    |4.8  |3.9    |  -   |4.4  |360    |\n\n* PyPy is not implemented for PPC64.\n* Scala was not available.\n\n---\n\n# Implementation - Conclusions\n* A lot of research was done on Dino implementation\n  (see [article about this](https://github.com/dino-lang/implemenation-article))\n* It can be used to improve performance of popular dynamic language implementations:\n    * to make them faster\n    * to make them more portable\n    * to require less resources (compilation time and memory)\n    * to have very quick start up and big compiler speed\n\n---\n\n# Future directions of research\n* Type annotation.  Two goals:\n  * More cases for compile type checking which is in a direction of\n    Dino language development (introduction of early undefined value\n    recognition, the same number of actual and formal parameter\n    numbers etc.)\n  * Faster code generated by JIT\n* Light-weight direct JIT\n  * Using GCC for JIT is portable but too heavy for some system as CYGWIN\n  * Direct JIT from bytecode to machine instructions is necessary\n    * Goal is very fast code generation and simple fast optimizations\n      to decrease memory traffic\n    * With type inference and type annotation the direct JIT can\n      achives 1/2-1/3 of speed optimized C code for majority of programs\n\n---\n\n# Dino availability\n* Dino has been implemented for\n  * Linux\n  * Windows through CYGWIN\n  * MacOSX\n    * X code and GMP package is necessary to build Dino\n* Dino site:\n      \u003chttp://dino-lang.github.io\u003e\n* DINO and COCOM repository:\n      \u003chttps://github.com/dino-lang/dino.git\u003e\n* License -- GPL 2 and LGPL 2:\n    * See files COPYING and COPYING.LIB\n\n---\n\n# Dino Building\n* See file INSTALL for details\n* Configure in a build directory:\n\n```\n      \u003cdino-path\u003e/configure --srcidir=\u003cdino-path\u003e --prefix=\u003cinstall-path\u003e\n```\n\n* Configure in a debug mode: -O0 and full IR checking (it makes\n  DINO several times slower):\n\n```\n      \u003cdino-path\u003e/configure --srcidir=\u003cdino-path\u003e --prefix=\u003cinstall-path\u003e --enable-debug\n```\n\n* Make:\n\n```\n      make\n```\n\n* Testing all COCOM and DINO:\n\n```\n      make check\n```\n\n* Testing only DINO (about 900 tests and benchmarking comparison with available implementations of other languages which can take a lot of time):\n\n```\n      cd DINO; make check\n```\n\n* Testig Dino is to run two shell scripts:\n    * Tests are in file \u003cbuild-directory\u003e/DINO/dino.tst generated from DINO/dino.tst.in\n    * Benchmarks are in file DINO/compare.tst\n\n* Installing COCOM and DINO:\n\n```\n      make install\n```\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdino-lang%2Fdino","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdino-lang%2Fdino","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdino-lang%2Fdino/lists"}