@INPROCEEDINGS{bachSLE2012, author = {Ali Afroozeh and \textbf{Jean-Christophe Bach} and Mark van den Brand and Adrian Johnstone and Maarten Manders and Pierre-Etienne Moreau and Elizabeth Scott}, title = {{Island Grammar-Based Parsing Using GLL and Tom}}, booktitle = {Software Language Engineering, 5th International Conference, SLE 2012}, year = {2012}, month = Sep, editor = {Czarnecki, Krzysztof and Hedin, Görel}, volume = {7745}, series = {Lecture Notes in Computer Science}, pages = {224-243}, address = {Dresden, Germany}, publisher = {Springer Berlin Heidelberg}, abstract = {{Extending a language by embedding within it another language presents significant parsing challenges, especially if the embedding is recursive. The composite grammar is likely to be nondeterministic as a result of tokens that are valid in both the host and the embedded language. In this paper we examine the challenges of embedding the Tom language into a variety of general-purpose high level languages. Tom provides syntax and semantics for advanced pattern matching and tree rewriting facilities. Embedded Tom constructs are translated into the host language by a preprocessor, the output of which is a composite program written purely in the host language. Tom implementations exist for Java, C, C#, Python and Caml. The current parser is complex and difficult to maintain. In this paper, we describe how Tom can be parsed using island grammars implemented with the Generalised LL (GLL) parsing algorithm. The grammar is, as might be expected, ambiguous. Extracting the correct derivation relies on our disambiguation strategy which is based on pattern matching within the parse forest. We describe different classes of ambiguity and propose patterns for resolving them.}}, doi = {10.1007/978-3-642-36089-3_13}, isbn = {978-3-642-36088-6}, keywords = {GLL; Tom; island grammars; parsing; disambiguation}, url = {http://dx.doi.org/10.1007/978-3-642-36089-3_13}, ee = {http://dx.doi.org/10.1007/978-3-642-36089-3} }