comp.lang.ada
 help / color / mirror / Atom feed
From: gautier_niouzes@hotmail.com
Subject: Re: Script-like jobs in Ada (ideas for HAC)
Date: Thu, 30 Apr 2020 01:02:43 -0700 (PDT)
Date: 2020-04-30T01:02:43-07:00	[thread overview]
Message-ID: <d8546592-bfba-4a84-a339-fc49a943c16b@googlegroups.com> (raw)
In-Reply-To: <9a4ad55c-ef0d-42ab-a438-cabc71a491a6@googlegroups.com>

Thank you all for your answers and brainstorming.
Here are a few points, so far, to summarize:

- Clear need for adding strings and files manipulation,
    access to databases, UI, ...

- Embeddable: inside a real Ada program? Yes, it is possible.
  Here I just simplify what you find in hax.adb:
  ...
    CD : Compiler_Data;
  begin
    Set_Source_Stream (CD, [Some stream access], [Possibly related file name]);
    Compile (CD);
    if CD.Err_Count = 0 then
      Interpret_on_Current_IO (CD);
    end if;
    ...
    
- Freezing and restoring the state of the VM, and its data: it is possible.
    I still need to wrap the "global" variables for the state of the VM
    interpreter into an object type, but it is doable : they are located
    in a subpackage that could be turned into a record type with not much
    more effort than hitting it with a magic wand ;-) .

- Jupyter: seems something to be considered!
- Euphoria: seems a very good source of inspiration<!

- The nasty need for "with HAC_Pack; use HAC_Pack;"
    Yes it is still required - until the point where support
    for packages will be implemented in HAC.
    However, it is already possible to cross-compile, since there
    is a "real" package (spec + body) in pure Ada in
      exm/special/hac_pack.ads,
      exm/special/hac_pack.adb.
    For instance, the HAC demos and tests can be built with GNAT
    through the exm/hac_exm.gpr and test/hac_test.gpt project files
    respectively.
    That's the big difference between HAC and a classical
    scripting language system: in the classical setup, the frontier
    is permanently set between the slow/interpreted/dynamic-typing part
    and the fast/compiled/static-typing part.
    Typically people need to reprogram parts or all of their scripts
    as C++ inserts in order to have a decent performance.
    With HAC you have the option to switch to your preferred compiler,
    with native code generation and optimization options.
    For a mix VM/native code, we could imagine options or pragmas that
    triage units to VM or native code compilation. Just thinking loud...

Finally, here is an example of use (just written "live" using the LEA
editor, during a homeschooling session):

with HAC_Pack;  use HAC_Pack;

procedure einmaleins is
  x, y : integer;
begin
  x := 1 + rand (9);
  y := 1 + rand (9);
  put(x);
  put(y);
  put(x*y);
end;

_________________________ 
Gautier's Ada programming 
http://gautiersblog.blogspot.com/search/label/Ada 
NB: follow the above link for a valid e-mail address 

  parent reply	other threads:[~2020-04-30  8:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 19:45 Script-like jobs in Ada (ideas for HAC) gautier_niouzes
2020-04-24 23:22 ` cantanima.perry
2020-04-25  0:11 ` Nasser M. Abbasi
2020-04-25 19:00   ` Stephen Leake
2020-04-25 23:35     ` Dennis Lee Bieber
2020-04-25 18:52 ` Stephen Leake
2020-04-26  6:49 ` mockturtle
2020-04-26  9:26 ` Jeffrey R. Carter
2020-04-26 14:49 ` Simon Wright
2020-04-27 18:50 ` Bojan Bozovic
2020-04-27 19:01   ` Optikos
2020-04-27 20:31   ` Dmitry A. Kazakov
2020-04-28  8:51 ` Jerry
2020-04-29 15:47 ` joakimds
2020-04-29 19:54 ` darek
2020-04-30  8:02 ` gautier_niouzes [this message]
2020-04-30  8:44   ` Dmitry A. Kazakov
2020-05-01  7:31     ` gautier_niouzes
2020-05-01  7:51       ` Dmitry A. Kazakov
2020-05-01 15:46         ` gautier_niouzes
2020-05-01 16:22           ` Dmitry A. Kazakov
2020-05-02  5:36 ` Trescott Jensen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox