Creating Textual Language Dialects Using Aspect-like Techniques Andrey Breslav? St. Petersburg State University of IT, Mechanics and Optics [email protected]

We present a work aimed on efficiently creating textual language dialects and supporting tools for them (e.g. compiler front-ends, IDE support, prettyprinters, etc.). A dialect is a language which may be described with a (relatively small) set of changes to some other language. For example we can consider SQL dialects used in DB-management systems. The need in creating dialects is witnessed by existence of extensible languages like LISP and many more [1–4]. There also are special tools supporting dialect development for C [5] and Java [6]. These approaches allow extending languages efficiently, but it took a lot of work to make it possible for each single language. The problem we are addressing here is how can we do it for arbitrary languages with not so much effort? If we need only a syntax checker for a language, creating dialects for it is easy. We have a grammar describing the language syntax and all we need is to modify this grammar. This can be done easily by a transformation which may be formulated in terms of aspect application (analogous to AOP [7]), we call such transformations syntactical aspects. By pattern matching aspects identify places in the source grammar that we need to modify and provide instructions for such modifications: insert something before or after the specified point, or replace the object with some other one. For example, assume we have a grammar for arithmetical expressions for real numbers: sum : mult (’+’ mult)*; mult : factor (’*’ factor)*; factor : REAL : ’(’ sum ’)’ ; We may want to replace reals with integers and introduce variables in this grammar, this could be done by modifying rules for factor as follows: factor $production=|: REAL @REAL.instead = << INT >> ?

Main results presented in this paper are accepted for publication in journal Vestink SPbSU ITMO. The work is partially supported by Saint-Petersburg State grant #3.11/4-05/55

@production.after = <<: ID >> ; This replaces one token reference with another and inserts a new production rule. Many real-world grammar transformations which are needed for dialect creation are easily expressible in this manner. Things become less obvious when we need something more than a parser. Assume we are working with a language front-end that supports parsing error recovery, semantic checking and abstract syntax tree creation. Now we need to transform the whole system, not only the grammar, and changes to all parts must be coherent. To achieve this we can observe that in most cases a structure of front-end features is highly dependent on the grammar structure – high-level descriptions of features like semantic analysis or error-recovery are structured the same way as the grammar is. If we could reuse the grammar structure in these definitions, namely, provide explicit connection of definition parts to grammar objects, we would be able to transform the whole system coherently since all the structural changes would be induced by grammar changes. We propose an approach which is based on this idea. In this approach all the features of the system are described by high-level models, which are attached to corresponding grammar objects. The working code is generated using information from these models. Technically model data is divided into name-value pairs (where values may be of different types) and attached to grammar objects with aspect-like rules. We call this metadata aspects. The way of assigning metadata enables high modularity since we do not need to specify all metadata in a single definition, but we are able to define a separate definition for each aspect of the system. After metadata is assigned, all the changes to grammar structure automatically rearrange it, which is ensured by special integrity checkers. This makes dialect development very easy since in many cases all we need to create a dialect is to write a syntactical aspect to transform a grammar.

References 1. Moon, D. A.: Programming Language for Old Timers. (2008), http://users.rcn. com/david-moon/PLOT/ 2. Skalski, K., Moskal, M., Olszta, P.: Meta-programming in Nemerle. (2004), http: //nemerle.org/metaprogramming.pdf 3. Sassenrath, C.: The REBOL Scripting Language. j-DDJ. 25(7) 66–69 (2000) 4. Tratt, L.: The Converge programming language. Technical report TR-05-01, Department of Computer Science, Kings College London (2005) 5. Grimm, R.: XTC: Making C safely extensible. In: Workshop on Domain-Specific Languages for Numerical Optimization, Argonne National Laboratory (2004) 6. Nystrom, N., Clarkson, M. R., Myers A. C.: Polyglot: An Extensible Compiler Framework for Java. In: 12th International Conference on Compiler Construction, pp. 138–152. Springer-Verlag (2003) 7. Kiczales, G., Lamping, J., Mendhekar, A., Maeda, C., Lopes, C. V., Loingtier, J. M., Irwin, J.: Aspect-oriented programming. In: ECOOP. Springer-Verlag (1997)

Creating Textual Language Dialects Using Aspect-like ...

and supporting tools for them (e.g. compiler front-ends, IDE support, pretty- printers, etc.). A dialect ... be formulated in terms of aspect application (analogous to AOP [7]), we call ... In: 12th International Conference on Compiler Construction, pp.

65KB Sizes 0 Downloads 135 Views

Recommend Documents

Creating Textual Language Dialects Using Aspect-like ...
If we need only a syntax checker for a language, creating dialects for it is easy. We have a ... be formulated in terms of aspect application (analogous to AOP [7]), we call such transformations ... same way as the grammar is. If we could reuse the .

