Commit 4bd0e55
miranov25
Phase 11.1a: Namespace function support (TMath, ROOT.Math, etc.)
Implement namespace function calls in DSL expressions:
- TMath.Pi(), TMath.Sin(x), TMath.Sqrt(x)
- ROOT.Math.VectorUtil.DeltaPhi(v1, v2)
- Support both Python (.) and C++ (::) syntax
Components:
- dsl_compiler.py: Preprocess :: to . for AST parsing
- Preserves :: inside strings and brackets (slice syntax)
- ir_builder.py: Namespace detection and CallNode building
- _extract_namespace_chain(): Identify namespace vs method calls
- _build_namespace_call(): Create CallNode with namespace info
- Correctly disambiguates track.Pt() (method) vs TMath.Pi() (namespace)
- backend_cpp.py: Generate qualified C++ names and headers
- TMath::Sqrt, ROOT::Math::VectorUtil::DeltaPhi
- Adds appropriate headers (<TMath.h>, etc.)
- constants.py: KNOWN_NAMESPACES, NAMESPACE_HEADERS, NAMESPACE_FUNCTION_TYPES
LIMITATION: Scalar functions on vectors not yet supported.
TMath.Sqrt(RVec<double>) fails - requires Phase 11.1b.
Use sqrt(pt) with ADL for vectorized operations until then.
Tests: 722 passed, 1 skipped1 parent 6e64a0b commit 4bd0e55
5 files changed
Lines changed: 741 additions & 5 deletions
File tree
- UTILS/dfextensions/RDataFrameDSL
- RDataFrameDSL
- tests
Lines changed: 30 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| |||
1201 | 1202 | | |
1202 | 1203 | | |
1203 | 1204 | | |
| 1205 | + | |
1204 | 1206 | | |
1205 | | - | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
1206 | 1220 | | |
1207 | 1221 | | |
1208 | 1222 | | |
| |||
1211 | 1225 | | |
1212 | 1226 | | |
1213 | 1227 | | |
1214 | | - | |
1215 | | - | |
| 1228 | + | |
1216 | 1229 | | |
1217 | 1230 | | |
1218 | 1231 | | |
| |||
1256 | 1269 | | |
1257 | 1270 | | |
1258 | 1271 | | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
1259 | 1286 | | |
1260 | 1287 | | |
1261 | 1288 | | |
| |||
Lines changed: 72 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
| |||
273 | 277 | | |
274 | 278 | | |
275 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
Lines changed: 60 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
161 | 217 | | |
162 | 218 | | |
163 | 219 | | |
| |||
198 | 254 | | |
199 | 255 | | |
200 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
201 | 260 | | |
202 | 261 | | |
203 | | - | |
| 262 | + | |
204 | 263 | | |
205 | 264 | | |
206 | 265 | | |
| |||
0 commit comments