Giter Site home page Giter Site logo

hac's People

Contributors

zertovitch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hac's Issues

Shell_Execute variant without result

Often, the result value of Shell_Execute is not useful, so an idea is to turn Shell_Execute into the following procedures. In HAC_Pack's specification:

  procedure Shell_Execute (Command : String; Result : out Integer);
  procedure Shell_Execute (Command : VString; Result : out Integer);

  --  In this version, the result value is discarded:
  procedure Shell_Execute (Command : String);
  procedure Shell_Execute (Command : VString); 

Please clarify

  1. Why does hac.txt not have a .md file extension when the contents are mardown? GitHub could then render the contents properly. Also why not include a link to this from the readme or just make it the readme.md??

  2. Why do you say "One goal is to complement or challenge GNAT" when "most probably never be," "a real, serious Ada compiler?"

  3. There aren't enough serious open compilers, btw.

HAC-based builder for HAC, GNAT and others

Hello!

AE2023 slides had an empty space for applications.

I want to propose the purpose. I do not do much prototyping, but I struggle with compilation. I am switching slowly to AdaMagic, and I miss gprbuild here. libgpr depends on latest Ada features. I would like to restrict to Ada 95 until Ada 2005 to C translator appears. Am I right to assume that hac is Ada 95 compatible and will be?

If so, I would like some tool for building in a GNAT & non-GNAT environments. You seem to develop in ObjectAda, and I use AdaMagic. I think about something like Rakefile, but without Ruby. Or maybe gpr can be supported to some extent. gpr is very limited, your hac is mightier, I guess. gpr can be edited by IDE in a high level UI, but if IDE tries to work with my cases and ifs, it becomes not usable, so I do not let IDE edit my project files anyway.

And HAC needs some project handling too. So maybe make HAC-based builder a default for HAC?

I expect ability to output gpr files for gprbuild, VSCode and GPS. And programmable ability to generate projects for other compilers. AdaMagic is using unit map and lib files. I would like to have something like gnatls tool and gnatls object in memory, available for HAC script, to generate project file in a way that particular compiler understands.

I like GPR's way of isolation of projects. I like Mixed_Case.Naming.Like.In.Delphi.ads or like .NET assemblies are named. GPR lets my naming stay separated from other developers' preferences in their projects. I want the same outside GPR.

Use Hac alongside with Alire package manager for Ada

Hi everyone,

Good to you and to all your efforts in keeping this project going.

I am back with hac again,

I was wondering if it is possible to use hac alongside the Alire package manager
Any tip or suggestion will be appreciated.

Hear from you soon.

God blesses!!!

Regards

Using HAC for teaching Ada to Beginners

Hi Everybody,

Many thanks for making HAC, I found it very good and portable to give to my students.

What I will like to do is to use the Ada standard directives like with, package:, etc...

e.g. with Ada.Text_IO; use Ada_Text_IO; and so on....

My students are young learners (Age 15-18yr), new to Ada so it is important to teach the standard methods and programming fundamentals, etc...

HAC won't compile the code below:

with Ada.Text_IO;
procedure Greet is
begin
-- Print "Hello, World!" to the screen
Ada.Text_IO.Put_Line ("Hello, World!");
Ada.Text_IO.Put_Line("We love Hac Compiler for its compact size")
end Greet;

Is there are any way around doing this with HAC?

Many thanks!

Hear from you soon!

God blesses!!!

Best regards,
Sanyaade

-lcrt0.o not found

Mac OSX 10.15.7
XCode 12.0
GNATMAKE Community 2020 (20200429-84)

Compile and link work well until link fails with library not found for -lcrt0.o using gnatmake, gprbuild and GPS.

Mistaken undefined identifier (related to To_VString)

Reminder for Gautier : Inconsistency between HAC_Pack and what HAC - which only knows “+” - does internally.

Context :

Call To_Hex from : Put_Line (To_Hex (255) & To_Hex (15));

