5 ms·
I was hired (a long time ago) to write a language for a Very Large Telco Equipment Supplier in Canada in order to support their automated regression testing eff
by t1m 12y ago
I was hired (a long time ago) to write a language for a Very Large Telco Equipment Supplier in Canada in order to support their automated regression testing effort for their digital telephone switches.
It was called, ingeniously enough, "T" (no, not that "T"). As far as I (and cursory Google searches) know, it was never released to the adoring public.
I used lex and yacc (half jokingly referred to as 'ick' and 'yuck') and K&R C for the compiler and VM.
The particular type of testing we were targeting involved writing test cases that would read/write over serial lines to a telephone switch's console program. Therefore, the language needed to have good serial/terminal I/O, and it needed to have amazing string/pattern matching.
I wrote two features that I am still particularly fond of:
- regexps were a built in type. Strings were written like 'hi there' and regexps were written like `hi ..ere` - supported standard unix regexps
- associative arrays. Lots of languages have these now, like python's dict
The cool thing about it was how we tried to allow strings and regexps have a polymorphic relationship at the language level. The statements:
x == 'some string' or x == `some [^t]ring`
would be valid for strings in x, though the regexp had other operators that didn't make much sense with strings. It got really interesting when we combined the regexps with the associative array:
dict['hello'] = 4
dict['help'] = 2
dict[`he.*`] == [2, 4] # true
- TheLoneWolfling 12y agoI wonder how one would go about efficiently implementing such an associative array. I suppose a trie + glue logic (regexp -> NFA -> DFA) could work, for classic (read: actually regular expressions) regexps at least.
- t1m 12y agoI have wondered the same thing, but wasn't extremely concerned about getting it super-fast at the time. We had an existing, older language that was much loathed and quite slow, and we just had to beat it. And awk.
- agumonkey 12y agoJust curious, did you specify order ? dict[`he.*`] == [4,2] could also hold. Or maybe [...] was a set literal and not ordered list. Interesting ideas, perlish in spirit, somehow less cryptic. Was it published ? was there other ideas you could talk about ?
- t1m 12y agoMy code above isn't the exact syntax. I doubt I implemented array equality. I was just demonstrating that an array would be returned when indexing the dict with a regexp. I know nothing was published or released. I actually left BNR/NT less than a year after the language went into production (going to say July, 1990) - I don't really know how long it remained there. Perl was popular, and Tcl was definitely a 'thing' in the lab at the time - the writing was on the wall for home-grown languages.