Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is possible to use this for build a language? (I wanna to create my own language, but hope for something easier than LLVM, java, do it from zero in C)


I'd be surprised if it were easier than LLVM, which is pretty easy.

But if you want to make a language you should absolutely not get hung up on technology. Even though it's very dated, Crenshaw's "Let's Build a Compiler" can teach you everything you need to get started building languages from scratch and by hand, and it moves pretty fast too:

http://compilers.iecc.com/crenshaw/

There are other tutorials out there which will get you places. The first thing to do, really, is make a sketch of the language as you'd like to use it, and get excited about that, and then sit down and implement bits of it at a time. Compiler/interpreter writing is extremely rewarding—you get a lot of payback for your investment. Good luck!


It's actually really easy to take the JIT-compilation engine from LuaJit and use it for the compiler of your own programming language. The LuaJIT code is surprisingly modular, and you can pretty much take what you need.

For scanner/parser generation Lemon and Ragel are terrific. That takes care of building the AST for you. LuaJIT does the heavy lifting and takes care of the architecture specific edge cases. That just leaves the fun part in the middle where you decide on the semantics and syntax of your language.


Yes, totally possible! For example, see MoonScript, a CoffeeScript-like language that compiles to Lua:

http://moonscript.org/


Yeah people are trying to port clojure on LuaJIT.. It is possible.


I got curious and looked into this. The relevant effort seems to be this, a new backend for the ClojureScript compiler which compiles to Lua instead of JavaScript:

https://github.com/raph-amiard/clojurescript-lua

http://raph-amiard.github.com/ClojureScriptLua.html


Actually they use clojurescript because, the compiler is already writern in clojure. They just need to bootstrap it to th VM.


I'm curious how they map Clojure's persistent data structures with many threads onto Lua states.


Clojure data structures do not have many threads. Clojure separates the form of the data and the way that they are processed. All Clojure Data Structures are completly feasable in a single threaded language.


They're feasible, but a lot less interesting if you're not taking advantage of multiple cores.


I disagree, functional programming is the right way to go without multithreading.


Functional programming makes multithreading easier. This is one of the primary reason people are taking interest in this way of programming.


It got popular for this but generally functional programmers are not fans of functional programming because of multicore.

Rich Hicky for example has pointed this out in many diffrent talks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: