progs/parser-combinators/comb2.sc
changeset 981 14e5ae1fb541
parent 977 1e6eca42d90b
--- a/progs/parser-combinators/comb2.sc	Mon Feb 03 13:25:59 2025 +0000
+++ b/progs/parser-combinators/comb2.sc	Fri Sep 05 16:59:48 2025 +0100
@@ -59,6 +59,8 @@
   }
 }
 
+
+
 // atomic parser for identifiers (variable names)
 case object IdParser extends Parser[String, String] {
   val reg = "[a-z][a-z,0-9]*".r
@@ -83,11 +85,20 @@
 // the following string interpolation allows us to write 
 // StrParser(_some_string_) more conveniently as 
 //
-// p"<_some_string_>" 
+// p"_some_string_" 
 
 extension (sc: StringContext) 
   def p(args: Any*) = StrParser(sc.s(args*))
 
+
+
+// the following is an alternative way to achieve the same, except
+// that the p needs parentheses as in
+//
+// p("_some_string_")
+//
+//import StrParser.{apply => p}
+
 // the abstract syntax trees for the WHILE language
 abstract class Stmt
 abstract class AExp