11 ms·
Ana is a Python, PHP, and C inspired dynamically typed scripting language
- vlan121 4y agoShould be using camelcase-letters whilst searching on Google: anaLang
- bawolff 4y ago> Ana is a Python, PHP, and C inspired dynamically typed scripting language I wonder what they took from c not counting the parts of c that literally everyone took
- asddubs 4y agofinally a dynamically typed language where signed integer overflow is undefined behavior
- deleted 4y ago[deleted]
- eyelidlessness 4y agoBeing curious… I think this might actually be a useful shell scripting language? I can’t think of where else I’d apply it.
- snthpy 4y agoWhat's the point? No link to more detailed documentation that might explain why I would want to use this compared to the languages it says it took inspiration from.
- astro-codes 4y agoPerhaps the author made it for themselves and not you...
- d--b 4y agoWell it’d still be good to know why the author made it. Is it a toy language to learn about how to build a vm-interpreted language? Is it because the author can’t stand Python indentation. Or maybe there is a reason that clearly makes this interesting to use in the real world. Because from the readme, it doesn’t look like this language brings anything to the table compared to Python/Node.
- tuyiown 4y agoThis is posted by the author himself, I find it pretty rude to let people figure out the point of their own project when promoting it.
- KyeRussell 4y ago“promoting” is a bit of an assumption. God bless Hacker News.
- samhw 4y agoIs it? Irrespective of what I think of the post, I can't see any context in which posting it to a large forum full of strangers wouldn't count as 'promoting it'.
- Doctor_Fegg 4y agoA little mean-spirited, perhaps? Not everything needs a "point". Sometimes it's just fun to make stuff.
- bawolff 4y agoMaybe OP could phrase it a bit better, but i dont think its wrong to want some context. If its just for fun, that's definitely cool, but its also good to say that. Similarly, if there is something unique about the language, it would be nice to say that too. Its not that the project has to be ground breaking or anything, just be nice to know what we're looking at.
- ryanmccullagh 4y agoHello! I get asked this question a lot. My goal for this project is not to convince you to use it. This new language does _nothing_ that you couldn't find in other languages today. This project won't take over the world, and many people ask me what the point of it is. It's purely a project stemmed from curiosity with absolutely no capitalistic motives. I did it based on my years of self-directed research studying many incredible programming languages, and this is what I have to show for my research. My motivation for this was to learn how to build a programming language with a grammar, virtual machine, and garbage collector. It's a hobby project, not intended to be used for business.
- danuker 4y agoFor personal work, consider starting with "Show HN" in the title. https://news.ycombinator.com/showhn.html https://news.ycombinator.com/showhn.html
- saurik 4y agoFWIW, I think I would be particularly confused by a "Show HN" on a project that the author explicitly didn't intend for me to actually use?
- danuker 4y agoAuthor: > My motivation for this was to learn how to build a programming language with a grammar, virtual machine, and garbage collector. Show HN FAQ: > Show HN is for something you've made that other people can play with. HN users can try it out, give you feedback, and ask questions in the thread. My guess is the author shared it for the learning opportunity.
- a3w 4y agoShowHN FAQ: Commentators: Be nice! Yupp, fits ShowHN better. Why not Annalang?
- pvg 4y ago
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- tangus 4y agoI just saw two screenshots and already don't like it. It seems its output sacrifices information for the sake of... tabulation? presentation? I don't know, but it's the wrong call. Maybe it wasn't intended, but having that screenshot as the tool's showcase sends a message to me.
- toomanydoubts 4y agoI don't think you have fully understood the screenshots. The first one shows an example source code, the second one shows the byte code generated from the source code of calling the print function. This is the bytecode that will be executed when the program is executed. It has nothing to do with the output of the program itself.
- tangus 4y agoI understood them. Take a look at the constants table, indices 0, 2, 4, 6: the column "Value" is truncated. Now imagine you have trouble with an ana function and want to take a look at the generated bytecode. Would you rather have the columns perfected aligned and try to guess the loaded function name from its first letter? I see several HNers with downvote capacity would, which is a surprise...
- klibertp 4y agoGuilty as charged: https://klibert.pl/statics/awesome-taglist-shown.png https://klibert.pl/statics/awesome-taglist-shown.png - see `make_wibox_conta[iner, obviously]`. It happens when you don't want, or can't, compute the needed column width before printing. It's just a lot less code to pick a number and leave the formatting for later. The same problem bit me multiple times when pretty-printing nested data structures. There's often an arbitrary limit to the depth the printer recurse to and/or the number of elements that get displayed, with the rest hidden behind "..." or something similar. No matter what number you pick, sooner or later you're going to get a case where you miss a really interesting/important piece of information because it got hidden. And if you try to change the default, you're going to get a case where you miss important info because you couldn't be bothered to scroll that far up... Anyway: you're right, this is bad, but also pretty common. Though in this particular case it's really bad, because most of the column width is taken by irrelevant data. Replacing `<function '` with λ would already help a lot.
- afarrell 4y agoI’m interested to know what sort of insights you get from creating a language like this.
- ryanmccullagh 4y agoI can answer this. The biggest insight I've gained from going deep into language implementation is that primitive and fundamental concepts do not go away even if things are abstracted by high level features in high-level languages. For example, loops, jumps, will find themselves underlying in any language implementation regardless of the languages abstractions.
- killingtime74 4y agoDo you mean for all imperative languages? Functional or declarative languages can do away with loops and jumps. Not trying to nitpick, perhaps you had some further insights when creating this
- dahfizz 4y agoOP said > primitive and fundamental concepts do not go away even if things are abstracted by high level features in high-level languages. Loops do not go away in fp. They are just hidden under layers of abstraction.
- bawolff 4y agoMost fp loop-like things are recursion. Traditional iterative loops are abstractions over goto. Arguably a function call is an abstraction of goto (JMP)+stack manipulation. So they are both abstractions over goto, but i would say they are sibling abstractions not parent/child.
- lelanthran 4y ago> Do you mean for all imperative languages? Functional or declarative languages can do away with loops and jumps. At the programmer interface, sure. At the implementation level ("underlying"), all that abstraction is being turned into loops and jumps.
- sscarduzio 4y agoAnother language with google-unfriendly name. :(
- coldtea 4y agoAnd we've seen how that hurt C, and Go...
- sscarduzio 4y agoC was named in pre internet times. So I understand. With go, they had to come up with a nickname for it (golang). So now the language has two names. As a result, the typical "go <something>" and "golang <something>" search results will always be potentially imprecise, and partial (unless everybody in the world stops calling it "go" in favour of "golang". The really incredible part of this story is that Go came from... Google.
- cies 4y ago>The really incredible part of this story is that Go came from... Google. Yeah. They leave SEO to other shops. I think they did not even intend to have this language released in public at first.
- EdwardDiego 4y agoI'm wondering how many overly aggressive web filters will block searches for "analang" until it gets whitelisted like "analysis". The good ol Scunthorpe problem.
- nfin 4y agoI would guess that similar to “Go/golang” for searches and tags “analang” would become a thing. But it means you are partly right
- deleted 4y ago[deleted]
- dtx1 4y agoPHP and C inspired don't sound like selling points to me. Quite the opposite factually
- ArtemZ 4y ago
- tonyedgecombe 4y agoI'd love to see a modern equivalent to PHP. Something for all those quick and dirty web jobs but without the language deficiencies of PHP.
- dtx1 4y agoThat's really the thing with PHP isn't it? Getting something done as Quick and Dirty as with PHP is not easy to do with any other language when it comes to "the web"
- tored 4y agoOne possibility is to make a language that compiles to PHP, like what TypeScript is for JavaScript, but not necessarily superset. PHP already has a ton of well tested infrastructure to interact with web servers so you don't want to reimplement that again. And by compiling to PHP you get the same request model that PHP has which works great for quick and dirty web jobs. You can also leverage the performance improvements of PHP. If you could hook that up to apache with a handler it would be great compile to PHP language file extension -> Apache handler -> compile it to PHP -> Apache handler -> PHP Apache SAPI
- ss108 4y agoIs Python not sufficient for that? I am unfamiliar with PHP, wondering what benefits it has that might lead someone to choose it for a task today.
- jrwr 4y agoThe biggest feature of PHP for new people to the language is in-lining You can do stupid stuff like <table> <?php foreach($array as $row){ ?> <tr><td><?php echo $row[0];?></td></tr> <?php } ?> Meaning you can just inlay PHP in your raw HTML as you please, this example will reprint the <tr> and <td> for every key in $array
- brian_herman 4y agoI really like the syntax looks like javascript.
- Kaotique 4y agoAwful negative comments today. Congratulations on releasing your language. What were some of the challenges you faced?
- deleted 4y ago[deleted]
- ryanmccullagh 4y agoThanks! For the negative comments, I'm proud to say that I don't care. I've had bosses even ask me what the point of this is when I've shared it. Some perhaps don't understand that you can do things for the sake of doing it. Overall the most difficult things to understand were: - How context-free grammars are parsed, and how they're defined. I'm still not an expert, but I can say that I can write a recursive parser by hand. I wrote my own JSON parser based on my understanding [0] - Garbage collection. I think most GC's are based on the mark-sweep algorithm. Perhaps even Java's most advanced algorithms are a version of mark-sweep. Mark-sweep is so simple, that it took me a _long_ time to understand it. Reference counting and mark-sweep go together. [0] https://github.com/rmccullagh/libjsonparser https://github.com/rmccullagh/libjsonparser
- skrebbel 4y ago> Mark-sweep is so simple, that it took me a _long_ time to understand it. I love everything about this sentence
- UncleEntity 4y ago> Reference counting and mark-sweep go together. You mean the sweep phase goes through and cleans out all the objects with zero reference counts? I always thought the point of reference counting was to deallocate the object once the count goes to zero (which is why people complain it is slow as it can lead to cascading effects). As to “most GC's are based on the mark-sweep algorithm” — I have a whole folder of papers on different GC algorithms, probably not the rabbit hole you want to go down if you have something you’re happy with. The minischeme interpreter I poke at every once in a while has a super simple GC that I have to resist messing with because it Just Works™ and I’d be chasing my tail for who knows how long getting another one working.
- bodge5000 4y agoAlmost sounds like the opposite of something like Nim, which is also Python inspired but removed the dynamic typing and kept the indentation. I think I prefer using curly braces to indentation. I seem to remember reading that Nim strictly enforces spaces over tabs (rather than having it as a linter rule, or just asking you pick one consistently) which has kept me away from the language for some time, whereas you don't tend to get those hard rules with curly braces. Could be wrong on that, and would be happy to be corrected Sorry to detract from the main thread though, looks really nice regardless
- xigoi 4y agoBeing forced to use a certain style is a good thing. There's less arguing. Haskell is also indentation-based and requires spaces.
- bodge5000 4y agoYou only tend to find that when the style your being forced to use happens to align with your own style, or you don't use the language/tool and therefore aren't affected by it. In my experience, a lot of programmers will shout from the rooftops about the importance of consistency until the agreed upon standard isn't their standard, at which point consistency is no longer the most important matter at stake.
- xigoi 4y agoThat's not true. For example, I prefer 2-space indents, but I use 4-space indents in Python because that's the convention.
- syockit 4y agoPaired with a characters-per-line limit, 4-space indents forces you to better modularise your so that it doesn't nest too deep (which usually happens when your code is becoming too complex) so I guess that's the wisdom behind the convention.
- 4y ago
- lelanthran 4y agoThis looks nice. As someone who is on-again/off-again on a side-project to design my own language[1], what would you say were the hardest, or most tedious, or least enjoyable[2] parts of the work leading up to this release. [1] Compiled, though, not interpreted. [2] Specifying what goes into the language, small snippets of code to show how certain features will look and behave, etc (basically language design) is very enjoyable, and I spend a lot of time doing (and redoing) this. Once I started on parsing into an AST I lose interest.
- max0563 4y agoAs with most things, the ancillary tasks are always the most annoying part of developing a language. Even if the language is just for yourself or a small group of people, you still need to build the tools around the language that make it usable and I find that to be the most tedious part and often the hardest part. If you're getting hung up on parsing and what not, you might be more successful using a parser generator. People hate them, often for good reason, but they do allow you to iterate quickly at first. I haven't used it personally, but if you plan on using LLVM I hear that is a nightmare to use. Probably would also fit in to the "hardest", "tedious" and "least enjoyable" category for you too.
- ModernMech 4y ago> If you're getting hung up on parsing and what not, you might be more successful using a parser generator. People hate them, often for good reason, but they do allow you to iterate quickly at first. I find using a parser combinator library or a PEG (https://en.wikipedia.org/wiki/Parsing_expression_grammar https://en.wikipedia.org/wiki/Parsing_expression_grammar) is a better way to go. Usually expressing your grammar in these ways is not much more work than expressing it in an EBNF-esque style that a parser generator takes as input. The benefit is that you have a custom parser that is easier to modify and customize.
- max0563 4y agoThat is another great option, especially for getting started. This is something we have done at work to build our internal DSL. We used the wonderful Lark parsing library for Python. It allowed us to iterate very quickly and get the tool in the hands of the people that were intended to use it asap. I don't think I would use a parsing lib to build a general purpose programming language though. At least not one that I intended to ship.
- gvx 4y agoThe README says "Hint: Make sure String.ana is located in the directory of logger.ana. It's located in the lib directory." but I can't find a lib directory or String.ana anywhere in the repository?
- kaladin_1 4y agoIs String module bundled with the repository because I couldn't find it there. I wonder what he meant by that statement really.
- ryanmccullagh 4y agoHey, so my apologies, but the README is inaccurate, unfortunately. Modules were removed in a commit, but they were working, they just weren't perfect. I plan to bring that commit back [0] [0] https://github.com/analang/ana/commit/a2a62301388ae1843c60f239874a9431b408f25b https://github.com/analang/ana/commit/a2a62301388ae1843c60f2... [0] https://github.com/analang/ana/commit/a361c4498c0f44c4d28f4f30fe378d05bb2efbee https://github.com/analang/ana/commit/a361c4498c0f44c4d28f4f...
- rplnt 4y ago> No description, website, or topics provided. Author could copy this title to the github description.
- deleted 4y ago[deleted]
- MrYellowP 4y ago
- eimrine 4y agoI understand your pain, but making a slightly custom layout is not that hard tbh. And another tbh is that people who program does have an English layout, the only exception I know is 1с lang where all keywords are casting on Russian.
- sgjohnson 4y agoIt’s really not that difficult to either switch layouts on the fly, or roll your own, so you can easily type the curly brackets. Plenty of programming languages use the curly brackets, and English is the de facto language of tech. And I’m not a native English speaker, and I have rolled my own keyboard layout that suits my particular needs on macOS (Ukelele), Windows (Microsoft Keyboard Layout Creator) and Ubuntu (forgot the name of the tool).
- pacifika 4y agoThis is a great learning experience. There is a lack of people with the skill to reimagine how things are built so I’m sure this will pay off massively in future endeavours.
- kaladin_1 4y agoI am really interested in your project because it looks small enough to help others learn how to design and implement a language. If you wish, could you add more details to your README file.
- ryanmccullagh 4y agoWell, I'm happy that you found it useful. If you ever want to chat, or have questions, my email is my profile. I intend to update the README soon.
- geedzmo 4y agoInteresting project but I can't unread the fact that you chose to name something Ana followed by a word which starts with an L. Wish you all the best.
- Vanit 4y agoYep, see #susanalbumparty
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- crate_barre 4y agoIt’s not even one of those obsessive compulsive anally typed non-compiled languages either, so anal-lang doesn’t even fit.
- devjam 4y agoCan’t. Unsee. This…
- short_sells_poo 4y agoThis must've been deliberate. I can't imagine a scenario where AnaLang wouldn't have raised flags.
- nprateem 4y agoOr bad code smells
- lpapez 4y agoReminds me of a C++ project I use to work on. The norm was to have generous function naming and not stick to the outdated C convention of short and cryptic names. The only exception was the function "anal", which was curiously shortened from "analyze".
- tjpnz 4y agoWhat inspiration did you take from PHP?
- kijin 4y agoCurly braces and semicolons? Wait, that's actually C. The README showcases some opcodes. Maybe they borrowed PHP's bytecode format or the VM design? If true, that would actually be a pretty neat thing to borrow, since PHP has made a lot of improvement in VM performance and memory management lately.
- ryanmccullagh 4y agoPHP was a reference for me in terms of the parser generator because php-src is implemented with Flex and Bison. However, come to think of it, it's more close to Python and C then it is PHP.
- chrsw 4y agoI like this. Has some nice features yet simple enough than I don't immediately dismiss it because I know I'll never have the time to properly wrap my head around it. Nice work.
- vermilingua 4y agoCan anyone explain the upshot of dynamic typing besides terseness?
- animal_spirits 4y agoFast iteration
- hiccuphippo 4y agoNew compiled languages like zig, jai, roc also focus in fast iteration. I remember a tweet by the Zig creators about it compiling and running a piece of code faster than python interpreted it. Edit: here it is https://nitter.net/andy_kelley/status/1483677253682675713 https://nitter.net/andy_kelley/status/1483677253682675713
- ModernMech 4y ago> rock also focus in fast iteration. Are you thinking of Roc or is this another language?
- hiccuphippo 4y agoI think you are correct. I only heard of it from a podcast and thought it was spelled rock.
- tyingq 4y agoSee any old discussion about golang and generics :)
- rileyphone 4y agohttps://hirrolot.github.io/posts/why-static-languages-suffer-from-complexity https://hirrolot.github.io/posts/why-static-languages-suffer... Dynamic typing didn't come to dominate for no reason.
- throw10920 4y ago
- giorgioz 4y agoWhat does "ang" in analang stands for? :)
- pipeline_peak 4y agoIt’s a cool personal project, but at this level of similarity, why don’t you just write a JS compiler?
- mumblemumble 4y agoBecause one option is more fun than the other?
- pipeline_peak 4y agoTo each his own, but if you aren't adding anything to distinguish, being able to execute npm packages sounds pretty exciting to me.
- IshKebab 4y agoImplementing modern JavaScript is a pretty huge task compared to this. But I agree it seems weird to make a new language without any distinguishing features.
- hiccuphippo 4y agoMaybe you don't want all the cruft that comes with Javascript. Something new means you don't need to care about backwards compatibility.
- kgeist 4y agoSpeaking of fun little languages to create as a hobby. After having created several general-purpose languages like this one, I feel like most of such efforts (including mine) are, sadly, very similar to each other, with small variations. There's an urge to create another language for fun, but I wouldn't want to create another variation of the same thing yet again. So I wonder if there's some kind of catalogue of little hobby languages where authors are trying to explore novel, rare ideas, to get inspired by? Ideas like Rust's borrow checker, for example. The efforts I know about are mostly academic (for example, by Microsoft Research). So far my idee fixe lately has been to create a language which natively supports clean/hexagonal architecture/DDD (for example, clean layer separation can be enforced at compile-time, we use a special tool at work), but the lack of languages that explore these ideas makes me wonder why no one came up with it before, and why having monstruous frameworks with a lot of ceremony is the preferred way -- maybe there's already such a language, but it's too obscure to find it somewhere on the internet. A catalog would be useful.
- incanus77 4y agoThere’s another, grid-arranged compilation that I like but can’t seem to find right now, but there is also this: https://github.com/dbohdan/embedded-scripting-languages https://github.com/dbohdan/embedded-scripting-languages
- pjmlp 4y agoWhile Rust is doing lots of interesting work bringing borrow checker into mainstream, it all started with Cyclone. https://en.m.wikipedia.org/wiki/Cyclone_(programming_language) https://en.m.wikipedia.org/wiki/Cyclone_(programming_languag... The biggest issue with all these alternative languages, outside the yearly PhD work on compiler thesis across all universities and SIGPLAN papers, is making them into a product worthwhile adopting, the killer framework or platform that forces regular devs to actually adopt them.
- ModernMech 4y agoAsk and ye shall receive: https://futureofcoding.org/catalog/ https://futureofcoding.org/catalog/ That link is a little out of date. There's a spreadsheet floating around with more projects on it but I'm not exactly sure of the link. It's a small but vibrant community. Our founding fathers would probably be Alan Kay and Bret Victor rather than Dennis Ritchie and Ken Thompson (not saying they founded our group but they are an endless font of inspiration for us). We're trying all kinds of things in programming languages, and the main unspoken rule seems be be: no ALGOL derived languages allowed. Being ALGOL derived is what gives the "very similar to each other, with small variations" vibe that most programming languages have these days. In the PL field we iterated on improving imperative languages for the last 30-40 years, so a surefire way to end up with a radically different language is to build one in a different branch of the PL family tree. https://futureofcoding.org https://futureofcoding.org if it wasn't obvious what the link is to the main site. Edit: here's the spreadsheet: https://docs.google.com/spreadsheets/d/12sTu7RT-s_QlAupY1v-3DfI1Mm9NEX5YMWWTDAKHLfc/edit#gid=0 https://docs.google.com/spreadsheets/d/12sTu7RT-s_QlAupY1v-3...