base
¶
    Define the public irx API.
Classes:
- 
          
Builder–ASTx Builder.
 - 
          
BuilderVisitor–Builder translator visitor.
 
Functions:
- 
            
run_command–Run a shell command and return its stdout as a string.
 
            Builder
¶
Builder()
              Bases: ABC
ASTx Builder.
Methods:
- 
            
build–Transpile ASTx to LLVM-IR and build an executable file.
 - 
            
module–Create a new ASTx Module.
 - 
            
run–Run the generated executable.
 - 
            
translate–Transpile ASTx to LLVM-IR.
 
Source code in src/irx/builders/base.py
                    61 62 63 64 65 66 67 68 69 70 71 72  |  | 
            build
  
      abstractmethod
  
¶
build(expr: AST, output_file: str) -> None
Transpile ASTx to LLVM-IR and build an executable file.
Source code in src/irx/builders/base.py
              82 83 84 85 86 87 88 89  |  | 
            module
¶
module() -> Module
Create a new ASTx Module.
Source code in src/irx/builders/base.py
              74 75 76  |  | 
            BuilderVisitor
¶
    Builder translator visitor.
Methods:
- 
            
translate–Translate an ASTx expression to string.
 
            translate
¶
translate(expr: AST) -> str
Translate an ASTx expression to string.
Example of how it could be implemented:
self.visit(expr)
return str(self.result)
Source code in src/irx/builders/base.py
              39 40 41 42 43 44 45 46 47 48  |  | 
            run_command
¶
    Run a shell command and return its stdout as a string.
Raises CalledProcessError if the command exits with a non-zero status.
Source code in src/irx/builders/base.py
              17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32  |  |