Typedef

14,000,000 Leading Edge Experts on the ideXlab platform

Scan Science and Technology

Contact Leading Edge Experts & Companies

Scan Science and Technology

Contact Leading Edge Experts & Companies

The Experts below are selected from a list of 147 Experts worldwide ranked by ideXlab platform

Derek M. Jones - One of the best experts on this subject based on the ideXlab platform.

  • The New C Standard (Excerpted material) An Economic and Cultural Commentary
    2013
    Co-Authors: Derek M. Jones
    Abstract:

    declarator syntax 6.7.5 Declarators declarator: pointeropt direct-declarator direct-declarator: identifier ( declarator) direct-declarator [ type-qualifier-listopt assignment-expressionopt] direct-declarator [ static type-qualifier-listopt assignment-expression] direct-declarator [ type-qualifier-list static assignment-expression] direct-declarator [ type-qualifier-listopt *] direct-declarator ( parameter-type-list) direct-declarator ( identifier-listopt) pointer: * type-qualifier-list opt * type-qualifier-list opt pointer type-qualifier-list: type-qualifier type-qualifier-list type-qualifier parameter-type-list: parameter-list parameter-list,... parameter-list: parameter-declaration parameter-list, parameter-declaration parameter-declaration: declaration-specifiers declarator declaration-specifiers abstract-declarator opt identifier-list: identifier identifier-list, identifier 1547 parameter declaration Typedef name in parentheses Commentary Parentheses can be used to change the way tokens in declarators are grouped in a similar way to the grouping of operands in an expression. The declaration of function parameters does not have the flexibility available to declarations that are not parameters. For instance, it is not possible to write void f(double a, b, c) instead of void f(double a, int b, int c). C90 Support for the syntax: direct-declarator [ type-qualifier-list opt assignment-expression opt] direct-declarator [ static type-qualifier-list opt assignment-expression] direct-declarator [ type-qualifier-list static assignment-expression] direct-declarator [ type-qualifier-list opt *] is new in C99. Also the C90 Standard only supported the form: direct-declarator [ constant-expression opt

  • 6.7.7 Type definitions
    2012
    Co-Authors: Derek M. Jones
    Abstract:

    Typedef name syntax Typedef-name: identifier 1629 name space ordinary identifiers Commentary A Typedef name exists in the same name space as ordinary identifiers. The information that differentiates an identifier as a Typedef-name, from other kinds of identifiers is the visibility, or not, of a Typedef definition of that identifier. For instance, given the declarations: 1 Typedef int type_ident; 2 type_ident(D_1); / * Function call or declaration of D_1? */ 3 type_ident * D_2; / * Multiplication or declaration of D_2? */ typede

  • The New C Standard (Excerpted material) An Economic and Cultural Commentary
    2012
    Co-Authors: Derek M. Jones
    Abstract:

    In the syntax notation used in this clause, syntactic categories (nonterminals) are indicated by italic type, and literal words and character set members (terminals) by bold type. Commentary A terminal is a token that can appear in the source code. A nonterminal is the name of a syntax rule used to group together zero or more terminals and other nonterminals. The nonterminals can be viewed as a tree. The root is the nonterminal translation-unit. The terminals are the leaves of this tree. Syntax analysis is the processing of a sequence of terminals (as written in the source) via various nonterminals until the nonterminal translation-unit is reached. Failure to reach this final nonterminal, or encountering an unexpected sequence of tokens, is a violation of syntax. The syntax notation used in the C Standard is not overly formal; it is often supported by text in the semantics clause. The C syntax can be written in LALR(1) form. (Although some reorganization of the productions listed in the standard is needed), assuming the Typedef issue is fudged (the only way to know whether an identifier is a Typedef name or not is to look it up in a symbol table, which introduces a context dependency; the alternative of syntactically treating a Typedef name as an identifier requires more than one token lookahead.) This also happens to be the class of grammars that can be processed by yacc and man

  • 6.3 Conversions
    2012
    Co-Authors: Derek M. Jones
    Abstract:

    operand convert automatically object?? int type only Typedef name syntax Several operators convert operand values from one type to another automatically. Commentary The purpose of these implicit conversions is to reduce the number of type permutations that C operators have to deal with. Forcing developers to use explicit casts was considered unacceptable. There is also the practical issue that most processors only contain instructions that can operate on a small number of scalar types. Other Languages There are two main lines of thinking about binary operators whose operands have different types. One is to severely restrict the possible combination of types that are permitted, requiring the developer to explicitly insert casts to cause the types to match. The other (more developer-friendly, or the irresponsible approach

  • The New C Standard (Excerpted material) An Economic and Cultural Commentary
    2012
    Co-Authors: Derek M. Jones
    Abstract:

    6.2.3 Name spaces of identifiers 6.2.3 Name spaces of identifiers name space tag 441 name space If more than one declaration of a particular identifier is visible at any point in a translation unit, the syntactic context disambiguates uses that refer to different entities. Commentary At a particular point in the source it is possible to have the same identifier declared and visible as a label, object/function/Typedef/enumeration constant, enum/structure/union tag, and a potentially infinite number of member names. Syntactic context in C is much more localized than in human languages. For instance, in “There is a sewer near our home who makes terrific suites, ” the word sewer is not disambiguated until at least four words after it occurs. In C the token before an identifier (->,., struct, union, and enum) disambiguates some name spaces. Identifiers used as labels require a little more context because the following: token can occur in several other contexts

Matthias Blume - One of the best experts on this subject based on the ideXlab platform.

  • No-longer-foreign: Teaching an ML compiler to speak C natively
    2001
    Co-Authors: Matthias Blume
    Abstract:

    We present a new foreign-function interface for SML/NJ. It is based on the idea of data-level interoperability—the ability of ML programs to inspect as well as manip-ulate C data structures directly. The core component of this work is an encoding of the almost 2 complete C type system in ML types. The encoding makes extensive use of a “folklore ” typing trick, taking advantage of ML’s polymorphism, its type constructors, its abstraction mechanisms, and even functors. A small low-level component which deals with C struct and union declarations as well as program linkage is hidden from the programmer’s eye by a simple program-generator tool that translates C declarations to corresponding ML glue code. 1 An example Suppose you are an ML programmer who wants to link a program with some C routines. The following example (designed to demonstrate data-level inter-operability rather than motivate the need for FFIs in the first place) there are two C functions: input reads a list of records from a file and findmin returns the record with the smallest i in a given list. The C library comes with a header file ixdb.h that describes this interface: Typedef struct record *list; struct record { int i; double x; list next;}; extern list input (char *); extern list findmin (list); Our ml-nlffigen tool translates ixdb.h into an ML interface that cor-responds nearly perfectly to the original C interface. Moreover, we hooked ml-nlffigen into the compilation manager CM [2] of SML/NJ [1] in such a 2 Variable-argument functions are the only feature of the C type system that we do not handle very well yet

  • No-longer-foreign: Teaching an ML compiler to speak C “natively
    2001
    Co-Authors: Matthias Blume
    Abstract:

    We present a new foreign-function interface for SML/NJ. It is based on the idea of datalevel interoperability—the ability of ML programs to inspect as well as manipulate C data structures directly. The core component of this work is an encoding of the almost 2 complete C type system in ML types. The encoding makes extensive use of a “folklore ” typing trick, taking advantage of ML’s polymorphism, its type constructors, its abstraction mechanisms, and even functors. A small low-level component which deals with C struct and union declarations as well as program linkage is hidden from the programmer’s eye by a simple program-generator tool that translates C declarations to corresponding ML glue code. 1 An example Suppose you are an ML programmer who wants to link a program with some C routines. The following example (designed to demonstrate data-level interoperability rather than motivate the need for FFIs in the first place) there are two C functions: input reads a list of records from a file and findmin returns the record with the smallestiin a given list. The C library comes with a header fileixdb.h that describes this interface: Typedef struct record *list; struct record { int i; double x; list next;}; extern list input (char *); extern list findmin (list); Our ml-nlffigen tool translates ixdb.h into an ML interface that corresponds nearly perfectly to the original C interface. Moreover, we hooked mlnlffigen into the compilation manager CM [2] of SML/NJ [1] in such a way 2 Variable-argument functions are the only feature of the C type system that we do not handle very well yet

Joachim Breitner - One of the best experts on this subject based on the ideXlab platform.

  • a b c The General Triangle Is Unique
    2011
    Co-Authors: Joachim Breitner
    Abstract:

    Some acute-angled triangles are special, e.g. right-angled or isosceles tri-angles. Some are not of this kind, but, without measuring angles, look as if they are. In that sense, there is exactly one general triangle. This well-known fact[1] is proven here formally. theory GeneralTriangle imports Complex-Main begin 1 Type definitions Since we are only considering acute-angled triangles, we define angles as numbers from the real interval [0... 90]. abbreviation angles ≡ { x::real. 0 ≤ x ∧ x ≤ 90} Triangles are represented as lists consisting of exactly three angles which add up to 180°. As we consider triangles up to similarity, we assume the angles to be given in ascending order. Isabelle expects us to prove that the type is not empty, which we do by an example. definition triangle = { l. l ∈ lists angles ∧ length l = 3 ∧ listsum l = 180 ∧ 1 sorted l Typedef triangle = triangl

  • c a b The General Triangle Is Unique
    2011
    Co-Authors: Joachim Breitner
    Abstract:

    Some acute-angled triangles are special, e.g. right-angled or isosceles triangles. Some are not of this kind, but, without measuring angles, look as if they are. In that sense, there is exactly one general triangle. This well-known fact[1] is proven here formally. theory GeneralTriangle imports Complex-Main begin 1 Type definitions Since we are only considering acute-angled triangles, we define angles as numbers from the real interval [0... 90]. abbreviation angles ≡ { x::real. 0 ≤ x ∧ x ≤ 90} Triangles are represented as lists consisting of exactly three angles which add up to 180°. As we consider triangles up to similarity, we assume the angles to be given in ascending order. Isabelle expects us to prove that the type is not empty, which we do by an example. definition triangle = { l. l ∈ lists angles ∧ length l = 3 ∧ listsum l = 180 ∧ 1 sorted l Typedef triangle = triangle unfolding triangle-def apply (rule-tac x = [45,45,90] in exI) apply auto done For convenience, the following lemma gives us easy access to the three angles of a triangle and their properties. lemma unfold-triangle: obtains a b c where Rep-triangle t = [a,b,c] and a ∈ angles and b ∈ angles and c ∈ angles and a + b + c = 180 and a ≤ b and b ≤ c proof− obtain a b c wher

  • c a b The General Triangle Is Unique
    2011
    Co-Authors: Joachim Breitner
    Abstract:

    Some acute-angled triangles are special, e.g. right-angled or isosceles triangles. Some are not of this kind, but, without measuring angles, look as if they are. In that sense, there is exactly one general triangle. This well-known fact[1] is proven here formally. theory GeneralTriangle imports Complex-Main begin 1 Type definitions Since we are only considering acute-angled triangles, we define angles as numbers from the real interval [0... 90]. abbreviation angles ≡ { x::real. 0 ≤ x ∧ x ≤ 90} Triangles are represented as lists consisting of exactly three angles which add up to 180°. As we consider triangles up to similarity, we assume the angles to be given in ascending order. Isabelle expects us to prove that the type is not empty, which we do by an example. definition triangle = { l. l ∈ lists angles ∧ length l = 3 ∧ listsum l = 180 ∧ 1 sorted l Typedef triangle = triangle 〈proof 〉 For convenience, the following lemma gives us easy access to the three angles of a triangle and their properties. lemma unfold-triangle: obtains a b c where Rep-triangle t = [a,b,c] and a ∈ angles and b ∈ angles and c ∈ angles and a + b + c = 180 and a ≤ b and b ≤ c 〈proof 〉 2 Property definitions Two angles can be considered too similar if they differ by less than 15°. This number is obtained heuristically by a field experiment with an 11th grade class and was chosen that statistically, 99 % will consider the angles as different. definition similar-angle:: real ⇒ real ⇒ bool (infix ∼ 50) where similar-angle x y = (abs (x − y) < 15) The usual definitions of right-angled and isosceles, using the just introduced similarity for comparison of angles. definition right-angled where right-angled l = ( ∃ x ∈ set (Rep-triangle l). x ∼ 90) definition isosceles where isosceles l = ((Rep-triangle l) ! 0 ∼ (Rep-triangle l) ! 1 ∨ (Rep-triangle l) ! 1 ∼ (Rep-triangle l) ! (Suc 1)) A triangle is special if it is isosceles or right-angled, and general if not. Equilateral triangle are isosceles and thus not mentioned on their own here. definition special where special t = (isosceles t ∨ right-angled t) definition general where general t = ( ¬ special t

Kimio Kuramitsu - One of the best experts on this subject based on the ideXlab platform.

  • a symbol based extension of parsing expression grammars and context sensitive packrat parsing
    Software Language Engineering, 2017
    Co-Authors: Kimio Kuramitsu
    Abstract:

    Parsing expression grammars (PEGs) are a powerful and popular foundation for describing syntax. Despite PEGs' expressiveness, they cannot recognize many syntax patterns of popular programming languages. Typical examples include Typedef-defined names in C/C++ and here documents appearing in many scripting languages. We use a single unified state representation, called a symbol table, to capture various context-sensitive patterns. Over the symbol table, we design a small set of restricted semantic predicates and actions. The extended PEGs are called SPEGs, and are designed to be safe in contexts of backtracking and the linear time guarantee of packrat parsing. This paper will show that SPEGs have improved the expressive power in such ways that they recognize practical context-sensitive grammars, including back referencing, indentation-based code layout, and contextual keywords.

Kuramitsu Kimio - One of the best experts on this subject based on the ideXlab platform.

  • A declarative extension of parsing expression grammars for recognizing most programming languages
    2015
    Co-Authors: Matsumura Tetsuro, Kuramitsu Kimio
    Abstract:

    Parsing Expression Grammars are a popular foundation for describing syntax. Unfortunately, several syntax of programming languages are still hard to recognize with pure PEGs. Notorious cases appears: Typedef-defined names in C/C++, indentation-based code layout in Python, and HERE document in many scripting languages. To recognize such PEG-hard syntax, we have addressed a declarative extension to PEGs. The "declarative" extension means no programmed semantic actions, which are traditionally used to realize the extended parsing behavior. Nez is our extended PEG language, including symbol tables and conditional parsing. This paper demonstrates that the use of Nez Extensions can realize many practical programming languages, such as C, C\#, Ruby, and Python, which involve PEG-hard syntax.Comment: To appear in Journal of Information Processing, 24(2), 201