
Anic - Faster than C, Safer than Java, Simpler than *sh - ColinWright
http://code.google.com/p/anic?utm_source=HN
======
scott_s
In CS literature, this programming model is called "stream computing."

I work on System S, which is the research name of IBM's InfoSphere Streams,
which is a distributed, realtime (edit: _soft_ realtime; so, high throughput,
low latency, but not hard realtime with guaranteed deadlines) streaming system
with an associated language. Another project in this area is Storm. See this
comment thread for more on that: <http://news.ycombinator.com/item?id=3193115>

But, Anic seems to be more related to the kind of streaming languages that
came from the digital signal processing and embedded worlds. See, for example,
the StreamIt project: <http://groups.csail.mit.edu/cag/streamit/>

In particular, a StreamIt tutorial:
[http://groups.csail.mit.edu/cag/streamit/papers/streamit-
coo...](http://groups.csail.mit.edu/cag/streamit/papers/streamit-cookbook.pdf)

Note that Streams, Storm, Anic, StreamIt all have the same underlying
_programming model_ , but Streams and Storm target a different area than Anic
and StreamIt. Streams and Storm target the emerging area of "big data" where
you need to distribute your computation across a cluster. Anic and StreamIt
are lower level: applications such as video decoding are streaming in nature,
but one typically implements them on a single chip, and often even in
hardware.

Standard disclaimer: my views are not official IBM views.

~~~
TazeTSchnitzel
ANI greatly resembles the programming language I was thinking of creating. Oh
well.

~~~
emilis_info
Commits to ANI stopped nearly two years ago. Maybe you should still try?

You would learn a lot and that would make you a better programmer.

~~~
adrusi
or just contribute to ANI, if you don't want to reinvent the wheel.

~~~
TazeTSchnitzel
Reinventing the wheel would teach me more, I think. But ANI is a useful
reference for how to do some things.

------
rdtsc
> a=[int\\]<-0; op=[char\\]<-' '; b=[int\\]<-0; r=[int\\]<-0; 0 { clock =>
> [int ms] { ("\r" + ms/1000.0 + ":" + a + op + b + "=" + r) ->std.out; 1
> std.delay (ms+1) clock} }; inLoop => {\std.in->a \std.in->op \std.in->b
> inLoop}; \\\op ?? {'+': (\a+\b) '-': (\a-\b) ' _': (\a_ \b) '/': (\a/\b) :
> 0} <->r;

That is not exactly selling the language.

Saw that, closed the page.

~~~
mrcharles
I'll never understand why people keep going out of their way to make new weird
syntaxes. Is it really necessary? Does it really give something over well
established C-like syntaxes?

At the very least, people should approach new languages from an ease of typing
angle. I look at that and all I can think is "That would be a bitch to type
out. Doing it all day? No thank you."

~~~
jlgreco
I have too seemingly opposing thoughts on this.

One part of me says _"Don't reinvent the wheel"_ , but the other part of me
suspects that forcing a new language to follow the syntactical conventions of
another language that was designed with different considerations in mind is a
bad idea.

The best example of a language that I think suffers from it's association with
the syntax of another is C++. The features that it provides are all more or
less fine, but cramming it into a syntax that was made for a much simpler
language really wasn't a good idea.

(I understand why it was done from a historical perspective, and understand
the few benefits it affords, but I think those are particular to that example)

On the other hand again, there really isn't a lack of syntaxes these days that
a new language developer can look to for inspiration. Surely _one_ of them
should work fine most of the time.

~~~
terhechte
This specific one is just bad though. I mean "\" is really difficult to type
on almost all non-us keyboards. It's not even really easy on US keyboards (the
pinky has to go a long way). See how often it's in there. Even standard C
syntax is a pain on some non-us keyboards. I.e. on a German keyboard, the [,
[, {, }, are rather difficult to type. That's why I (being German) switched to
an English layout around two years ago. Now I have trouble typing umlaut and
thus writing good German, but at least my coding speed improved by probably
50% and my Hand hurts far less.

~~~
GregBuchholz
Now I'm interested to know which languages exist that don't rely heavily on
backslashes. I guess I can't think of a language that doesn't use blackslashes
for string escapes. Some other uses off the top of my head:

    
    
        * C -- line-continuations (important for macros).
        * Perl -- regex back-references.
        * Haskell -- anonymous functions.
        * Python -- line continuation.
        * Tcl -- line continuation.
        * Icon -- non-null test (unary), generator limitation (binary).
        * Prolog -- \+ for not provable.
        * J -- the prefix adverb and the grade-down verb (\:).
        * TeX -- Yes.

~~~
rfurmani
Technically, for Perl you can use $ for regex backreferences. I don't remember
which one is preferred, but I remember it frowning upon one of them.

~~~
btilly
What you use depends on where you use it. Inside of a match, \1 refers to what
was matched by the first parens. After the match $1 refers to what was
matched. In a substitution, \1 is special cased to mean $1, but that is
frowned on.

Thus: /\b(\w+)\W+\1\b/ means "match repeated word".

And: /\b(\w+)\W+$1\b/ means "match word preceeded by the word matched on your
last match.

Moving on: s/Hello (\w+)/Goodbye $!/ means "Replace Hello followed by a word
with Goodbye followed by the same word."

And finally: s/Hello (\w+)/Goodbye \1/ is special cased to mean the same
thing, but is frowned upon.

------
bhavin
It would help if fellow HNers read through the content a bit before upvoting
something quickly. Here is a project which was last updated more than 2 years
ago (no changes in source/tutorial/wiki in 2 years). There's no working
implementation to support the claim. Any sane programmer would highly doubt
existence of a (faster_than_C && safer_than_java) claim. Why are we as a
community are becoming more and more obsessed with sensational link-baits?

~~~
dkersten
Agreed: <http://code.google.com/p/anic/source/list> there has been no updates
since 2010. I was honestly surprised to see this on HN and actually had to
double check that I wasn't seeing an old HN submission for some reason.

I was briefly involved in this project, I wrote some code for instruction
selection, was active on the mailing list and had a few lengthy discussions
about dataflow programming with Adrian/Ulitmus. Last I heard, in early 2011,
he was still working on it, but in private, and he had changed focus somewhat
to something even more ambitious. I voiced my concern over raising the bar
before the first _simpler_ version was released and feature creep, but I guess
his mind was made up. I haven't heard anything since, despite trying to reach
him a couple of times :-(

So, from this, I would say that ANI can safely be assumed dead unless a
working compiler is surprise-released.

~~~
ramchip
Same here, I had some discussion with the creator but it looked rather doomed
from the start. He was worrying about parser optimization, logo design, and
interactive shells, when there wasn't even any (hand-)compiled program or
proof of concept of the semantics...

------
zheng
At first I thought this was a joke due to some of the copy, but after reading
through the tutorial a bit, it seems pretty interesting. Less hyperbole would
be nice though. From the FAQ, ANI (the language, anic is the reference
compiler) is faster than C because it is automatically parallel code. Not
exactly what I think of when someone says "faster than C".

Nevertheless, for a modern take on a dataflow language, ANI is intriguing. If
nothing else, the paradigm is probably different enough from
imperative/OOP/functional that it is worthwhile to learn even if ANI doesn't
take off.

~~~
naturalethic
After reading through the tutorial I'm absolutely fascinated. What an
interesting paradigm!

------
colanderman
_Try to imagine, if you will, the amount of time and effort it would take you
to write a bug-free, efficiently multithreaded real-time clock + infix
calculator hybrid application in a language like C._

Wait, what? Why...?

~~~
franzus
I bet this has been done before and is available as a C library ...

~~~
mahmud
How much are you betting? "multithreaded real-time clock + infix calculator
hybrid application" sounds useless and stupid in any language. No one who can
code would be stupid enough to write such a thing, specially in C, and
specially as a freely available library.

~~~
jlgreco
*especially

Sorry.

Anyway, the components that you would need to build such a thing are certainly
all available.

------
kstenerud
Why, oh WHY did they make extensive use of the backslash character? Backslash
is almost universally used as an ESCAPE SEQUENCE INITIATOR. Any other use is
just going to be confusing. Especially when you end up making constructs like
"(\a/\b)", or having to context shift because of string escape sequences like
"\n".

~~~
chime
<http://code.google.com/p/anic/wiki/FAQ>

> Q: Why are backslashes (\\) used as language operators? Isn't that
> confusing, given they're used in other languages as escape characters?

> A: This is a valid point, but backslashes were chosen for a purely pragmatic
> reason; on virutally all keyboards, backslashes are very easy to type
> (requiring only a single keystroke). This is a handy property for
> backslashes to have because in ANI, you'll be typing them a lot!

> Incomers from other languages might be thrown off a tiny bit, but a
> programmer that's spent some time with ANI will quickly come to realize that
> there is actually never any good reason to end a line of ANI code with a
> syntactual backslash! If one insists on doing so anyway, they are writing
> ill-formatted code that would be confusing regardless of how backslashes are
> interpreted by the language. Thus, the backslash conflict is there in theory
> but irrelevant in practice.

> The usage of \ in the language syntax is a thought-out practical compromise,
> though the issue may be reconsidered in the future depending on programmer
> feedback.

To see what the backslash does, see the Pipes section:
<http://code.google.com/p/anic/wiki/Tutorial>

Edit: I'm not defending these arguments, simply pointing out that the
developers have put forth some reasons.

~~~
norswap
Yeah right, I guess the 100 millions or so French-speaking people don't amount
to much. On French keyboards it's ctrl+alt+"<" (which is at the bottom left of
the keyboard), or, when available "Alt Gr"+"\".

Going out of your way to produce such small and dubious improvement is always
a bad idea imho.

If you really think C syntax is a pain point, the sanest thing to do is to go
with textual keywords like in ruby or lua.

~~~
chime
Sorry, I'm not the developer. I was just saying that the FAQ explains the
choice of backslash, regardless of whether it is sane or not.

~~~
norswap
I understand that, my reaction was of course towards the developer explanation
and not you.

------
jmduke
* The language couldn't possibly be simpler... *

followed by

* getChopsticks = [--> ?] { \chopstick, \nextPhil.chopstick --> }; *

is just dripping with irony.

------
canadaduane
I've been on the mailing list for over a year, and unfortunately, the
developer seems to have abandoned it. Cool project though.

------
joshbaptiste
<http://news.ycombinator.com/item?id=1042122>

<http://news.ycombinator.com/item?id=1898573>

_sigh_ I still can't get past the syntax..

------
ricardobeat
Original post 3 years ago: <http://news.ycombinator.com/item?id=1042122>

Is there a repository of sample code? I'm curious about how interacting with
the filesystem, network, graphics would look like.

------
stesch
Oops. Project looks a bit dead. Newest code from 2010.

------
stesch
The \\] in the examples look so strange, I thought they are some formatting
error.

------
v33ra
Looks like it's not in active development. The documents and source code are
dated 2010.

<http://code.google.com/p/anic/source/list>
<http://code.google.com/p/anic/w/list>

------
j_baker
_anic is the reference implementation compiler for the experimental, high-
performance, implicitly parallel, deadlock-free general-purpose dataflow
programming language ANI._

One other thing: anic is buzzword-compliant.

------
vhf
Latest commit Sep. 2010. Is this project still alive ?

------
lazyjones
not again, it was posted recently and still has no working implementation
apparently so we can verify the "faster than C" claim.

------
soup10
_In short, ANI seeks to break out of the shackles of imperative programming --
a stale paradigm which for four decades has produced hundreds of clones of the
same fundamental feature set, none of which offer intuitive hands-off
concurrency, and differing only in what lengths they go to to sugar-coat the
embarrassing truth that they're all just increasingly high-level assemblers at
heart;_

Haha. The entire point of programming is to tell the hardware what to do. Any
programming language that is not 'high-level assembly' has severe leaky-
abstraction problems. The reason C and C++ still enjoy so much success despite
limited syntax is that they stay true to the hardware and don't force another
layer of abstraction on you.

~~~
infinitesimal
Functional programming is a leaky abstraction?

------
sswezey
The url ends in p/anic

The syntax looks awful and confusing

------
buster
Please, the next person who designs a language (which are often enough US
people i guess), CHECK KEYBOARD LAYOUTS IN EUROPE FIRST.

Really. It's a pain to type []{} and \ on a german keyboard especially if it's
supposed to be like every second character! Stop it. Please. Especially when
there are proven languages that can cope without all this sh*t (yes, i am
looking at python here).

Edit:

Although this might be an interesting language there is no way i am going
through this syntax just to "check it out". Lost an opportunity to gain a new
community member.

------
forgotAgain
Is it April 1st already?

------
tedunangst
Front page claims there's a Pascal dining philosopher's implementation on the
Wikipedia page. Except there isn't. There's a link to the article about
Rosetta Code. After following that link, and then clicking around some more, I
still haven't found this Pascal version to compare....

Anyway, the reason I ask is because I wanted to know what this line does:

    
    
        =;

~~~
evincarofautumn
That line has no counterpart outside of ANI. At first I thought it was some
kind of guard or synchronisation point, but according to the Yacc grammar, it
just separates “instructors” from “outstructors”[1]. Like the rest of the
syntax, it’s not terribly clear at first glance.

[1]:
[http://code.google.com/p/anic/source/browse/src/parserGramma...](http://code.google.com/p/anic/source/browse/src/parserGrammar.y#401)

~~~
tedunangst
So much for simpler than sh...

------
pnathan
Dataflow ideas are cool, but this syntax is kind of crazy. It sounds like a
neat concept to redo in a more palatable approach.

------
Too
Suddenly regular expressions felt so readable.

------
InclinedPlane
Right, because the concerns we have today primarily is high-performance
uniprocessor computing. Or maybe not. Does it seem to anyone else that almost
all of the people creating new languages lately are generally tackling the
wrong problems?

------
efnx
This same repo was posted here in November of 2010. I started following it,
but the owners quickly got overwhelmed with other projects, or work, and it
all lost steam. I deleted my google group membership yesterday. Funny this
pops up now.

~~~
efnx
I'm sorry, it was posted at hackurls.

------
podperson
If you're going to complain about the syntax, complain that everything is
left-to-right (except math inside expressions) except initializing variables
which, for some reason, is right-to-left.

------
tuananh
the syntax looks like a PITA. i stopped reading right after i saw it.

------
alok-g
See also: <http://en.wikipedia.org/wiki/Dataflow_programming#Languages>

------
DanielRibeiro
Comments from former submission: <http://news.ycombinator.com/item?id=1042122>

------
jpenner
Interesting ideas, but the compiler produces zero-byte executables and crashes
trying to build the two-liners in the tutorial.

------
archivator
This looks like Communicating Sequential Processes with an ugly syntax and a
standard library. What am I missing here?

------
sbeckeriv
No one pointed out it says panic in the url?

<http://code.google.com/p/anic/>

------
borplk
Looks like they developed it behind closed doors without asking a single
person.

------
anuraj
Better than sliced bread ....

------
asynchronous13
This is remarkably similar to HDL in concept (though not in syntax).

------
MindTwister
Did anyone notice this little gem in the URL? _/p/anic_

------
cheald
And apparently less readable than Perl.

------
swah
Hm, this logo reminds me of Factor...

------
tawm
You are now thinking with pipes.

------
aklofas
I'm pretty sure anic is fake and the website was built by a troll. My brain
cannot find any meaning and any of the code. It's just gibberish

~~~
gweinberg
Yes, this "language" is clearly a joke. I'm surprised to see so many comments
treating it as if it were serious.