PARSER EVALUATION USING TEXTUAL ENTAILMENTS by ... - CMPE
B.S., Computer Engineering, Bo˘gaziçi University, 2007. Submitted ... Graduate Program in Computer Engineering ..... In Canada, seal-hunting means jobs, but.

PARSER EVALUATION USING TEXTUAL ENTAILMENTS by ... - CMPE
B.S., Computer Engineering, Bo˘gaziçi University, 2007. Submitted to the Institute for Graduate Studies in. Science and Engineering in partial fulfillment of the requirements ..... noisy data is not meaningful and may give incorrect assessments and

Creating covariates using cohort attributes - GitHub
Mar 28, 2016 - 3.1 Creating the cohort attributes and attributes definitions . ... covariate builders that create covariates on the fly and can be re-used across ...

Creating Thinking Maps Using PowerPoint
Jul 21, 2008 - shapes using auto shapes. ▫ Use text boxes where needed. ▫ Insert pictures using clip art. ▫ Apply sounds and animation using action settings. Sports ... Three Little. Pigs. Goldilocks and the. Three. Bears. Animals. Woods. Wolf.

Using Specialized Monolingual Native-Language ...
trated in table 4, the end result was four files which contained a total of approximately. 1.5 million words and ... (e.g. AI Expert, IBM Journal of Research and.

LANGUAGE IDENTIFICATION USING A COMBINED ...
over the baseline system. Finally, the proposed articulatory language. ID system is combined with a PPRLM (parallel phone recognition language model) system ...

Telephone Roleplays and Useful Language - Using English
you need to speak to (= You don't have a name). ... 20 Phone someone and talk about the details of a website (getting them to get ... Can I just check your name?

Spandanam_111 questions on Using Language Elements-signed.pdf
The father left the rabbit in the field. Without any delay it ran into the woods. 19.Think-Tank ordered the Martians to leave the earth. They obeyed his order as. fast as possible. 20.The principal informed Martha that she would get the Jacket. She l

RAPID LANGUAGE MODEL DEVELOPMENT USING ...
RAPID LANGUAGE MODEL DEVELOPMENT USING EXTERNAL RESOURCES. FOR NEW ... tention when using web data for language modeling: 1) query.

Telephone Roleplays and Useful Language - Using English
leave a message including a website address. 16 Phone reception and ask to be put through to someone. They are not available, so leave a message including ...

RAPID LANGUAGE MODEL DEVELOPMENT USING ...
We are aware of three recent studies in language .... internal call centers where customers having trouble with their ..... Three way interpolation of SCLM,.

Using Specialized Monolingual Native-Language ...
While descriptive translation studies and computer applications for corpora are ... Popular science texts and magazines are sometimes helpful in providing .... graduate studies and had followed a minimum of 3 courses in translation and 6 courses ....

LANGUAGE MODEL ADAPTATION USING RANDOM ...
Broadcast News LM to MIT computer science lecture data. There is a ... If wi is the word we want to predict, then the general question takes the following form:.

Tips for Creating a Block Language with Blockly Developers
should carefully consider the style, which blocks to use, and what. APIs and language features are right for their audience. Index Terms—Education; visual programming; computer sci- ence; developer tools; language design. I. INTRODUCTION. A. Visual

INTRODUCING TEXTUAL EVIDENCE IN YOUR BLOG.pdf ...
INTRODUCING TEXTUAL EVIDENCE IN YOUR BLOG.pdf. INTRODUCING TEXTUAL EVIDENCE IN YOUR BLOG.pdf. Open. Extract. Open with. Sign In.

GRAPHIC AND TEXTUAL STANDARDS FOR CORPORATE IDENTITY
Apr 12, 2016 - These procedures are developed in support of Board Policy #1. Procedures. 1. The district logo, or its namebar, including its typestyle, size and ...

towards acoustic model unification across dialects - Research at Google
tools simultaneously trained on many dialects fail to generalize well for any of them, ..... neural network acoustic model with accent-specific top layer using the ...

CREATING A REAL-TIME dashboard APP FOR TWITTER USING ...
When something could have changed, re-render everything to a new DOM-representation. 2.Diff new output with previous output. 3.Update only what has ...

Creating Personal Histories from the Web using ...
Jun 2, 2005 - It is said that queries containing a person's name account for 5-10% of all Web ... increase as Web relationships become more and more common, as evidenced by the explosion of social networking services such as MySpace.

Creating a Profitable Betting Strategy for Football by Using ... - CiteSeerX
10 required by spread betting companies due to the fact that they are governed by ...... software for fitting the multinomial ordered probit model was not generally.