Ar regulārām izteiksmēm paplašinātu gramatiku dinamiska parsēšana
Author
Pečerska, Jūlija
Co-author
Latvijas Universitāte. Datorikas fakultāte
Advisor
Arnicāns, Guntis
Date
2012Metadata
Show full item recordAbstract
Mūsdienu programmēšanas valodu lielākai daļai ir statiski definēta nemainīga sintakse un tās nepiedāvā līdzekļus valodas paplašināšanai. Neskatoties uz to, ka šāds projektējums ir pamatots, tas nozīmē, ka visas, pat maznozimīgas, izmaiņas valodas sintaksē ir nepieciešams implementēt valodas kompilatorā.
Šajā darbā tiek aprakstīts mehānisms, kas ļaus lietotājam paplašināt valodas sintaksi. Mērķa sasniegšanai tiek projektēta sistēma, kas pēc savas būtības ir ļoti līdzīga priekšprocesoram, bet kurai piemīt ciešāka integrācija ar programmēšanas valodas semantiku.
Mehānisms ir balstīts uz regulāro izteiksmju šabloniem, kuri veido saskarni sintakses transformācijām. Šīs darbs koncentrējas uz efektīvas šablonu sakrišanu meklēšanas pieejas izveidošanas, pamatojoties uz kuru vēlāk tiks izstrādāta transformācijas sistēma. Most of the programming languages nowadays have statically fixed syntax and do not provide any means of extending it. There are reasons for such s design decision, however, it implies that any, even slight, syntactical modification of the language have to be implemented on the compiler side.
This thesis describes a mechanism that allows syntactical extensions to a languge to be introduced by the user, rather than by the compiler developer. In order to achieve that a system is designed, which is very similar to a preprocessor, but which has a much closer integration with the semantics of the language.
The mechanism is based on regular expression templates, which are the interface to the transformations of the syntax. This paper is focused on creating an effective template matching approach, which later will be used as the basis for building the transformation system.