Skip to main content

CRUST: A C/C++ to Rust Transpiler Using a “Nano-parser Methodology” to Avoid C/C++ Safety Issues in Legacy Code

  • 605 Accesses

Part of the Advances in Intelligent Systems and Computing book series (AISC,volume 882)

Abstract

CRUST, a language translator (transpiler) has been developed which converts programs in C/C++ to programs in Rust. Rust created by Mozilla has become popular as a systems programming language as it provides constructs and tool support for developing safe and secure programs without hassles. Safe Rust ensures that the programs developed using these programming constructs are safe and secure by enforcing compiler restrictions, concurrency without data races, memory safety without garbage collection, and abstractions with low overheads. CRUST is a semiautomated transpiler, to automatically convert a subset of “C/C++” code base into Rust without much effort. This is done using a unique Nano-Parser Methodology. CRUST also enhances the readability and understandability of the program by adding extensive documentation to the translated code. It yields a code which is guaranteed to be thread safe and proven to be faster.

Keywords

  • C++
  • Memory safety
  • Nano-parser methodology
  • Rust
  • Transpiler
  • Type safety

This is a preview of subscription content, access via your institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • DOI: 10.1007/978-981-13-5953-8_21
  • Chapter length: 10 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
eBook
USD   389.00
Price excludes VAT (USA)
  • ISBN: 978-981-13-5953-8
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
USD   499.99
Price excludes VAT (USA)
Fig. 1
Fig. 2
Fig. 3

References

  1. Stroustrup, B. (2012). Software development for infrastructure. Computer, 45(1), 47–58. https://doi.org/10.1109/MC.2011.353.

    CrossRef  Google Scholar 

  2. Shen, R. (2017). Why-is-C++-important. Retrieved from https://www.quora.com/. Accessed April 11, 2017.

  3. ONeal, B. (2017). What is the role of C++ today? Softwareengineering.stackexchange.com. Retrieved from http://softwareengineering.stackexchange.com/questions/61248/what-is-the-role-of-c-today. Accessed April 11, 2017.

  4. Pincus, J., & Baker, B. (2004). Beyond stack smashing: Recent advances in exploiting buffer overruns. IEEE Security and Privacy Magazine, 2(4), 20–27.

    CrossRef  Google Scholar 

  5. CSE341 Lecture Notes 26. (2017). Unsafe language (C). Courses.cs.washington.edu. Retrieved from http://courses.cs.washington.edu/courses/cse341/04wi/lectures/26-unsafe-languages.html. Accessed 11 April, 2017.

  6. Colvinand Adler, D. (2012). Smart pointers—boost 1.48.0. Boost C++ libraries. Retrieved from www.boost.org/docs/libs/1_48_0/libs/smart_ptr/smart_ptr.htm. Accessed 11 April, 2017.

  7. Berger, E., & Zorn, B. (2006). DieHard. ACM SIGPLAN Notices, 41(6), 158–168.

    CrossRef  Google Scholar 

  8. Dhurjati, D., Kowshik, S., Adve, V., & Lattner, C. (2003). Memory safety without runtime checks or garbage collection. ACM SIGPLAN Notices, 38(7), 69–80.

    CrossRef  Google Scholar 

  9. Gay, D., Ennals, R., & Brewer, E. (2007). Safe manual memory management. In International Symposium on Memory Management.

    Google Scholar 

  10. DeLozier, C., Eisenberg, R., Nagarakatte, S., Osera, P.-M., Martin, M. M. K., & Zdancewic, S. (2013). Ironclad C++: a library-augmented type-safe subset of C++. MS-CIS-13-05. University of Pennsylvania CIS.

    Google Scholar 

  11. Turon, A. (2017). Fearless concurrency with rust—the rust programming language blog. Blog.rust-lang.org. Retrieved from https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html. Accessed 11 April, 2017.

  12. Turon, A. (2017). Abstraction without overhead: Traits in Rust—The Rust programming language blog. Blog.rust-lang.org. Retrieved from https://blog.rust-lang.org/2015/05/11/traits.html. Accessed 11 April, 2017.

  13. Turon, A., Matsakis, N. (2017). Stability as a deliverable—The Rust programming language blog. Blog.rust-lang.org. Retrieved from https://blog.rust-lang.org/2014/10/30/Stability.html. Accessed 11 April, 2017.

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Nikhil Saldanha .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2019 Springer Nature Singapore Pte Ltd.

About this paper

Verify currency and authenticity via CrossMark

Cite this paper

Shetty, N., Saldanha, N., Thippeswamy, M.N. (2019). CRUST: A C/C++ to Rust Transpiler Using a “Nano-parser Methodology” to Avoid C/C++ Safety Issues in Legacy Code. In: Shetty, N., Patnaik, L., Nagaraj, H., Hamsavath, P., Nalini, N. (eds) Emerging Research in Computing, Information, Communication and Applications. Advances in Intelligent Systems and Computing, vol 882. Springer, Singapore. https://doi.org/10.1007/978-981-13-5953-8_21

Download citation

  • DOI: https://doi.org/10.1007/978-981-13-5953-8_21

  • Published:

  • Publisher Name: Springer, Singapore

  • Print ISBN: 978-981-13-5952-1

  • Online ISBN: 978-981-13-5953-8

  • eBook Packages: EngineeringEngineering (R0)