You could parse the string into a syntax tree of Nodes.
Take a look at scala parser combinators. You can define your own parsers and combine them to generate a nested structure of Nodes, then process the nested structure.
It seems like you want to parse the string to polish notation. Here is an example of a reverse polish notation parser.
- How do I string concat two columns in Scala but order the resulting column alphabetically?
- How to change order of string value in column
- How to sort query string components by byte order in Scala?
- How to order string of exact format (dd-MM-yyyy HH:mm) using sparkSQL or Dataframe API
- Pattern matching or how to further exploit operators for string matches in Scala?
- how to replace letters in a string in alphabetical order
- How to sort by column in descending order in Spark SQL?
- How to convert an Int to a String of a given length with leading zeros to align?
- How to declare empty list and then add string in scala?
- How to check whether a String fully matches a Regex in Scala?
- How to insert double quotes into String with interpolation in scala
- How can I cast Integer to String in Scala?
- How to check to see if a string is a decimal number in Scala
- How to set a String in a Option[String]?
- How can I construct and parse a JSON string in Scala / Lift
- How to find if a Scala String is parseable as a Double or not?
- String interpolation in Scala 2.10 - How to interpolate a String variable?
- How to convert String to date time in Scala?
- How to flatten list of options using higher order functions?
- how to convert json string to dataframe on spark
- How to split string with trailing empty strings in result?
- How to use orderby() with descending order in Spark window functions?
- How to match a string on a prefix and get the rest?
- How to split string into equal-length substrings?
- How to split a string by a string in Scala
- How to convert a JSON JString value to an ordinary String in Lift?
- How can I convert a json string to a scala map?
- How make tests always run in same order in Scalatest?
- How to substitute an empty string (or null) with a default string concisely in Scala
- How to correctly generate SHA-256 checksum for a string in scala?
More Query from same tag
- SBT aggregating subproject
- How can I return a scala "object" as if it's a class instance?
- Re-tried Future Not Completing
- Adding classpath location in sbt
- Error handling in activiti
- Scala case class copy-method difference between 2.9 and 2.10
- Spark Scala creating schema based on target JSON structure
- SBT console - How to run stuff on initialization?
- Using JSON Path to update value in json with a json object
- Scala's non curly braced IF statement
- Looping through a LinkedHashSet using indexes in Scala
- What is a monad-transformer as distinct from a monad?
- Ajax response wait for future (scala)
- Increase the time for console report in Gatling
- Overriding in Scala, overloaded Java methods distinguished by array type
- Empty json using Spray without quotation marks?
- Exclude latest version of dependent projects in Scala
- PSQLException: The column index is out of range: 2, number of columns: 1
- How to log None errors in a for-yield block
- Generic enum using case class in scala
- Flatten Scala Try
- Scala: method within a method
- Why does sbt fail with sbt.ResolveException: unresolved dependency for Spark 2.0.0 and Scala 2.9.1?
- Scala Collections inconsistencies
- scala - quickly construct the hex represented control chars in a string
- Scala Regex Partial Function with Regex defined in Partial Function
- Merge maps in scalaz with a complex (double) operation
- How do I publish an Ivy Dependency via SBT?
- Bundle imports in Scala
- Scala: Delimited Continuations Explained - Not