IR and His Peculiarities
Document Content:
2.Typing
Familiarization with IR
IR (Intermediate Representation) is a structured format used to describe program logic in a way that is independent from any specific programming language.
Instead of writing instructions directly in a language like Rust, Python, or JavaScript, IR describes what should exist and how it should behave in a neutral form.
Core Idea of IR
IR is not code in the traditional sense.
It is:
- a data description of logic
- a bridge between source code and execution
- a language-agnostic representation of program structure
Main Peculiarities of IR
1. Declarative Structure
IR describes what exists, not how to execute it.
- Variables are declared as data nodes
- Functions and expressions are stored as structured values
- Execution logic is derived from structure, not written step-by-step
2. JSON-like Representation
IR is typically represented in a structured format (often JSON-like).
This makes it:
- easy to parse
- easy to transform
- easy to serialize and transport
3. Language Independence
IR does not belong to any specific programming language.
From the same IR description, you can:
- generate Python code
- generate JavaScript code
- generate Lua code
- or execute it directly in a runtime
Typing
IR does not have a static type system (no type checking is performed). SITER calculates types itself with type definer
IR Objects
1.Variables Variables in this format:
"var:name_of_variable": {
"value": value
}
Example(variable with name myvar and with value string “hello”):
"var:myvar": {
"value": "hello"
}
Example with number(variable with name count and value number 42):
"var:count": {
"value": 42
}
With Boolean:
"var:is_active": {
"value": true
}
2.Import(Importing any module) is written at the beginning of the entire script Example(Import module with name ‘requests’):
"imports": ["requests"]
It is possible to import multiple modules: ```json “imports”: [“requests”,”module2”,”module3”]