Skip to main content

Cyclic Operator Precedence Grammars for Improved Parallel Parsing

  • Conference paper
  • First Online:
Developments in Language Theory (DLT 2024)

Abstract

Operator precedence languages (OPL) enjoy the local parsability property, which essentially means that a code fragment enclosed within a pair of markers—playing the role of parentheses—can be compiled with no knowledge of its external context. Such a property has been exploited to build parallel compilers for languages formalized as OPLs. It has been observed, however, that when the syntax trees of the sentences have a linear substructure, its parsing must necessarily proceed sequentially making it impossible to split such a subtree into chunks to be processed in parallel. Such an inconvenience is due to the fact that so far much literature on OPLs has assumed the hypothesis that the equality precedence relation cannot be cyclic. We present an enriched version of operator precedence grammars which allows to remove the above hypothesis, therefore providing a little more expressive generality, and to further optimize parallel compilation.

The extended version of this paper, available in [6], contains an omitted correctness proof, explanatory examples and figures developed in more depth.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    The above procedure that led to the syntax tree of Fig. 2 could be easily adapted to become an algorithm that produces a new syntax tree whose internal nodes are labeled by \(G_{AE}\)’s nonterminals. Such an algorithm could be made deterministic by transforming \(G_{AE}\) into a structurally equivalent BD grammar sharing the same OPM [2, 12].

  2. 2.

    The language \(\{a^n(bc)^n\} \cup \{b^n(ca)^n\} \cup \{c^n(ab)^n\} \cup (abc)^+\) cannot be generated by an OPG because the \(a\doteq b \doteq c \doteq a\) relations are necessary [9], but it is accepted by OPAs.

  3. 3.

    For our purposes \(^+\) is more convenient than \(^*\) without affecting the generality.

  4. 4.

    Any nondeterministic OPA can be transformed into a deterministic one at the cost of quadratic exponential increase in the size of the state space [15].

References

  1. Alur, R., Madhusudan, P.: Adding nesting structure to words. J. ACM 56(3) (2009). https://doi.org/10.1145/1516512.1516518

  2. Autebert, J., Berstel, J., Boasson, L.: Context-free languages and pushdown automata. In: Handbook of Formal Languages, no. 1, pp. 111–174 (1997). https://doi.org/10.1007/978-3-642-59136-5_3

  3. Barenghi, A., Crespi Reghizzi, S., Mandrioli, D., Panella, F., Pradella, M.: Parallel parsing made practical. Sci. Comput. Program. 112(3), 195–226 (2015). https://doi.org/10.1016/j.scico.2015.09.002

    Article  Google Scholar 

  4. Barenghi, A., Crespi Reghizzi, S., Mandrioli, D., Pradella, M.: Parallel parsing of operator precedence grammars. Inf. Process. Lett. 113(7), 245–249 (2013). https://doi.org/10.1016/j.ipl.2013.01.008

    Article  MathSciNet  Google Scholar 

  5. Chiari, M., Mandrioli, D., Pontiggia, F., Pradella, M.: A model checker for operator precedence languages. ACM Trans. Program. Lang. Syst. 45(3), 19:1–19:66 (2023). https://doi.org/10.1145/3608443

  6. Chiari, M., Mandrioli, D., Pradella, M.: Cyclic operator precedence grammars for parallel parsing. CoRR arxiv:2309.04200 (2023)

  7. Crespi Reghizzi, S., Mandrioli, D.: Operator precedence and the visibly pushdown property. J. Comput. Syst. Sci. 78(6), 1837–1867 (2012). https://doi.org/10.1016/j.jcss.2011.12.006

    Article  MathSciNet  Google Scholar 

  8. Crespi Reghizzi, S., Mandrioli, D., Martin, D.F.: Algebraic properties of operator precedence languages. Inf. Control 37(2), 115–133 (1978)

    Article  MathSciNet  Google Scholar 

  9. Crespi Reghizzi, S., Pradella, M.: Beyond operator-precedence grammars and languages. J. Comput. Syst. Sci. 113, 18–41 (2020). https://doi.org/10.1016/j.jcss.2020.04.006

  10. Floyd, R.W.: Syntactic analysis and operator precedence. J. ACM 10(3), 316–333 (1963)

    Article  Google Scholar 

  11. Grune, D., Jacobs, C.J.: Parsing Techniques: A Practical Guide. Springer, New York (2008). https://doi.org/10.1007/978-0-387-68954-8

    Book  Google Scholar 

  12. Harrison, M.A.: Introduction to Formal Language Theory. Addison Wesley, Boston (1978)

    Google Scholar 

  13. Henzinger, T.A., Kebis, P., Mazzocchi, N., Saraç, N.E.: Regular methods for operator precedence languages. In: Etessami, K., Feige, U., Puppis, G. (eds.) 50th International Colloquium on Automata, Languages, and Programming, ICALP 2023, Paderborn, Germany, 10–14 July 2023. LIPIcs, vol. 261, pp. 129:1–129:20. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2023). https://doi.org/10.4230/LIPIcs.ICALP.2023.129

  14. Li, L., Taura, K.: Associative operator precedence parsing: a method to increase data parsing parallelism. In: Proceedings of the International Conference on High Performance Computing in Asia-Pacific Region, HPC Asia 2023, Singapore, 27 February–2 March 2023, pp. 75–87. ACM (2023).https://doi.org/10.1145/3578178.3578233

  15. Lonati, V., Mandrioli, D., Panella, F., Pradella, M.: Operator precedence languages: their automata-theoretic and logic characterization. SIAM J. Comput. 44(4), 1026–1088 (2015). https://doi.org/10.1137/140978818

    Article  MathSciNet  Google Scholar 

  16. Mandrioli, D., Pradella, M.: Generalizing input-driven languages: theoretical and practical benefits. Comput. Sci. Rev. 27, 61–87 (2018). https://doi.org/10.1016/j.cosrev.2017.12.001

    Article  MathSciNet  Google Scholar 

  17. Mandrioli, D., Pradella, M., Crespi Reghizzi, S.: Aperiodicity, star-freeness, and first-order definability of structured context-free languages. Logical Methods Comput. Sci. 19 (2023).https://doi.org/10.46298/lmcs-19(4:12)2023

  18. McNaughton, R., Papert, S.: Counter-Free Automata. MIT Press, Cambridge (1971)

    Google Scholar 

  19. Salomaa, A.K.: Formal Languages. Academic Press, New York (1973)

    Google Scholar 

Download references

Acknowledgments

This work was partially funded by the EU Commission in the Horizon Europe research and innovation programme under grant agreement No. 101107303 (MSCA-PF CORPORA).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Michele Chiari .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2024 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Chiari, M., Mandrioli, D., Pradella, M. (2024). Cyclic Operator Precedence Grammars for Improved Parallel Parsing. In: Day, J.D., Manea, F. (eds) Developments in Language Theory. DLT 2024. Lecture Notes in Computer Science, vol 14791. Springer, Cham. https://doi.org/10.1007/978-3-031-66159-4_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-66159-4_8

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-66158-7

  • Online ISBN: 978-3-031-66159-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics