1,412 research outputs found

    User Manual for Ox: An Attribute-Grammar Compiling System based on Yacc, Lex, and C

    Get PDF
    Ox generalizes the function of Yacc in the way that attribute grammars generalize context-free grammars. Ordinary Yacc and Lex specifications may be augmented with definitions of synthesized and inherited attributes written in C syntax. From these specifications, Ox generates a program that builds and decorates attributed parse trees. Ox accepts a most general class of attribute grammars. The user may specify postdecoration traversals for easy ordering of side effects such as code generation. Ox handles the tedious and error-prone details of writing code for parse-tree management, so its use eases problems of security and maintainability associated with that aspect of translator development. The translators generated by Ox use internal memory management that is often much faster than the common technique of calling malloc once for each parse-tree node. Ox is a Yacc/Lex/C preprocessor, and is designed to bring attribute grammars closer to the mainstream of Unix-based language development. Ox inherits all of the familiar syntax and semantics of Yacc, Lex, and C. It is relatively easy to convert programs between Ox code and pure Yacc/Lex/C code. Ox has been used to build a compiler for a small (eighty grammar rules) block-structured imperative programming language. This document is the main reference for using Ox

    Reducing branch delay to zero in pipelined processors

    Get PDF
    A mechanism to reduce the cost of branches in pipelined processors is described and evaluated. It is based on the use of multiple prefetch, early computation of the target address, delayed branch, and parallel execution of branches. The implementation of this mechanism using a branch target instruction memory is described. An analytical model of the performance of this implementation makes it possible to measure the efficiency of the mechanism with a very low computational cost. The model is used to determine the size of cache lines that maximizes the processor performance, to compare the performance of the mechanism with that of other schemes, and to analyze the performance of the mechanism with two alternative cache organizations.Peer ReviewedPostprint (published version

    Methodic of joint using the tools of automation of lexical and parsing analysis in the process of teaching the programming theory of future informatics teachers

    Get PDF
    Цілі дослідження: розробити методику спільного використання засобів автоматизації лексичного та синтаксичного аналізу lex та yacc у процесі навчання теорії програмування на основі функціональної парадигми. Завдання дослідження: визначити місце і роль синтаксичного аналізу у формуванні професійних інформатичних компетентностей майбутніх учителів інформатики; визначити засоби автоматизації розробки компіляторів у навчанні теорії програмування; розробити основні компоненти методики спільного використання засобів автоматизації лексичного та синтаксичного аналізу в процесі навчання теорії програмування майбутніх учителів інформатики. Об’єкт дослідження: навчання теорії програмування майбутніх учителів інформатики. Предмет дослідження: використання засобів автоматизації лексичного та синтаксичного аналізу в процесі навчання теорії програмування майбутніх учителів інформатики. Використані методи дослідження: аналіз наукових публікацій, самоаналіз досвіду роботи, проектування методики. Результати дослідження. Визначено місце і роль синтаксичного аналізу у формуванні професійних інформатичних компетентностей майбутніх учителів інформатики. Виокремлені засоби автоматизації лексичного (lex) та синтаксичного (yacc) аналізу, інваріантні до використовуваної мови програмування. Показано доцільність використання мов функціонального програмування Scheme та SML для навчання методів розробки компіляторів у курсі теорії програмування. На прикладі діалекту MosML проілюстровано основні компоненти методики спільного використання засобів автоматизації лексичного та синтаксичного аналізу в процесі навчання теорії програмування майбутніх учителів інформатики. Основні висновки і рекомендації: 1) розглянутий приклад розширеного калькулятора може бути доопрацьований шляхом зміни граматики, зокрема – для уведення умовних та циклічних конструкцій; 2) запропонована схема може бути застосована для реалізації інтерпретатора будь-якої формальної мови з довільним способом типізації – доцільними навчальними прикладами будуть підмножини процедурних мов Basic та C й функціональних Scheme та SML: за умови додавання фази генерації машинного коду це надає можливість продемонструвати повний цикл розробки компілятора мови програмування.Research goals: to develop a methodic of joint using the tools of automation of lexical (lex) and parsing (yacc) analysis in the process of teaching the programming theory based on a functional paradigm. Research objectives: to determine the place and role of parsing analysis in the formation of professional informatics competences of future informatics teachers; to define tools of compilers development automation in teaching the programming theory; to develop the main components of the methodic of joint using the tools of automation of lexical and parsing analysis in the process of teaching the programming theory of future informatics teachers. Object of research: teaching the programming theory of future informatics teachers. Subject of research: the use of the tools of automation of lexical and parsing analysis in the process of teaching the programming theory of future informatics teachers. Research methods used: analysis of scientific publications, self-analysis of work experience, methodic design. Results of the research. The place and role of parsing analysis in formation of professional informatics competences of future informatics teachers is determined. Separated automation tools for lexical (lex) and syntax (yacc) analysis invariant to the programming language used. The expediency of using functional programming languages Scheme and SML is shown for learning how to develop compilers in the course of programming theory. The example of the MosML dialect illustrates the main components of the methodic of joint using the tools of automation of lexical and parsing analysis in the process of teaching the programming theory of future informatics teachers. The main conclusions and recommendations: 1) the considered example of the expanded calculator can be refined by changing the grammar, in particular – for the introduction of conditional and cyclic constructions; 2) the proposed scheme can be used to implement the interpreter of any formal language with an arbitrary typing method – the appropriate examples of study will be subsets of procedural languages Basic and C and functional languages Scheme and SML: provided the addition of the machine code generation phase, this provides an opportunity to demonstrate the full development cycle for programming language compiler

    Simple algebraic data types for C

    Get PDF
    ADT is a simple tool in the spirit of Lex and Yacc that makes algebraic data types and a restricted form of pattern matching on those data types as found in SML available in C programs. ADT adds runtime checks, which make C programs written with the aid of ADT less likely to dereference a NULL pointer. The runtime tests may consume a significant amount of CPU time; hence they can be switched off once the program is suitably debugged
    corecore