Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm trying to understand more about shells. I'm looking to implement one and want to look at what's been done in the past.

In a regular shell, you have features like aliases and relative paths, and strong syntactic conventions, like --flag and so on. The IPython community have added loads of nice features to their shells with only a tiny bit of new syntax.

Are there other projects that demonstrate innovative features, or novel use of syntax, that could be useful when designing a shell language?

As examples, the answers given below, on Boo and on Forth and Rebol, are perfect.

share|improve this question
    
Are you asking what kind of syntax you should use (Python versus Bourne shell versus PowerShell versus...), or are you asking how to implement whatever syntax you choose? –  Josh Kelley Mar 15 '13 at 19:47
1  
I've edited the question to try and make things clearer. I'd like to know about features and syntax, but I'd be happy to just get some pointers on little known shells and interactive interpreter hacks and that kind of thing. –  Carl Smith Mar 15 '13 at 21:36
1  
This question seems extremely open-ended. –  Kazark Mar 15 '13 at 22:08
    
I'm actually struggling to find examples though. –  Carl Smith Mar 15 '13 at 22:16
    
Try writing some stories about kids using the tool. A variety of stores with kids who are beginners, intermediate and really expert. Maybe if you have some idea of the actual use cases from the stories you'll have a better idea of what you want to do. –  Tim Williscroft Mar 15 '13 at 23:31
show 1 more comment

2 Answers 2

up vote 6 down vote accepted

Boo is a language that is used both as a scripting language, and as a platform for creating domain-specific languages. Its manifesto describes why the author created it; Boo has:

  1. A wrist-friendly, Python-like syntax
  2. Syntactic sugar for common programming patterns
  3. No variable declarations; assignments create locally-scoped variables automatically
  4. Type inference
  5. Type casting
  6. Optional classes
  7. First-class functions
  8. Iterators (called Generators in Boo), with lazy execution
  9. Duck typing
  10. Access to the compiler pipeline

Boo is a .NET Framework language. It runs on Mono and so is cross-platform.

Boo is extensible, allowing you to create your own syntactical constructs. There's even a book called DSLs in Boo: Domain-Specific Languages in .NET.

Boo can be used as a platform/engine for scripting.


There is also Lua, an embeddable, estensible, cross-platform scripting language with favorable performance characteristics. The Wikimedia Foundation has begun offering Lua as an alternative to their templating system.

share|improve this answer
add comment

Have you considered an extremely simple language syntax, like FORTH or REBOL? These are extremely easy languages to understand, and the grammars are very simple to implement.

In these languages, functionality is described in terms of words, which are themselves defined in terms of simpler words, making it incredibly simple to construct powerful abstractions, without the complexity of understanding classes, types, or even functions.

FORTH is so simple, that a full compiler can be written in a few hundred lines of code. A revision of Crenshaw's book demonstrates this. (Sample implementations are commonplace.) REBOL is similarly simple, and while it has only recently been open-sourced, and hasn't yet been retooled for embedding, the core language parser weighs in at about 1,000 lines of code. From the other side, both are easy to learn and grasp, since there are only a few concepts to understand.

Both languages are suitable for implementation as a shell language, as the host environment can define whatever words are needed for common operations. From there, users can do literally anything they can imagine.

share|improve this answer
1  
Last time I looked, Crenshaw's book was about compiling PASCAL, using Motorola 68000 assembly language as the target. To the best of my recollection, FORTH does not appear anywhere in it. –  John R. Strohm Mar 18 '13 at 4:10
    
@JohnR.Strohm You're right! I must have had it confused with another work. I'll fix that. –  greyfade Mar 18 '13 at 4:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.