function To_Hex (Byte : Integer) return VString is
Hex_Range : String (0..15) := "0123456789ABCDEF";
begin
-- NOK <--- LIGNE 120
return To_VString(Hex_Range(Byte / 16)) &
To_VString(Hex_Range(Byte mod 16));

-- OK - result : FF0F
--Put(Hex_Range(Byte / 16)); Put(Hex_Range(Byte mod 16));
--return +"";
end To_Hex;

Give :
gnx-instance
120:9-19: undefined identifier

To_VString is seen as undefined

Build any unit as starting point

Instead of building a main procedure (and only that)
HAC will build any unit X as starting point using an implicit
"super main":

with X;

procedure _Super_Main is
begin
  || X;     --  if X is a parameterless procedure
  || null;  --  if X is another kind of unit
end;

The advantage is that HAC will be able to check semantics of any unit.

  • hac.exe x.ad{s|b} can check any unit; you don't need to search
    for a main procedure WITH-ing that unit for that job.
  • the Semantics target can check any unit as starting point;
    as a consequence an editor like LEA can refresh the analysis
    of the unit being worked on even if it is not a potential main
    procedure.

Result parameter for Create, Append, Open, Close

Since exception handling is not yet supported, we'd like a mean to handle cases where the file operations Create, Append, Open, Close fail. An idea is to have variants with a Result parameter. These variants can be useful too when exception handling is implemented, by the way.
Example for Create:

  --  If the operation fails, one of the Name_Error, Use_Error, Status_Error exceptions is raised.

  procedure Create (File : in out File_Type; Name : String);
  procedure Create (File : in out File_Type; Name : VString);

  --  Variants of Create, Append, Open, Close with a "Result" parameter.
  --  If the operation fails, Result is set to the value corresponding to the exception.

  type File_Operation_Result is (Success, Erroneous_Name, Erroneous_Use, Erroneous_Status);

  procedure Create (File : in out File_Type; Name : String; Result: out File_Operation_Result);
  procedure Create (File : in out File_Type; Name : VString; Result: out File_Operation_Result); 

Compiler/execution crash

Hi.

Great work with the HAC compiler.

I have found one thing.
By making some mistakes myself I noticed a compiler crash, where a error message would be expected.

This programme makes no sense at all, I know. It's a stripped down version of the actual programme where the error happened.

The command 'hac thisfile.adb' gives this crash message:

~/prog/ada/hac/tst/sieve % hac crash.adb

Execution of hac terminated by unhandled exception
raised CONSTRAINT_ERROR : hac_sys-parser.adb:1176 range check failed
Call stack traceback locations:
0xaaaab3d384e0 0xaaaab3d37fa8 0xaaaab3d39404 0xaaaab3d3b850 0xaaaab3d38670 0xaaaab3d3f51c 0xaaaab3d350d0 0xaaaab3d5a44c 0xaaaab3d0f684 0xaaaab3d0e068 0xaaaab3d12c5c 0xffff8fc9c534 0xaaaab3d0d700

This is the programme in question:

with Hac_Pack; Use Hac_Pack;

procedure sieve is
	type SieveType is array (2..100) of Integer;
--	sieve : SieveType;
	

	procedure printSieve( sieve: IN SieveType) is
		lc : Integer :=1 ;	-- e.g. remove and it throws regular error
	begin
		for element in 2 .. 100 loop
			lc := lc + 1;
		end loop;
	end printSieve;


	procedure checkSieve( sieve: IN OUT SieveType ) is
		wait : Character := ' ';  -- e.g. remove and it throws regular error
	begin
		for i in 2..100 loop
		    	sieve(i) := i;
		end loop;
	end checkSieve;

begin
	for element in 2..100 loop
		sieve(element) := 0;
	end loop;
end sieve;

Compiler version: 0.081 dated 06-Dec-2020.

The programme itself does not do anything useful and should just produce a list of error messages.
The original problem was that the variable sieve was not declared in the main prog. So I guess it has to do with that, maybe in combination of something else.
Also, even when some seemingly unrelated lines in the two procedures are removed, it's back to error messages instead of crash.

I have no problem with this crash, as the correct code with sieve declared works, but may this can help to find a bug.
Feel free to close if this is not relevant.

