Snobol Pattern Matching [closed] - regex

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
My question is simple. Is the programming language Snobol4 still useful to provide a modern day solution for pattern matching, or has regex in other procedural languages pretty much wiped it out in application?

The pattern language is modeled on context free grammars,
with context sensitive extensions that provide full (type 0)
computational capabilities.
This is from an introduction originally written by Robert Dewar, creator of the SPITBOL implementation of SNOBOL-4. Since both references are in relatively new, and maintained libraries, I'd think that even though the pattern language is not part of, say, JavaSrcipt with its statistically many uses, or part of other modern languages, it might surprise users of REs in terms of speed and power.
That being said, SNOBOL-4 patterns have been criticized for leading to hard to understand programs, for using FENCE, not NOT (Farber? Gimpel?) and other phenomena that seem to have a come-back with Perl5 compatible "regular expressions", and ICU's. They, too, are rediscovering some effects of backtracking and anchors. R.E. Griswold, creator of SNOBOL-4, has later created the Icon programming language. It features generators and goal directed evaluation, thus taking backtracking to a level at which arguably search is more clearly expressed than one could do using the implications of complex patterns.
Insofar as this historic development is preceding today's "REs" growing in power, I'd say that SNOBOL-4 patterns offer something to the profession for evaluation, what to do again and what not to do again.
Say, do we need a BAL pattern in practice?

Related

Is the Go programming language replacing C++? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have read on some blogs that Go is a better system programming language and is going to replace C/C++. I am currently learning C++. So, I was wondering whether I should continue learning C++ or move to Go?
Go is designed for reliable, fast online services. It's the recommended language of Google App Engine. It does have general feature parity with C, plus additional scalability features. Perhaps, one day, it will be adopted for embedded programming and client-side applications, but that has yet to happen.
C is used in many, many application domains. No other language approaches its breadth of use. As a first language, though, it won't help you develop good habits.
C++ is a multi-paradigm language. It supports deep, generic metaprogramming. Many users of C++ are really using "embedded domain-specific languages" (EDSLs) where a library provides functionality defined within the C++ grammar. Go does not attempt to provide this depth, which is a Pandora's box of complexity.

Applications of Objective-Z [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What are applications of Objective-Z?
I have read about Objective-Z, but I cannot imagine to what it would be applied.
This question may be too broad, but I do not think that there are too many answers.
Objective-Z is an object-oriented extension to Z.
From here, you can get an overview of Objective-Z:
Object-Z extends Z by the addition of language constructs resembling the object-oriented paradigm, most notably, classes. Other object-oriented notions such as polymorphism and inheritance are also supported.
While not as popular as its base language Z, Object-Z has still received significant attention in the formal methods community, and research on aspects of the language are ongoing, including hybrid languages using Object-Z, tool support (e.g., through the Community Z Tools project) and refinement calculi.
For more information about the language and its uses, I would recommend visiting the Objective-Z homepage.
Its applications are similar to that of Z-notation - it is just an extension to a specification language.
If you really want to know about applications of Objective-Z, you can read this book.
I hope this helps, and good luck with Z.
Z is a specification language, meaning it is used to describe a system.
A quote from the Wikipedia article about Specification Languages states:
A specification language is a formal language in computer science used during systems analysis, requirements analysis and systems design to describe a system at a much higher level than a programming language, which is used to produce the executable code for a system.
The Z language is, according to this source,
a formal specification language used for describing and modelling computing systems. It is targeted at the clear specification of computer programs and computer-based systems in general.
So, that is the application of Z.
I see that your question is not about Z, but about Objective-Z, but I hope that this answer can still be useful.

Among regular and context-free grammars which one is more powerful. Please give me the reason too [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I was just going through the principles of programming languages. I know the concepts of regular and context-free grammars and their usage. But still I am unable to decide which one is more powerful and why. Please help
Thanks in advance.
Every regular language is context-free, but some context-free languages are not regular. In that sense, the context-free languages are more "powerful" than the regular languages.
As one example of a nonregular language that is context-free, consider the language of all palindromes made up of the characters x and y. You can prove that this language is nonregular by using the pumping lemma or the Myhill-Nerode theorem. However, it is context-free, since it's generated by the grammar
S → aSa | bSb | a | b | ε
Intuitively, regular languages correspond to yes/no questions that can be solved on a computer with finite memory (the Myhill-Nerode theorem is one way of formalizing this intuition). This means that any yes/no problem that can't be solved with only finite memory therefore won't correspond to regular languages. Context-free languages occupy a strange middle ground - they correspond to problems that can be solved on computers with finite memory and an unbounded stack.
If you're interested in learning more about this, I'd recommend reading through a book on formal languages and computability. There's a lot of amazingly beautiful results about these classes of languages and there's no way I can compress it into a single answer.
Hope this helps!

Does every large project include a Lisp interpreter? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I had the impression that there was a paper or article somewhere that claimed every sufficiently large project (not written in a Lisp variant) contained a poorly implemented Lisp interpreter. Google turns up nothing and a quick search of SO doesn't either. Is this something well known and documented somewhere I have forgotten, or just a figment of my imagination?
An actual document or link to such an article would be appreciated, if it exists. Otherwise, I will remove the question.
What Greenspun meant when he uttered this quip was that Lisp provides a great many foundational technologies for writing good software, and that programs written in other languages informally (and inferiorly) reproduce a number of them as they grow.
Yes, this claim is Greenspun's tenth rule (actually the only rule):
Any sufficiently complicated C or Fortran program contains an ad hoc,
informally-specified, bug-ridden, slow implementation of half of
Common Lisp.
It is making a valid point about the expressiveness of Lisp-style features (particularly its kind of macros). However, it isn't serious to the degree you would write a paper on it.

What is the best way to define grammars for a text editor? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I'm masochistically writing an open-source text editor for Mac and have finally reached the point at which I want to add syntax highlighting. I've been going back and forth on various solutions for the past few days, and I've finally decided to open the question to a wider audience.
Here are the options I see:
Define languages basically with a series of regex pattern matching (similar to how TextMate defines its languages)
Define languages with a formal grammar like BNF or PEG
Using regex pattern matching seems less than ideal as it cannot formally represent a language nearly as well as a formal grammar; however, some less formal languages will have a hard time fitting into BNF (i.e. Markdown -- though I know there's a great PEG implementation).
What are the performance tradeoffs for live syntax highlighting? What about flexibility for a wide range of languages?
If I go the BNF route, Todd Ditchendorf created the awesome ParseKit framework which would work nicely out-of-the-box. Anyone know of any anything similar for PEG's?
Unless you want to fight the battle of getting a full-context free (or worse, a full context-sensitive) grammar completely correct for every language you want to process (or worse, for every dialect of the language you want to process... how many kinds of C++ are there?), for the purposes of syntax highlighting you're probably better giving up on complete correctness and accept that sometimes you'll get it wrong. In that case, regexps seem like an extremely good answer. They can also be very fast, so they won't interfere with the person doing the editing.
If you insist on doing full syntax checking/completion (I don't think you are), then you'll need that full grammar. You'll also be a very long time in producing editors for real languages.
Sometimes it is better not to be too serious. A 98% solution that you can get is better than a 100% solution that never materializes.
It might not be exactly what you need since you are writing the editor yourself, but there is an awesome framework called Xtext that will actually generate a complete editor with syntax coloring, customizable outline view and auto-completion etc., based on a grammar for your language: http://eclipse.org/Xtext