Bash++
Bash++ compiler internal documentation
|
Classes | |
class | bpp_entity |
The base class for all entities in the Bash++ compiler. More... | |
class | bpp_code_entity |
An entity which can contain code. More... | |
class | bpp_string |
The practical difference between bpp_code_entity and bpp_string is how we handle the code buffers. More... | |
class | bpp_method |
A method in a class. More... | |
class | bpp_method_parameter |
A parameter in a method. More... | |
class | bpp_class |
A class in Bash++. More... | |
class | bpp_object |
An object in Bash++. More... | |
class | bpp_datamember |
A data member in a class. More... | |
class | bpp_program |
The main program. More... | |
class | bash_while_loop |
A while loop in Bash++. More... | |
class | bash_while_condition |
The condition for a while loop in Bash++. More... | |
class | bash_if |
An if statement in Bash++. More... | |
class | bash_if_branch |
A branch of an if statement in Bash++. More... | |
class | bash_case |
A case statement in Bash++. More... | |
class | bash_case_pattern |
A pattern for a case statement in Bash++. More... | |
class | bash_for |
A for loop in Bash++. More... | |
class | bash_function |
class | bpp_delete_statement |
A delete statement in Bash++. More... | |
class | bpp_dynamic_cast_statement |
A dynamic_cast statement in Bash++. More... | |
class | bpp_pointer_dereference |
A pointer dereference in Bash++. More... | |
class | bpp_value_assignment |
A value assignment statement in Bash++. More... | |
class | bpp_object_assignment |
An object assignment statement in Bash++. More... | |
class | bpp_object_reference |
An object reference in Bash++. More... | |
class | bpp_object_address |
A statement which takes the address of an object in Bash++. More... | |
struct | code_segment |
A struct to hold (compiled) code segments. More... | |
Enumerations | |
enum | bpp_scope { SCOPE_PUBLIC , SCOPE_PROTECTED , SCOPE_PRIVATE , SCOPE_INACCESSIBLE } |
enum | reference_type { ref_primitive , ref_method , ref_object } |
Functions | |
code_segment | generate_supershell_code (const std::string &code_to_run, bool in_while_condition, std::shared_ptr< bash_while_condition > current_while_condition, std::shared_ptr< bpp::bpp_program > program) |
Generates a supershell code segment for executing a bash command. More... | |
code_segment | generate_delete_code (std::shared_ptr< bpp::bpp_object > object, const std::string &object_ref, std::shared_ptr< bpp::bpp_program > program) |
Generates a code segment for deleting an object. More... | |
code_segment | generate_method_call_code (const std::string &reference_code, const std::string &method_name, std::shared_ptr< bpp::bpp_class > assumed_class, std::shared_ptr< bpp::bpp_program > program) |
Generates a code segment for calling a method. More... | |
code_segment | generate_dynamic_cast_code (const std::string &reference_code, const std::string &class_name, std::shared_ptr< bpp::bpp_program > program) |
Generates a code segment for performing a dynamic cast. More... | |
code_segment | inline_new (const std::string &new_address, std::shared_ptr< bpp::bpp_class > new_class) |
Generates a code segment to INLINE class's "new" function within a method. More... | |
code_segment | generate_delete_code (std::shared_ptr< bpp_object > object, const std::string &object_ref, std::shared_ptr< bpp::bpp_program > program) |
code_segment | generate_method_call_code (const std::string &reference_code, const std::string &method_name, std::shared_ptr< bpp_class > assumed_class, std::shared_ptr< bpp::bpp_program > program) |
Variables | |
static const std::shared_ptr< bpp_entity > | inaccessible_entity = std::make_shared<bpp_entity>() |
A placeholder for an inaccessible entity (scope handling) More... | |
static const std::shared_ptr< bpp_datamember > | inaccessible_datamember = std::make_shared<bpp_datamember>() |
A placeholder for an inaccessible data member of a class (scope handling) More... | |
static const std::shared_ptr< bpp_method > | inaccessible_method = std::make_shared<bpp_method>() |
A placeholder for an inaccessible method of a class (scope handling) More... | |
static const char | bpp_nullptr [] = "0" |
The secret internal value of '@nullptr' in Bash++. More... | |
Copyright (C) 2025 rail5 Bash++: Bash with classes
enum bpp::bpp_scope |
enum bpp::reference_type |
code_segment bpp::generate_delete_code | ( | std::shared_ptr< bpp::bpp_object > | object, |
const std::string & | object_ref, | ||
std::shared_ptr< bpp::bpp_program > | program | ||
) |
Generates a code segment for deleting an object.
This function constructs a code segment to delete an object. The generated code includes:
object | The object to be deleted. |
object_ref | The string representing the object's reference in the compiled code. |
code_segment bpp::generate_delete_code | ( | std::shared_ptr< bpp_object > | object, |
const std::string & | object_ref, | ||
std::shared_ptr< bpp::bpp_program > | program | ||
) |
code_segment bpp::generate_dynamic_cast_code | ( | const std::string & | reference_code, |
const std::string & | class_name, | ||
std::shared_ptr< bpp::bpp_program > | program | ||
) |
Generates a code segment for performing a dynamic cast.
This function constructs a code segment to perform a dynamic cast on an object. The generated code includes:
reference_code | The code representing the object reference |
class_name | The type to which we want to cast |
code_segment bpp::generate_method_call_code | ( | const std::string & | reference_code, |
const std::string & | method_name, | ||
std::shared_ptr< bpp::bpp_class > | assumed_class, | ||
std::shared_ptr< bpp::bpp_program > | program | ||
) |
Generates a code segment for calling a method.
This function constructs a code segment to call a method on an object. The generated code includes:
reference_code | The code representing the object reference. |
method_name | The name of the method to be called. |
assumed_class | The class to which the object is assumed to belong at compile-time. |
code_segment bpp::generate_method_call_code | ( | const std::string & | reference_code, |
const std::string & | method_name, | ||
std::shared_ptr< bpp_class > | assumed_class, | ||
std::shared_ptr< bpp::bpp_program > | program | ||
) |
code_segment bpp::generate_supershell_code | ( | const std::string & | code_to_run, |
bool | in_while_condition, | ||
std::shared_ptr< bash_while_condition > | current_while_condition, | ||
std::shared_ptr< bpp::bpp_program > | program | ||
) |
Generates a supershell code segment for executing a bash command.
This function constructs a code segment to run a specified command in a supershell. It creates a unique function name and output variable using a global counter. The generated code includes:
code_to_run | The bash command to be executed within the supershell. |
code_segment bpp::inline_new | ( | const std::string & | new_address, |
std::shared_ptr< bpp::bpp_class > | new_class | ||
) |
Generates a code segment to INLINE class's "new" function within a method.
This is only to be used inside a method.
Rather than calling the class's "new" function, by inlining it, we can ensure that all instantiated objects are purely local to the method. This eliminates any issues with scope and recursion.
However, this change has resulted in some significant code duplication:
This will have to be handled soon.
new_address | The address of the new object |
new_class | The class of the new object |
|
static |
The secret internal value of '@nullptr' in Bash++.
|
static |
A placeholder for an inaccessible data member of a class (scope handling)
|
static |
A placeholder for an inaccessible entity (scope handling)
|
static |
A placeholder for an inaccessible method of a class (scope handling)