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

Материал из Compilers Wiki
Перейти к: навигация, поиск
Строка 11: Строка 11:
 
: <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. Details about their definition are given in the Aggregate Types section.</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. Details about their definition are given in the Aggregate Types section.</pre>
  

Версия 02:54, 14 марта 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. Details about their definition are given in the Aggregate Types section.



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