comp.lang.ada
 help / color / mirror / Atom feed
* Ann: HAC v.0.06 - Text File I/O
@ 2020-05-19  8:50 gautier_niouzes
  2020-05-19 12:39 ` joakimds
  2020-05-20 11:29 ` Stéphane Rivière
  0 siblings, 2 replies; 7+ messages in thread
From: gautier_niouzes @ 2020-05-19  8:50 UTC (permalink / raw)


HAC (HAC Ada Compiler) is available on two open-source development sites:
  https://hacadacompiler.sourceforge.io/
  https://github.com/zertovitch/hac

HAC is a small, quick, open-source Ada compiler, covering a subset of
the Ada language.
Even though the HAC documentation is more or less non-existent, the good
news is that you can use as a help Ada books and online documentation
about Ada: HAC does not define a dialect of Ada, only a subset.
A glimpse into the file "src/hac_pack.ads" gives you the currently
available types and subprograms.

The latest additions are:
------------------------

  - v.0.06: Text File I/O around File_Type (example below)

  - v.0.05: type VString (variable-size string), with various operators
      and functions ("&", "*", comparison operators, Element, Length,
      Slice, Index, Trim, Image, Integer_Value, Float_Value functions);
      system functions (Argument_Count, Argument, Get_Env, Set_Env,
      Shell_Execute)

HAC programs are real Ada programs, they can be built by a "serious"
Ada compiler, through the HAC_Pack compatibility package.
See the exm/hac_exm.gpr and test/hac_test.gpr project files
for the GNAT compiler.

HAC is itself programmed in Ada. To build HAC for the command-line,
all you need (with GNAT) is to run "gprbuild -p -P hac".
Then you get the executable hax[.exe].
The command "hax" alone will show you basic help.

  HAX: command-line compilation and execution for HAC (HAC Ada Compiler)
  Compiler version: 0.06 dated 18-May-2020.
  URL: https://hacadacompiler.sourceforge.io/

  Usage: hax [options] main.adb [command-line parameters for main]

  Options: -h     : this help
           -v, v1 : verbose
           -v2    : very verbose
           -a     : assembler output
           -d     : dump compiler information

Enjoy
_________________________ 
Gautier's Ada programming 
http://gautiersblog.blogspot.com/search/label/Ada 
NB: follow the above link for a valid e-mail address 
__
PS: The example (exm/file_copy.adb):

with HAC_Pack;  use HAC_Pack;

procedure File_Copy is
  s : VString;
  f1, f2 : File_Type;
begin
  Open (f1, "file_copy.adb");
  Create (f2, "file_copy.txt");
  while not End_Of_File (f1) loop
    Get_Line (f1, s);
    Put_Line (f2, s);
  end loop;
  Close (f1);
  Close (f2);
end File_Copy;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ann: HAC v.0.06 - Text File I/O
  2020-05-19  8:50 Ann: HAC v.0.06 - Text File I/O gautier_niouzes
@ 2020-05-19 12:39 ` joakimds
  2020-05-20  9:47   ` gautier_niouzes
  2020-05-20 11:29 ` Stéphane Rivière
  1 sibling, 1 reply; 7+ messages in thread
From: joakimds @ 2020-05-19 12:39 UTC (permalink / raw)


Den tisdag 19 maj 2020 kl. 10:50:14 UTC+2 skrev gautier...@hotmail.com:
> HAC (HAC Ada Compiler) is available on two open-source development sites:
>   https://hacadacompiler.sourceforge.io/
>   https://github.com/zertovitch/hac
> 
> HAC is a small, quick, open-source Ada compiler, covering a subset of
> the Ada language.
> Even though the HAC documentation is more or less non-existent, the good
> news is that you can use as a help Ada books and online documentation
> about Ada: HAC does not define a dialect of Ada, only a subset.
> A glimpse into the file "src/hac_pack.ads" gives you the currently
> available types and subprograms.
> 
> The latest additions are:
> ------------------------
> 
>   - v.0.06: Text File I/O around File_Type (example below)
> 
>   - v.0.05: type VString (variable-size string), with various operators
>       and functions ("&", "*", comparison operators, Element, Length,
>       Slice, Index, Trim, Image, Integer_Value, Float_Value functions);
>       system functions (Argument_Count, Argument, Get_Env, Set_Env,
>       Shell_Execute)
> 
> HAC programs are real Ada programs, they can be built by a "serious"
> Ada compiler, through the HAC_Pack compatibility package.
> See the exm/hac_exm.gpr and test/hac_test.gpr project files
> for the GNAT compiler.
> 
> HAC is itself programmed in Ada. To build HAC for the command-line,
> all you need (with GNAT) is to run "gprbuild -p -P hac".
> Then you get the executable hax[.exe].
> The command "hax" alone will show you basic help.
> 
>   HAX: command-line compilation and execution for HAC (HAC Ada Compiler)
>   Compiler version: 0.06 dated 18-May-2020.
>   URL: https://hacadacompiler.sourceforge.io/
> 
>   Usage: hax [options] main.adb [command-line parameters for main]
> 
>   Options: -h     : this help
>            -v, v1 : verbose
>            -v2    : very verbose
>            -a     : assembler output
>            -d     : dump compiler information
> 
> Enjoy
> _________________________ 
> Gautier's Ada programming 
> http://gautiersblog.blogspot.com/search/label/Ada 
> NB: follow the above link for a valid e-mail address 
> __
> PS: The example (exm/file_copy.adb):
> 
> with HAC_Pack;  use HAC_Pack;
> 
> procedure File_Copy is
>   s : VString;
>   f1, f2 : File_Type;
> begin
>   Open (f1, "file_copy.adb");
>   Create (f2, "file_copy.txt");
>   while not End_Of_File (f1) loop
>     Get_Line (f1, s);
>     Put_Line (f2, s);
>   end loop;
>   Close (f1);
>   Close (f2);
> end File_Copy;

Nice Gautier regarding the possibility of copying text files. Is support for copying/reading/writing binary files in the works?

Best regards,
Joakim

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ann: HAC v.0.06 - Text File I/O
  2020-05-19 12:39 ` joakimds
