10 ms·
On being the maintainer and sole developer of SPITBOL (2012)
- dwharrison 11y agoI first encountered SNOBOL when I was 15, running an implementation on an old IBM 360 at university. It was the 3rd language I mastered (after Fortran and an early T/S version of Basic...both on the same 360) and the first I completely fell in love with. It awoken me to just how different and amazing a programming language could be and bent my mind around something very different than what I'd been doing with Fortran. It was an entirely new way to think about designing solutions. Years later when I was introduced to Prolog, everything thing felt very much at home...Prolog's backtracking algorithm being very much like SNOBOL's pattern matching system. Of all the languages I've worked with over the years, SNOBOL and FORTH are in class by themselves for how they informed my thinking about problem solving...lessons I carried with me in work done in many other languages. It's a shame that both languages have passed into history...they each had subtle things to teach a developer just learning their craft...
- ORioN63 11y agoIf you're searching for examples, search instead for SNOBOL. From Wikipedia: > SPITBOL (Speedy Implementation of SNOBOL) is a compiled implementation of the SNOBOL4 language. Also from wikipedia SNOBOL page shows some examples: https://en.wikipedia.org/wiki/SNOBOL https://en.wikipedia.org/wiki/SNOBOL And C2 talks about it as well: http://c2.com/cgi/wiki?SnobolLanguage http://c2.com/cgi/wiki?SnobolLanguage
- millstone 11y ago> Can you name a widely-used contemporary programming language that still uses the 60’s software technology of reference counts to manage storage? As opposed to the 50's software technology of garbage collection? What an off-putting remark to include.
- deleted 11y ago[deleted]
- TazeTSchnitzel 11y agoYes, age here is irrelevant. At the very least, Objective-C, Swift and PHP still use reference counting.
- amock 11y agoAs does Python.
- SomeCallMeTim 11y agoAnd C++11 just got reference counting as an official library option. Reference counting is better than mark-and-sweep GC for several use cases: * Real time code where you don't ever want a GC to steal cycles. I know that a lot of research has been done to decrease the amount of time stolen, but it's always non-zero. * Immediate, deterministic clean-up of resources as soon as they are no longer referenced: If you have a limited number of file handles, for instance, you want them closed ASAP, and not when some GC decides it's time. * No performance penalty for having weak references. I use this in asset management: A map of asset handles to weak references to currently loaded assets. If an asset is no longer used, it's deallocated immediately. Having weak references in a GC system can increase processing complexity.
- jfim 11y ago> * Real time code where you don't ever want a GC to steal cycles. I know that a lot of research has been done to decrease the amount of time stolen, but it's always non-zero. Real time code shouldn't allocate/deallocate memory, much less from a GC'able pool. With that constraint, it's possible to have real time code that coexists with a GC, such as RTSJ's NoHeapRealtimeThread or Eventrons, with an effective cost of zero cycles taken by GC from the realtime code.
- SomeCallMeTim 11y ago
- Zuider 11y agoSPITBOL is an enhanced version of the SNOBOL language. From Wikipedia: SNOBOL (StriNg Oriented and symBOlic Language) is a series of computer programming languages developed between 1962 and 1967 at AT&T Bell Laboratories by David J. Farber, Ralph E. Griswold and Ivan P. Polonsky, culminating in SNOBOL4. https://en.wikipedia.org/wiki/SNOBOL https://en.wikipedia.org/wiki/SNOBOL TkS*LIDE is a Tcl/Tk based IDE for SPITBOL (along with SNOBOL4). Binaries for SNOBOL4 and SPITBOL are included with the IDE, along with a tutorial and sample programs. http://rms.republika.pl/slide.html http://rms.republika.pl/slide.html SNOBOL is also distinguished by being described in Guy Steele & Richard Gabriel: 50 in 50 speech as one of the three languages worth knowing: https://vimeo.com/25958308 https://vimeo.com/25958308
- thisjepisje 11y agoJust found this on wikipedia: SnoPy, snobol pattern matching for python. http://snopy.sourceforge.net/user-guide.html http://snopy.sourceforge.net/user-guide.html
- raldi 11y ago> SPITBOL is unique in the power it provides to manipulate strings and text. I’ve yet to see anything else come close. Can anyone elaborate on this?
- Zuider 11y agoFrom Wikipedia entry on SNOBOL/SPITBOL 'SNOBOL4 stands apart from most programming languages by having patterns as a first-class data type (i.e. a data type whose values can be manipulated in all ways permitted to any other data type in the programming language) and by providing operators for pattern concatenation and alternation. Strings generated during execution can be treated as programs and executed.' By contrast, other languages such favor the use of regular expressions. I am not so sure about the claim to uniquness. Ralph Griswald went on to develop the Icon language which included this feature. The Unicon language, a superset of Icon also has this distinction.
- raldi 11y agoI'm having a hard time understanding the parenthetical. If you grok it, and could take a moment to explain it in your own words -- or give an example of its use -- I'd very much appreciate it. Thanks!
- mindcrime 11y agoI think it's saying that "patterns" are themselves values that have operations you can perform on them. For example, adding to patterns, or subtracting from them, or concatenating them, etc. I don't know SNOBOL though, so I'm having a hard time picturing what the actual implications of that are, or exactly how it works. But I'm intrigued enough now that I want to go read this "Green Book" and see what it's all about.
- braythwayt 11y agoIf you have a pattern that matches FIRSTNAME and another that matches LASTNAME, roughly: FULLNAME = FIRSTNAME LASTNAME Whitespace is a catenation operator, and catenating two patterns gives you a new pattern that matches a string matching the first and the second pattern. Maybe you want to handle old-school people like raganwald: OLDSCHOOLNAME = LASTNAME ‘, ‘ FIRSTNAME Or both: ANYNAME = FULLNAME | OLDSCHOOLNAME The vertical bar is an alternate operator. Regular expressions work the same way, but in most languages, the regular expression language is really a DSL embedded in the syntax for a regular expression literal. Whereas in SNOBOL, all those operators are ordinary language operators and you can use them anywhere. So you can manipulate patterns programatically.
- coderdude 11y agohttps://github.com/spitbol/x64/blob/master/demos/sentenc.sbl https://github.com/spitbol/x64/blob/master/demos/sentenc.sbl In Python, you would probably use regex for the pattern matching. In SPITBOL, you can accomplish the task at the language level. I doubt the pattern matching is as capable as regex but that's a useful feature to have (edit: based on braythwayt's comment, it sounds like the pattern matching is more capable than regex). It might be better suited to NLP tasks. According to the developer, "SPITBOL is unique in the power it provides to manipulate strings and text. I’ve yet to see anything else come close." See Zuider's comment for more information. I hope all-caps-keywords is optional.
- icebraining 11y agoA closer alternative in Python is using pyparsing, which provides similar syntax. Since Python's operators can be re-implemented by the object where they're being applied, you can get pretty native-looking code. https://pyparsing.wikispaces.com/file/view/simpleSQL.py https://pyparsing.wikispaces.com/file/view/simpleSQL.py
- wging 11y agoWikipedia says that the parsing can handle CFGs, which means it is strictly more powerful than regex. "SNOBOL4 patterns subsume BNF grammars, which are equivalent to context-free grammars and more powerful than regular expressions." - https://en.wikipedia.org/wiki/SNOBOL https://en.wikipedia.org/wiki/SNOBOL
- braythwayt 11y agoThe first programming language I used was WATFIV, a Waterloo FORTRAN implementation. It seemed straightforward, and if that’s all there was to programming, I probably would have dropped it in 1974 to play more D&D. FORTRAN felt like the same arithmetic I already knew how to use. It was obviously way more powerful to use a program to do calculations, but it was all stuff I could have done by hand or with a calculator. But one day, as I waited for a keypunch to make some changes to some program or other I was writing, my eye fell upon a copy of the Green Book left behind by some other programmer. I started reading it, and my little mind was completely blown. SNOBOL was something else, it forced me to think about programs in a completely different way. It wasn’t about specifying steps to be taken one by one, it was about designing a way to pattern match. And more than in the obvious, RegExp way, but you could do things as the pattern was matching, and thus you were writing a kind of program where the control flow was determined my backtracking and success or failure of matches. To this day, my programming is highly influenced by one feature of SNOBOL, I guess it “imprinted” on me: Patterns are first-class values (like regular expressions in other languages), but they are also composable, there is an arithmetic of patterns. To this day I favour designs where things can be composed and decomposed at will rather than used as opaque, monolithic entities. I’m not saying SNOBOL was better than the FP and OOP and multi-paradigm languages that dominate today, but the experience of learning a new way to think was intoxicating, and once a year or so I re-read the Green Book and think about thinking differently. If you are interested, I highly recommend you read the whole book. If you see “pattern matching” and think “Regular Expressions,” you will miss the forest for the trees. I’m not sure that anybody needs to know SNOBOL (or its descendants), but I think that it’s a valuable exercise to learn it once. "A language that doesn't affect the way you think about programming, is not worth knowing.” --Alan Perlis
- Zuider 11y agoThe Green Book you mention is available for download on the Google Code page for SPITBOL: https://code.google.com/p/spitbol/downloads/list https://code.google.com/p/spitbol/downloads/list
- geophile 11y agoI love SNOBOL4/SPITBOL. It was a completely bizarre and original language that was quite powerful. In the late 70s, I took two compiler courses with RBK Dewar, one of the creators of SPITBOL. Those courses were wonderful. He mentioned SPITBOL occasionally, and I remember one story in particular. The implementation was done in assembler, (if I'm remembering correctly), and it took 20 runs to get a working system, (I guess that means a basic suite of tests running successfully). That style of working is completely alien today, and arguably less effective. Dewar also spent some time talking about his work on the SETL language (for processing sets). Flow analysis for global optimization could be expressed extremely concisely, and was of course applied to SETL itself.
- Zuider 11y agoThe SETL language is still available. There is an enhanced version written in Java called setlX http://randoom.org/Software/SetlX http://randoom.org/Software/SetlX
- tootie 11y agoI took some undergrad courses with Prof Dewar in the 90s and all he talked about was Ada and Assembly (using an assembler he wrote). Never heard of SPITBOL. His class was great.
- geophile 11y agoI sort of understand it, as he was a pretty major figure in the Ada world. But no mention of SPITBOL at all? :(
- geophile 11y agoForgot to mention it in my original comment, but in the grad-level compiler course, we actually wrote a compiler in SPITBOL. I don't remember if the language choice was optional or mandatory, but I did enjoy it.
- nickpsecurity 11y agoThat's the language the first Ada compiler was written in. Anyone knowing about the rough history of Ada compiler already has a reason to look at the language that got the job done. ;)
- floatboth 11y agoI think parser combinator libraries are pretty similar. In Haskell, people often use Parsec instead of regular expressions.
- breadbox 11y agoSince this is all about obscure languages, it maybe worth pointing out here that the original INTERCAL compiler was written in SPITBOL. On one or two occasions I asked Don Woods to clarify some feature of the language that was incompletely described in the original INTERCAL document, and he dug out the original SPITBOL code in order to answer my question.
- epalmer 11y agoI was project manager over a FORTRAN project in the early 1980's. I remember very clearly how our team's productivity went up as well as satisfaction when the developers starting using the Ratfor (Rational Fortran) preprocessor. https://en.wikipedia.org/wiki/Ratfor https://en.wikipedia.org/wiki/Ratfor At the time I did not realize that Brian Kernighan created Ratfor. Ratfor changed my thinking about program structure and coding style more than any other single event in my professional life.
- jopamer 11y agoA few years back, Dr. Dobb’s posted a pretty great series of articles on some of the techniques RBK Dewar employed when building the original SPITBOL compiler: http://www.drdobbs.com/cpp/some-programs-are-poorly-designed-on-pur/232300070 http://www.drdobbs.com/cpp/some-programs-are-poorly-designed... (I was lucky enough to study compilers under Prof. Dewar when I was a grad student at NYU - I still have my notes on SPITBOL’s architecture, somewhere…)
- jallmann 11y agoExcellent article, very clever optimizations given the tradeoffs. From the article: > We were talking about students' tendency to let the compiler substitute for thinking This is actually why I use OCaml. Not going to comment on whether useful error messages are a detriment to pedagogy, but offloading thinking to the compiler is a lifesaver.
- mercurial 11y agoDefinitely. It doesn't prevent, say, off-by-one errors (and in general, errors when you manipulate several items of the same type), but if you structure your program correctly, you can be very confident about your code. Though OCaml's errors are not always the most explicit or nicely written.
- ChristianMarks 11y agoI used SNOBOL4 in the 80s. It was beautiful for parsing.
- 101914 11y agoThis is from 2012. He's wrong of course about being the only user. I love this software, along with k/q. I admire the work Mr. Shields has put into this project. I especially like the use of musl and provision of static binaries. I do not use Perl, Java, Python, Javascript, Go, Rust, Closure, etc., etc. Whatever the majority of people are recommending, that is generally not what I use. It just does not appeal to me. I guess I am stubborn and stupid: I like assembly languages, SPITBOL, k/q, and stuff written by djb. Keep it terse. Ignore the critics. Yet this is now on the front page of HN. Maybe because it is the weekend? I really doubt that the software I like with ever become popular. But who knows? Maybe 10 years from now I will look at this post and marvel at how things turned out. There is no "structured programming" with spitbol. No curly braces. Gotos get the job done. Personally, I do not mind gotos. It feels closer to the reality of how a computer operates. Would be nice if spitbol was ported to BSD in additon to Linux and OSX. As with k/q I settle for Linux emulation under BSD.
- malux85 11y agoFascinating, I'm curious, what do you do with such languages and tools? I'm not trolling or trying to start a flame war, I'm genuinely curious as to the best use of these tools. Also - are you doing it as a hobbit, or commercially (or both)? How did you discover this tech?
- 11y ago
- Pyxl101 11y ago> If you know of anyone else who is maintaining an open-source implemenation of a programming language that has only one user, please let me know [...] The author of HolyC and TempleOS, Terry Davis, might be in a similar position: http://www.templeos.org/Wb/Doc/HolyC.html http://www.templeos.org/Wb/Doc/HolyC.html Though I imagine with the exposure it's gotten over the years, Terry might not be the sole user (probably sole regular user).
- TerryADavis 11y agoI'm in a CIA prison. God talks.
- Pyxl101 11y ago> I have several reasons to push on: > SPITBOL is unique in the power it provides to manipulate strings and text. I’ve yet to see anything else come close. I would be interested to know more about what features SPITBOL offers for string processing. I'm going to take a look at the "Green Book" [1] Dave mentions, but if anyone else has relevant focused resources on that topic I'd love to give them a look. [1] https://code.google.com/p/spitbol/downloads/detail?name=Green%20Book.pdf&can=2&q= https://code.google.com/p/spitbol/downloads/detail?name=Gree...
- ZenoArrow 11y agoIt's unfortunate the article doesn't have any examples to show off SPITBOL's expressiveness, or have any benchmarks to show how fast it is compared to solutions in other languages. Reading the comments here, it seems like it could have some decent benefits. Would be interested to know what built-in types are currently available. I wonder also whether this language would also be a good fit for test case writing.
- ruricolist 11y agoOn the subject of SNOBOL descendants still in use, there is also Snowball, designed and used exclusively for writing stemming algorithms: http://snowball.tartarus.org/ http://snowball.tartarus.org/
- zubairsaif007 11y agohttp://googler700.blogspot.com/ http://googler700.blogspot.com/
- jhallenworld 11y agoThis makes me think of a generic assembler I wrote at one point (in C++ I think, I should put it on github). The idea was that you could define the instruction set right in the assembly source. It included a backtracking BNF parser to support it with these pseudo ops: .rule name value pattern ; Define a syntax rule .insn pattern ; Define an instruction ... ; Macro expanded on pattern match .end "pattern" contains literal characters, whitespace and references to other rules with "<rule-name>" or <expr> for a math expression. "value" is a comma separated list of expressions which can contain "argN" to reference the Nth value from the pattern (as returned by embedded rules). For example, this is how you could construct the instructions "lda <expr>", "lda #<expr>", "ldb <expr>", and "ldb #<expr>": .rule dual 0x01 lda .rule dual 0x02 ldb .rule mode 0xf8,arg1 <expr> .rule mode 0xfa,arg1 #<expr> .insn <dual> <mode> .byte arg1|arg2 ; Emit op-code .word arg3 ; Emit argument .end SNOBOL4 itself is not an assembler, but I think you could make one like this from it.
- kragen 11y agoThis is a very interesting idea, and I have been finding inspiration in it. New machine architectures by way of #include files! Or cat! I've been thinking that maybe the right compile-time programming model is something like term-rewriting (more or less like C++ templates or Prolog or Aardappel) rather than textual substitution. I wrote some more thoughts on the matter at https://lobste.rs/s/kfpsou/what_is_everyone_working_on_this_week/comments/sfij7y#c_sfij7y https://lobste.rs/s/kfpsou/what_is_everyone_working_on_this_... but I still haven't gotten very far on it.
- geophile 11y agoI was thinking about why I liked SNOBOL4/SPITBOL so much. The bizarre syntax and control structures appealed to me for some reason. If you haven't used the language, each statement can succeed or fail. At the end of the statement, you can optionally specify a goto target for success and for failure. There are no higher level control structures that I remember (except for functions), so indenting is not something you (OK, I) normally did. This resulted in very clean looking source code, for some reason. I just remember that impression very strongly. But that doesn't really explain the appeal completely. The string processing is fantastic -- extremely powerful. I think regexes have a lot of the same power, but I always found SNOBOL4 more readable after the fact, when I had to go back and read and fix my own code. But that's not it either. I think the main reason I liked SNOBOL4 so much was that it was the first dynamic language I used. Values have types, variables do not. That was a big revelation. I don't think I actually exploited it very often, but it was a cool new idea. And the absence of type declarations also contributed to the sense that the code looked clean. Automatic memory management was also very nice. I had spent a lot of time dealing with memory management in C. I must have in Pascal also. And I really don't remember what Algol-W did for memory management -- a free or delete statement maybe? And of course in FORTRAN, COBOL, and BASIC, there was no dynamically allocated memory at all, so you had to guess high, keep track, etc. Not having to worry about tracking memory was a nice change.