zertovitch / hac

HAC Ada Compiler - a small, quick Ada compiler fully in Ada
http://hacadacompiler.sf.net/
122 stars 11 forks source link

Using HAC for teaching Ada to Beginners #2

Open sanyaade-projects opened 4 years ago

sanyaade-projects commented 4 years ago

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

zertovitch commented 4 years ago

Hi Sanyaade,

Unfortunately the modularity (i.e. packages) is not yet implemented in HAC (0.074). However, already now, you can compile programs written for HAC with a complete Ada compiler such as GNAT, thanks to the real package HAC_Pack. See hac_pack.ads, hac_pack.adb in the src directory.

Regards, Gautier

sanyaade-projects commented 4 years ago

@zertovitch :

Many thanks for getting back to me and for your quick reply.

I will look at the GNAT and those src files you mentioned and feedback to you.

Please add the packages feature on your list for the next release. Many thanks! If there is a document or guide line on how to implement package or as a plug-in, then I would like to take that task up and to contribute doing that add-on stuff

Many thanks! Much appreciated!

God blesses!!!

Best regards, Sanyaade

zertovitch commented 4 years ago

It's already on the list (hac_work.xls, sheet: to-do). But, for instance, to get to Ada.Text_IO, we'd need to implement String's, which requires first unconstrained arrays, which is already not a piece of cake. And programmable exceptions. And child packages. Lots of work...