GNAT stack exhaustion (due to new string table size)

With the string table size raised to 100,000 (rev. 475 / commit aedc769), HAC built with GNAT CE 2020 for Windows and run on an Intel Celeron N3350 quits silently after a few seconds of doing nothing meaningful. It is a case of "silent stack exhaustion exit" issue with GNAT (normally a Storage_Error exception should be raised in this case). The solution is (as usual) to switch to heap allocation.

Too many digits (Mac M1)

$ ./hac test/digitz.adb 
test/digitz.adb: 56:32-32: number is too large: total actual exponent is  16 > Max = 15
test/digitz.adb: 57:4-12: duplicate identifier: PUT_LINE
Errors found, build failed.

Two, maybe 3, problems here:

  • I don’t think it’s an exponent problem, looks more like a significant digits problem
  • Should it be an error, anyway?
  • Failed to recover, see the duplicate identifier message at line 57

The reason that 16 digits is too many is that, on aarch64-apple-darwin (and maybe other aarch64 systems?), Long_Long_Float is the same as Long_Float; we have

   type Long_Float is digits 15
     range -16#0.FFFF_FFFF_FFFF_F8#E256 .. 16#0.FFFF_FFFF_FFFF_F8#E256;
   for Long_Float'Size use 64;

   type Long_Long_Float is digits 15
     range -16#0.FFFF_FFFF_FFFF_F8#E256 .. 16#0.FFFF_FFFF_FFFF_F8#E256;
   for Long_Long_Float'Size use 64;

vs on x86_64-apple-darwin we get

   type Long_Float is digits 15
     range -16#0.FFFF_FFFF_FFFF_F8#E256 .. 16#0.FFFF_FFFF_FFFF_F8#E256;
   for Long_Float'Size use 64;

   type Long_Long_Float is digits 18
     range -16#0.FFFF_FFFF_FFFF_FFFF#E4096 .. 16#0.FFFF_FFFF_FFFF_FFFF#E4096;
   for Long_Long_Float'Size use 128;

The all_silent_tests.adb test runs successfully.


This is with commit 5841f9d.

Compiler warnings with GCC 14.0.0

This is on macOS aarch64-apple-darwin, with GCC 14.0.0 20230820 (experimental):

hac_sys-defs.ads:453:59: warning: null range [enabled by default]

hac_sys-pcode-interpreter-operators.adb:232:05: warning: "Interfaces.Integer_64" is already use-visible through previous use_type_clause at s-arit64.ads:57 [-gnatwr]

Using gnat-llvm, built from the same compiler sources, these additional warnings are given:

hac_sys-interfacing.adb:107:05: warning: types for unchecked conversion have different sizes [-gnatwz]
hac_sys-interfacing.adb:107:05: warning: size of "Exported_Procedure" is 128, size of "Address" is 64 [-gnatwz]
hac_sys-interfacing.adb:107:05: warning: 64 trailing bits of source will be ignored [-gnatwz]

hac_sys-pcode-interpreter-calls.adb:104:07: warning: types for unchecked conversion have different sizes [-gnatwz]
hac_sys-pcode-interpreter-calls.adb:104:07: warning: size of "Address" is 64, size of "Exported_Procedure" is 128 [-gnatwz]
hac_sys-pcode-interpreter-calls.adb:104:07: warning: 64 trailing bits of target value will be undefined [-gnatwz]

which have to be the result of different code generation. Will try to cook up a small demonstrator for Adacore.

hac_multi : STORAGE_ERROR : stack overflow.

Hello, I've got this issue:

% ./hac_multi 
Event;  Task #;  Message
Execution of hac_multi terminated by unhandled exception
raised STORAGE_ERROR : stack overflow

With GDB, the issue is when calling:

hac_sys-compiler.adb:
66	    Scanner.InSymbol (CD);
(gdb) p cd'size
$2 = 16617728

Before going on increasing stack size, I was wondering why CD is so large.
Is it expected to be so?
Is there a way to reduce the size of CD?
Pascal.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.