@ 2020-05-20  9:47   ` gautier_niouzes
  0 siblings, 0 replies; 7+ messages in thread
From: gautier_niouzes @ 2020-05-20  9:47 UTC (permalink / raw)


> Nice Gautier regarding the possibility of copying text files.

Thx. Of course file_copy.adb is a tiny demonstration example. You can now make a parser or whatever you want with text files, from HAC: nested subprograms, local types and variables are supported.

> Is support for copying/reading/writing binary files in the works?

Not yet, but I've added this to the to-do list.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ann: HAC v.0.06 - Text File I/O
  2020-05-19  8:50 Ann: HAC v.0.06 - Text File I/O gautier_niouzes
  2020-05-19 12:39 ` joakimds
@ 2020-05-20 11:29 ` Stéphane Rivière
  2020-05-20 11:53   ` Stéphane Rivière
  1 sibling, 1 reply; 7+ messages in thread
From: Stéphane Rivière @ 2020-05-20 11:29 UTC (permalink / raw)


Le 19/05/2020 à 10:50, gautier_niouzes@hotmail.com a écrit :
> HAC (HAC Ada Compiler) is available on two open-source development sites:

Well done Gautier !

I've build (a breeze) and test HAC : this is not a toy but a really
usuable tool for simple - but not simplistic - purposes...

An educative Ada way inside (the compiler code) and outside (for Ada
newbies to adminsys complex scripting needs).

An education in Ada from the inside (the compiler code) and outside (for
Ada beginners to more complex adminsys scripting needs).

Straight reuse of HAC code in Gnat is really great (and a key point imho).

All the best from Oleron Island :)

-- 
Be Seeing You
Number Six

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ann: HAC v.0.06 - Text File I/O
  2020-05-20 11:29 ` Stéphane Rivière
@ 2020-05-20 11:53   ` Stéphane Rivière
  2020-05-20 13:28     ` DrPi
  0 siblings, 1 reply; 7+ messages in thread
From: Stéphane Rivière @ 2020-05-20 11:53 UTC (permalink / raw)


oops it's good to read again but it's even better to delete the previous
version :)

-- 
Be Seeing You
Number Six

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ann: HAC v.0.06 - Text File I/O
  2020-05-20 11:53   ` Stéphane Rivière
@ 2020-05-20 13:28     ` DrPi
  2020-05-20 15:17       ` Stéphane Rivière
  0 siblings, 1 reply; 7+ messages in thread
From: DrPi @ 2020-05-20 13:28 UTC (permalink / raw)


Le 20/05/2020 à 13:53, Stéphane Rivière a écrit :
> oops it's good to read again but it's even better to delete the previous
> version :)
> 
This is because you didn't write it in Ada, else the compiler would have
caught it ;)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ann: HAC v.0.06 - Text File I/O
  2020-05-20 13:28     ` DrPi
@ 2020-05-20 15:17       ` Stéphane Rivière
  0 siblings, 0 replies; 7+ messages in thread
From: Stéphane Rivière @ 2020-05-20 15:17 UTC (permalink / raw)


> This is because you didn't write it in Ada, else the compiler would have
> caught it ;)

:) Fascinating (C) Spock !

-- 
Be Seeing You
Number Six

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-05-20 15:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19  8:50 Ann: HAC v.0.06 - Text File I/O gautier_niouzes
2020-05-19 12:39 ` joakimds
2020-05-20  9:47   ` gautier_niouzes
2020-05-20 11:29 ` Stéphane Rivière
2020-05-20 11:53   ` Stéphane Rivière
2020-05-20 13:28     ` DrPi
2020-05-20 15:17       ` Stéphane Rivière

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