5 ms·
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)
by mamcx 14y ago
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)
- z3phyr 14y agoYeah people are trying to port clojure on LuaJIT.. It is possible.
- dmpk2k 14y agoI'm curious how they map Clojure's persistent data structures with many threads onto Lua states.
- nickik 14y agoClojure 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.
- dmpk2k 14y agoThey're feasible, but a lot less interesting if you're not taking advantage of multiple cores.
- nickik 14y agoI disagree, functional programming is the right way to go without multithreading.
- z3phyr 14y agoFunctional programming makes multithreading easier. This is one of the primary reason people are taking interest in this way of programming.
- nickik 14y agoIt 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.
- graue 14y agoI 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 https://github.com/raph-amiard/clojurescript-lua http://raph-amiard.github.com/ClojureScriptLua.html http://raph-amiard.github.com/ClojureScriptLua.html
- z3phyr 14y agoActually they use clojurescript because, the compiler is already writern in clojure. They just need to bootstrap it to th VM.
- deleted 14y ago[deleted]
- fusiongyro 14y agoI'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/ 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!
- someone13 14y agoYes, totally possible! For example, see MoonScript, a CoffeeScript-like language that compiles to Lua: http://moonscript.org/ http://moonscript.org/
- jd 14y agoIt'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.