4 ms·
I'm doing this for Javascript - finding it a lot of fun! https://github.com/timruffles/js-to-c https://github.com/timruffles/js-to-c I'd recommend it as a proj
by timruffles 8y ago
I'm doing this for Javascript - finding it a lot of fun! https://github.com/timruffles/js-to-c https://github.com/timruffles/js-to-c
I'd recommend it as a project to any wanting to learn more about a particular language (implementing a language teaches you how it works in painstaking detail), and get a better 'feel' for how languages and compilation works in general.
- sdegutis 8y agoIronic that your first initial and last name is truffles considering bridging between C and JS (and other languages) is possible if they're implemented via Graal's Truffle library: https://github.com/oracle/graal/tree/master/truffle https://github.com/oracle/graal/tree/master/truffle
- jjnoakes 8y agoIt doesn't have to be negative to get downvotes. Sometimes irrelevant discussion items are downvoted to keep them in the periphery.
- 13of40 8y agoMe too, except with Visual Basic 6. (It's a work thing.) Besides error handling, I think the gnarliest thing I've come across is this: VB has built in file management commands it inherited from GW-BASIC. Built in, in the sense that they're first class statements built into the language. One of these, for renaming files, goes "NAME <old> AS <new>", where old and new can be arbitrarily complex expressions. Name isn't a reserved word, so you can have a variable or subroutine called "name". So consider these three statements: name (...) as (...) name (...) = (...) name (...) ...where (...) represents an arbitrarily complex expression. The first one is a "name as" command, the second is an assignment to an array element, and the third is a procedure call, and you can't tell which until you've fully and accurately parsed the first arbitrarily huge expression. Also, the following: name: In BASIC a colon separates two statements on the same line, and an empty statement is valid, so is this a label or a subroutine call followed by an empty statement? Edit - just remembered this gem: You can use a "With" block to save having to type the name of an object when referring to its members... With SomeObject MsgBox .Name End With ...will pop up a dialog showing SomeObject.Name. Now go ahead and tokenize that second line. If you're like me you got three tokens: [MsgBox][.][Name] The problem is that's indistinguishable from... MsgBox.Name You could say that ".Name" should be one token. Hmm. So what if it's something like... MsgBox .Name.Substring(1, 3).ToUpper() Still one token? I think my hair's going to be white by the time I finish this project.
- timruffles 8y agoSounds like quite the challenge! > Built in, in the sense that they're first class statements built into the language. :O > 94 year old hacker in the great state of Texas Wow, I hope I'm coding at 94!
- 13of40 8y ago> :O I get the same icky feeling when I look at some of the things they've shoehorned into JavaScript over the years, though, like regex.