The APL (Arabic Programming Language) Library provides functionality for translating code written in Arabic according to the APL specification into executable Python code. This documentation outlines the usage and functionality of the APL
class within the library.
The APL
class is the main interface for interacting with the APL Library. It provides methods for translating Arabic code into Python and executing the resulting Python code.
Initializes an APL
object.
API
(str): The API key required for accessing the OpenAI service.
Translates Arabic code into Python code according to the APL specification.
asa_code
(str): The Arabic code conforming to the APL specification.
response
(str): The Python code generated from the provided Arabic code.
Executes the Python code obtained from the get_code
method.
py_code
(str): The Python code to be executed.
output
(str): The output generated by executing the provided Python code.
# Importing the APL class
from APL import APL
# Initializing an APL object with the API key
apl = APL(API_KEY)
# Arabic code to be translated
asa_code = "اطبع('مرحبا بالعالم')"
# Translating Arabic code to Python code
python_code = apl.get_code(asa_code)
# Running the Python code
output = apl.run_code(python_code)
# Displaying the output
print(output) # Output: "مرحبا بالعالم"