ignore object directory contents

This commit is contained in:
Yannick Reiß 2024-02-03 10:49:34 +01:00
parent 00e62a97ff
commit f4de4b9a8f
No known key found for this signature in database
GPG Key ID: 5A3AF456F0A0338C
3 changed files with 86 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
obj/*

View File

@ -4,12 +4,83 @@
-- Content: Compiler main call
with Ada.Text_IO;
with Ada.Command_Line;
with Ada.Strings.Unbounded;
-- @name Main
-- @return
-- @description Main Function call
procedure Main is
type InstructionList is array(1..65536) of String(1..64);
type ArgumentParserState is
(PSInit, PSFilename, PSLanguage, PSRecycle, PSFinish, PSError);
type FileList is array(1..128) of Unbounded.Unbounded_String;
ParserState : ArgumentParserState := Init;
Filename : Unbounded.Unbounded_String :=
Unbounded.To_Unbounded_String ("bin.out");
Language : Unbounded.Unbounded_String :=
Unbounded.To_Unbounded_String ("VHDL");
Recycle : Boolean := False;
InputFileList : FileList;
InputFileListIndex : Integer := 1;
Argument : String;
Argumenterror : exception;
Languageoptionerror : exception;
begin
-- Check input file limit for arguments and lowest argument
if Ada.Command_Line.Argument_Count > 128 then
Text_IO.Put_Line ("To many arguments!");
elsif Ada.Command_Line.Argument_Count < 2 then
Text_IO.Put_Line ("Not enough arguments!");
end if;
for Index in 1 .. Ada.Command_Line.Argument_Count loop
Argument := Command_Line.Argument(Index);
case ParserState is
when Init =>
if Argument = "-o" then
ParserState := PSFilename;
elsif Argument = "-x" then
ParserState := PSLanguage;
elsif Argument = "-r" then
ParserState := PSRecycle;
else
ParserState := PSError;
end if;
when Filename =>
ParserState := PSInit;
Filename := Unbounded.To_Unbounded_String (Argument);
when Language =>
ParserState := PSInit;
Language := PSUnbounded.To_Unbounded_String (Argument);
when Recycle =>
ParserState := PSInit;
Recycle := True;
when PSError =>
ParserState := PSError;
raise Argumenterror;
when PSFinish =>
ParserState := PSFinish;
InputFileListIndex := InputFileListIndex + 1;
InputFileList(InputFileListIndex) := Argument;
when others =>
ParserState := PSFinish;
InputFileListIndex := 1;
InputFileList(InputFileListIndex) := Argument;
end case;
end loop;
-- Check the language for correct values
if not (Language = "VHDL" or Language = "C") then
Text_Io.Put_Line
("ERROR: The language " & Unbounded.To_String (Language) &
" is not available!");
raise Languageoptionerror;
end if;
-- Dissolve Language Features
-- Isolate Instructions
-- Translate into target code
end Main;

14
src/translate.adb Normal file
View File

@ -0,0 +1,14 @@
with Ada.Unbounded;
-- @name translate
-- @return InstructionList
-- @param PreparedCode : Unbound.Unbounded_String
-- @description Create instruction list
function translate
(PreparedCode : Unbound.Unbounded_String) return InstructionList
is
begin
return InstructionList;
end translate;