Reference/Compiler

Definition

HeaderFile: UCodeLang/Compliation/Compiler.hpp

Is Included In UCodeLang.hpp: Yes

The UCodeLang Compiler.

class Compiler;

Example

#include <UCodeLang/UCodeLang.hpp>

void main()
{
  const char* MyUCode = "|main[] => 1;";

  UCodeLang::Compiler myCompiler;
  auto comilerRet = myCompiler.CompileText(MyUCode);


  if (!comilerRet.IsError())
  {
    //your ucode was Compiled
  }
  else
  {
    //your ucode fail to compile
  }
}

Methods

FuncionParametersReturnDescription
CompileText(const String_view& Text, const ExternalFiles& ExternalFiles = {})CompilerRetCompiles UCodeLang Text and returns the Result.
CompileFileToLib(const Path& path, const ExternalFiles& ExternalFiles = {})CompilerRetCompiles UCodeLang Text and returns the Result.
CompilePathToObj(const Path& path, const Path& OutLib, const ExternalFiles& ExternalFiles = {})CompilerRetCompiles UCodeLang File at the Path and returns the Result and Outputs at the OutLib.
CompileFiles(const CompilerPathData& Data, const ExternalFiles& ExternalFiles = {})CompilerRetCompiles UCodeLang using CompilerPathData and returns the Result.
CompileFiles_UseIntDir(const CompilerPathData& Data, const ExternalFiles& ExternalFiles = {})CompilerRetCompiles UCodeLang using CompilerPathData and returns the Result and Outputs intermediates file.
Set_FrontEnd(FrontEndObject_Ptr Value)voidSets The FrontEnd.
Set_BackEnd(BackEndObject_Ptr Value)voidSets The BackEnd.
GetBackEndNameNoneStringGets The BackEnd BackEnd Name.
GetOutputExtWithDotNoneStringGets The Output file extension.
GetOutputBackEndInfoNoneCompliationBackEndInfoGets The Metadata about the BackEnd

Types

CompilerPathData

struct CompilerPathData
{
    Path FileDir;
    Path IntDir;
    Path OutFile;
}

ExternalFiles

struct ExternalFiles
{
	Vector<Path> Files;
};

CompliationSuccess

struct CompliationSuccess
{
	NeverNullPtr<UClib> OutPut;
	Optional<BytesPtr> OutFile;
}

CompilerRet

using CompilerRet = Result<CompliationSuccess,NeverNullPtr<CompliationErrors>>;

Notes