Простые типы данных — различия между версиями

Материал из Compilers Wiki
Перейти к: навигация, поиск
 
(не показана 1 промежуточная версия этого же участника)
Строка 1: Строка 1:
 
+
BASETY := 'w' | 'l' | 's' | 'd'  # Базовые типы
BASETY := 'w' | 'l' | 's' | 'd'  # Базовые типы
+
EXTTY  := BASETY    | 'b' | 'h'  # Расширенные типы
 
 
EXTTY  := BASETY    | 'b' | 'h'  # Расширенные типы
 
  
  
Строка 11: Строка 9:
 
: <pre>The four base types are w (word), l (long), s (single), and d (double), they stand respectively for 32-bit and 64-bit integers, and 32-bit and 64-bit floating-point numbers. There are no pointer types available; pointers are typed by an integer type sufficiently wide to represent all memory addresses (e.g., l on 64-bit architectures). Temporaries in the IL can only have a basic type.</pre>
 
: <pre>The four base types are w (word), l (long), s (single), and d (double), they stand respectively for 32-bit and 64-bit integers, and 32-bit and 64-bit floating-point numbers. There are no pointer types available; pointers are typed by an integer type sufficiently wide to represent all memory addresses (e.g., l on 64-bit architectures). Temporaries in the IL can only have a basic type.</pre>
  
Расширенные типы содержат базовые типы плюс b (byte) и h (half word) соответственно для 8-битных и 16-битных целых чисел. Они используются в определениях [[Сложные типы данных | сложных типов данных]] и Данных. Для C-интерфейса [[QBE |промежуточный язык]] также предоставляет пользовательские [[Сложные типы данных | сложные типы]]. Синтаксис, используемый для их обозначения <strong>: foo</strong>.
+
Расширенные типы содержат базовые типы плюс b (byte) и h (half word) соответственно для 8-битных и 16-битных целых чисел. Они используются в определениях [[Составные типы данных | составных типов данных]] и Данных. Для C-интерфейса [[QBE |промежуточный язык]] также предоставляет пользовательские [[Составные типы данных | составные типы]]. Синтаксис, используемый для их обозначения <strong>: foo</strong>.
 
: <pre>Extended types contain base types plus b (byte) and h (half word), respectively for 8-bit and 16-bit integers. They are used in Aggregate Types and Data definitions. For C interfacing, the IL also provides user-defined aggregate types. The syntax used to designate them is :foo.</pre>
 
: <pre>Extended types contain base types plus b (byte) and h (half word), respectively for 8-bit and 16-bit integers. They are used in Aggregate Types and Data definitions. For C interfacing, the IL also provides user-defined aggregate types. The syntax used to designate them is :foo.</pre>
  

Текущая версия на 19:04, 16 марта 2018

BASETY := 'w' | 'l' | 's' | 'd'  # Базовые типы
EXTTY  := BASETY    | 'b' | 'h'  # Расширенные типы


Промежуточный язык осуществляет минимальное использование типов. По дизайну используемые типы ограничены тем, что необходимо для однозначной компиляции в машинный код и интерфейс C. В отличие от LLVM, QBE не использует типы в качестве средства безопасности; они здесь только для смысловых целей.

The IL makes minimal use of types. By design, the types used are restricted to what is necessary for unambiguous compilation to machine code and C interfacing. Unlike LLVM, QBE is not using types as a means to safety; they are only here for semantic purposes.

Четыре базовых типа: w (word), l (long), s (single) и d (double), соответственно для 32-битных и 64-битных целых чисел, и 32-битных и 64-битных чисел с плавающей точкой. Типы указателей недоступны; указатели представляются целым типом, размерности которого достаточно, чтобы представлять все адреса памяти (например, l (long) на 64-разрядных архитектурах). Временные переменные в промежуточном языке могут иметь только базовый тип.

The four base types are w (word), l (long), s (single), and d (double), they stand respectively for 32-bit and 64-bit integers, and 32-bit and 64-bit floating-point numbers. There are no pointer types available; pointers are typed by an integer type sufficiently wide to represent all memory addresses (e.g., l on 64-bit architectures). Temporaries in the IL can only have a basic type.

Расширенные типы содержат базовые типы плюс b (byte) и h (half word) соответственно для 8-битных и 16-битных целых чисел. Они используются в определениях составных типов данных и Данных. Для C-интерфейса промежуточный язык также предоставляет пользовательские составные типы. Синтаксис, используемый для их обозначения : foo.

Extended types contain base types plus b (byte) and h (half word), respectively for 8-bit and 16-bit integers. They are used in Aggregate Types and Data definitions. For C interfacing, the IL also provides user-defined aggregate types. The syntax used to designate them is :foo.



Источник: c9x.me