Efficient parsing with parser combinators
Autoři
Kurš, J.; Vraný, J.; Ghafari, M.
Rok
2018
Publikováno
Science of Computer Programming. 2018, 161 57-88. ISSN 0167-6423.
Typ
Článek
Pracoviště
Anotace
Parser combinators offer a universal and flexible approach to parsing. They follow the structure of an underlying grammar, are modular, well-structured, easy to maintain, and can recognize a large variety of languages including context-sensitive ones. However, these advantages introduce a noticeable performance overhead mainly because the same powerful parsing algorithm is used to recognize even simple languages. Time-wise, parser combinators cannot compete with parsers generated by well-performing parser generators or optimized hand-written code.
Techniques exist to achieve a linear asymptotic performance of parser combinators, yet there is a significant constant multiplier. The multiplier can be lowered to some degree, but this requires advanced meta-programming techniques, such as staging or macros, that depend heavily on the underlying language technology.
In this work we present a language-agnostic solution. We optimize the performance of parsing combinators with specializations of parsing strategies. For each combinator, we analyze the language parsed by the combinator and choose the most efficient parsing strategy. By adapting a parsing strategy for different parser combinators we achieve performance comparable to that of hand-written or optimized parsers while preserving the advantages of parsers combinators.
On the Integration of Smalltalk and Java
Autoři
Hlopko, M.; Vraný, J.; Kurš, J.; Gittinger, C.
Rok
2014
Publikováno
Science of Computer Programming. 2014, 96(1), 17-33. ISSN 0167-6423.
Typ
Článek
Anotace
After decades of development in programming languages and programming environments, Smalltalk is still one of few environments that provide advanced features and is used in the industry. However, as Java became prevalent, the ability to call a Java code from Smalltalk became important. A traditional approach to integrate the Java and Smalltalk languages is through low-level communication between separate Java and Smalltalk virtual machines. To our best knowledge there is no other project attempting to execute and integrate the Java language directly in the Smalltalk environment. A direct integration allows for a very tight integration of the languages and their objects within a single environment. Yet integration and language interoperability impose challenging issues related to method naming conventions, method overloading, exception handling and thread-locking mechanisms.
In this paper we describe ways to overcome these challenges and to integrate Java into the Smalltalk environment. We focus on a possibility to call a Java code from Smalltalk using standard Smalltalk idioms while the semantics of both languages remains preserved. We present stx:libjava – an implementation of a Java virtual machine within Smalltalk/X – as a validation of our approach.
Towards a Runtime Code Update in Java
Autoři
Hlopko, M.; Vraný, J.; Kurš, J.
Rok
2013
Publikováno
13th Annual International Workshop on Databases, Texts, Specifications, and Objects. Tilburg: CEUR Workshop Proceedings, 2013. pp. 13-31. ISSN 1613-0073.
Typ
Stať ve sborníku
Anotace
Runtime Code Update is a technique to update a program while
it is running. Such a feature is often used so
the developer can modify an application without the necessity to restart the
application and recover desired
state after restart. This saves time and lowers costs. Furthermore, there
are applications which cannot be stopped, such as air traffic control systems or
telephone switches. Current virtual machines for Java programming language do
not support non-trivial updates to the running code. We have modified
STX:LIBJAVA -- an implementation of Java virtual machine within Smalltalk/X --
to support arbitrary changes to the running code. Beside
changes to the fields and methods which are already supported by the tools such as
JRebel or Javaleon, we also support unrestricted changes to the class and
interface hierarchy. Our Runtime Code Updates scheme has been integrated into
the Smalltalk/X IDE, thus providing interactive environment where a developer
can modify a Java application while it is running.
Efficient Method Lookup Customization for Smalltalk
Autoři
Vraný, J.; Kurš, J.; Gittinger, C.
Rok
2012
Publikováno
Objects, Models, Components, Patterns. Berlin: Springer, 2012. pp. 124-139. ISSN 0302-9743. ISBN 978-3-642-30560-3.
Typ
Stať ve sborníku
Pracoviště
Anotace
Programming languages are still evolving, and programming languages and language features are being designed and implemented every year. Since it is not a trivial task to provide a runtime system for a new language, existing runtime systems such as the Java Virtual Machine or the Common Language Runtime are used to host the new language.
However, most of the high-performance runtime systems were designed for a specific language with a specific semantics. Therefore, if the new language semantics differs from the semantics hard-coded in a runtime system, it has to be emulated on top of features supported by the runtime.
The emulation causes performance overhead.
To overcome the limitations of an emulation, a runtime system may provide a meta-object protocol to alter the runtime semantics. The protocol should fulfill opposing goals: it should be flexible, easy to use, fast and easy to implement at the same time.
We propose a simple meta-object protocol for customization of a method lookup in Smalltalk. A programmer may define his own custom method lookup routine in Smalltalk and let the runtime system to call it when needed. Therefore there is no need to modify the runtime system itself. Our solution provides reasonable performance thanks to low-level support in a runtime system, nevertheless the changes to the runtime system are small and local. At the same time, it provides the flexibility to implement a wide range of features present in modern programming languages.
The presented approach has been implemented and validated on a Smalltalk virtual machine.
On the Integration of Smalltalk and Java
Autoři
Hlopko, M.; Kurš, J.; Vraný, J.; Gittinger, C.
Rok
2012
Publikováno
Proceedings of the 4th edition of International Workshop on Smalltalk Technologies. New York: ACM, 2012. pp. 7-18. ISBN 978-1-4503-1897-6.
Typ
Stať ve sborníku
Anotace
After decades of development in programming languages
and programming environments, Smalltalk is still one of
few environments that provide advanced features and is still
widely used in the industry. However, as Java became preva-
lent, the ability to call Java code from Smalltalk and vice
versa becomes important. Traditional approaches to inte-
grate the Java and Smalltalk languages are through low-level
communication between separate Java and Smalltalk virtual
machines.
We are not aware of any attempt to execute
and integrate the Java language directly in the Smalltalk en-
vironment. A direct integration allows for very tight and
almost seamless integration of the languages and their ob-
jects within a single environment. Yet integration and lan-
guage interoperability impose challenging issues related to
method naming conventions, method overloading, exception
handling and thread-locking mechanisms.
In this paper we describe ways to overcome these chal-
lenges and to integrate Java into the Smalltalk environment.
Using techniques described in this paper, the programmer
can call Java code from Smalltalk using standard Smalltalk
idioms while the semantics of each language remains pre-
served. We present STX : LIBJAVA — an implementation of
Java virtual machine within Smalltalk/X — as a validation
of our approach.
Supporting Language Interoperability by Dynamically Switched Behaviors
Autoři
Kurš, J.; Vraný, J.
Rok
2011
Publikováno
DATESO 2011. Ostrava: VŠB - Technical University of Ostrava, 2011. p. 73-84. 1. ISSN 1613-0073. ISBN 978-80-248-2391-1.
Typ
Stať ve sborníku
Pracoviště
Anotace
Software programs are often written in more than one programming
language as the emergence of domain specific languages testifies. Language in-
terpreters are easily embeddable and performances are usually satisfactory. How-
ever, inter-language interaction remains a field tarnished by poor performances.
The reason is that alien objects are wrapped, implying the use of expensive for-
warding and converting mechanism.
We propose to represent alien objects as the set of different states and behaviors it
may have by moving between languages, thus avoiding wrapping and conversion.
We have validated our solution on integration of Java and Smalltalk programming
languages.
Deferred node-copying scheme for XQuery processors
Autoři
Kurš, J.; Vraný, J.
Rok
2010
Publikováno
DATESO 2010. Praha: Matfyzpress, 2010. p. 131-138. ISSN 1613-0073. ISBN 978-80-7378-116-3.
Typ
Stať ve sborníku
Pracoviště
Anotace
XQuery is generic, widely adopted language for querying and
manipulating XML data. Many of currently available native
XML databases are using XQuery as its primary query language.
The XQuery specification requires each XML node to belong to exactly
one XML tree. In case of the XML subtree is appended into a new
XML structure, the whole subtree has to be copied and afterwards
the copy is appended to the new structure. This may lead into excessive and
unnecessary data copying and duplication.
In this paper, we present a new XML node copying scheme that defers
the node data copy operation unless necessary. We will show that this schemes
significantly reduces the XML node copy operations required during the query
processing.