541 research outputs found
On the Complexity and Performance of Parsing with Derivatives
Current algorithms for context-free parsing inflict a trade-off between ease
of understanding, ease of implementation, theoretical complexity, and practical
performance. No algorithm achieves all of these properties simultaneously.
Might et al. (2011) introduced parsing with derivatives, which handles
arbitrary context-free grammars while being both easy to understand and simple
to implement. Despite much initial enthusiasm and a multitude of independent
implementations, its worst-case complexity has never been proven to be better
than exponential. In fact, high-level arguments claiming it is fundamentally
exponential have been advanced and even accepted as part of the folklore.
Performance ended up being sluggish in practice, and this sluggishness was
taken as informal evidence of exponentiality.
In this paper, we reexamine the performance of parsing with derivatives. We
have discovered that it is not exponential but, in fact, cubic. Moreover,
simple (though perhaps not obvious) modifications to the implementation by
Might et al. (2011) lead to an implementation that is not only easy to
understand but also highly performant in practice.Comment: 13 pages; 12 figures; implementation at
http://bitbucket.org/ucombinator/parsing-with-derivatives/ ; published in
PLDI '16, Proceedings of the 37th ACM SIGPLAN Conference on Programming
Language Design and Implementation, June 13 - 17, 2016, Santa Barbara, CA,
US
Improving Cache Hits On Replacment Blocks Using Weighted LRU-LFU Combinations
Block replacement refers to the process of selecting a block of data or a cache line to be evicted or replaced when a new block needs to be brought into a cache or a memory hierarchy. In computer systems, block replacement policies are used in caching mechanisms, such as in CPU caches or disk caches, to determine which blocks are evicted when the cache is full and new data needs to be fetched. The combination of LRU (Least Recently Used) and LFU (Least Frequently Used) in a weighted manner is known as the "LFU2" algorithm. LFU2 is an enhanced caching algorithm that aims to leverage the benefits of both LRU and LFU by considering both recency and frequency of item access. In LFU2, each item in the cache is associated with two counters: the usage counter and the recency counter. The usage counter tracks the frequency of item access, while the recency counter tracks the recency of item access. These counters are used to calculate a combined weight for each item in the cache. Based on the experimental results, the LRU-LFU combination method succeeded in increasing cache hits from 94.8% on LFU and 95.5% on LFU to 96.6%
Phobos: A front-end approach to extensible compilers (long version)
This paper describes a practical approach for implementing certain types of domain-specific languages with extensible compilers. Given a compiler with one or more front-end languages, we introduce the idea of a "generic" front-end that allows the syntactic and semantic specification of domain-specific languages. Phobos, our generic front-end, offers modular language specification, allowing the programmer to define new syntax and semantics incrementally
Parts of Speech Tagging: Rule-Based
Parts of speech (POS) tagging is the process of assigning a word in a text as corresponding to a part of speech based on its definition and its relationship with adjacent and related words in a phrase, sentence, or paragraph. POS tagging falls into two distinctive groups: rule-based and stochastic. In this paper, a rule-based POS tagger is developed for the English language using Lex and Yacc. The tagger utilizes a small set of simple rules along with a small dictionary to generate sequences of tokens
Code Generation: An Introduction to Typed EBNF
Errors and inconsistencies between code components can be very costly in a software project. E orts to reduce these costs can include the use of tools that limit human interac- tion with code by generating it from a description. This paper introduces two new works to address these issues: (1) an input speci cation called Typed EBNF (TEBNF), and (2) a prototype tool that demonstrates how TEBNF can be used to generate code. The tool generates code for a console application as described by a TEBNF grammar. An application built from the generated code will be able to receive input data, parse it, process it, and output it as needed
Generating Code of Optimised Mathematical Operations
Bakalářská práce se zabĂ˝vá vytvoĹ™enĂm jednoduchĂ©ho programovacĂho jazyka pro práci s matematickĂ˝mi operacemi. HlavnĂm cĂlem práce je vytvoĹ™it kompilátor tohoto jazyka, kterĂ˝ pro generovánĂ instrukcĂ cĂlovĂ©ho kĂłdu vyuĹľĂvá instrukÄŤnĂ sadu technologie MMX. GenerovánĂ optimalizovanĂ©ho kĂłdu probĂhá na základÄ› upravenĂ©ho algoritmu kontextovĂ©ho generovánĂ.Bachelor's thesis deals with creating a simple programming language for working with mathematical operations. Main point of the thesis is to create a compiler of this language, which is using MMX technology to generate instructions of an assembler code. The optimized code generation is based on modified algorithm of context generation.
Formal Compiler Implementation in a Logical Framework
The task of designing and implementing a compiler can be a difficult and error-prone process. In this paper, we present a new approach based on the use of higher-order abstract syntax and term rewriting in a logical framework. All program transformations, from parsing to code generation, are cleanly isolated and specified as term rewrites. This has several advantages. The correctness of the compiler depends solely on a small set of rewrite rules that are written in the language of formal mathematics. In addition, the logical framework guarantees the preservation of scoping, and it automates many frequently-occurring tasks including substitution and rewriting strategies. As we show, compiler development in a logical framework can be easier than in a general-purpose language like ML, in part because of automation, and also because the framework provides extensive support for examination, validation, and debugging of the compiler transformations. The paper is organized around a case study, using the MetaPRL logical framework to compile an ML-like language to Intel x86 assembly. We also present a scoped formalization of x86 assembly in which all registers are immutable
- …