ignore object directory contents
This commit is contained in:
parent
00e62a97ff
commit
f4de4b9a8f
|
@ -0,0 +1 @@
|
||||||
|
obj/*
|
71
src/main.adb
71
src/main.adb
|
@ -4,12 +4,83 @@
|
||||||
-- Content: Compiler main call
|
-- Content: Compiler main call
|
||||||
with Ada.Text_IO;
|
with Ada.Text_IO;
|
||||||
with Ada.Command_Line;
|
with Ada.Command_Line;
|
||||||
|
with Ada.Strings.Unbounded;
|
||||||
|
|
||||||
-- @name Main
|
-- @name Main
|
||||||
-- @return
|
-- @return
|
||||||
-- @description Main Function call
|
-- @description Main Function call
|
||||||
procedure Main is
|
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
|
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;
|
end Main;
|
||||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue