interpreted-language

How to run a haskell file in interpreted mode

霸气de小男生 提交于 2019-11-27 18:04:55
I've been told you can interpret haskell files (which I assume means they will work like Ruby/Python/Perl). Can't find the command line option on ghc to do this, though. It always wants to compile my file. Took a look at ghci as well, but it always dumps me into a repl. I'm basically wanting to just do ghc -i MyFile.hs (where -i is a made up flag that I'm pretending correllates to interpreted mode) and have it execute so that I can get quick feedback while I'm trying out ideas and learning. $ runhaskell MyFile.hs Alternatively, runghc (they're the same thing). ghci MyFile.hs will also start an

Why interpreted langs are mostly ducktyped while compiled have strong typing?

自闭症网瘾萝莉.ら 提交于 2019-11-27 04:58:38
问题 I just don't know that, is there any technical reason for that? Is it more difficult to implement a compiler for a language with weak typing? What is it? 回答1: The premises behind the question are a bit dodgy . It is not true that interpreted languages are mostly ducktyped. It is not true that compiled languages mostly have strong typing. The type system is a property of a language . Compiled versus interpreted is a property of an implementation . Examples: The programming language Scheme is

Do comments slow down an interpreted language?

被刻印的时光 ゝ 提交于 2019-11-27 04:34:44
I am asking this because I use Python, but it could apply to other interpreted languages as well (Ruby, PHP, JavaScript). Am I slowing down the interpreter whenever I leave a comment in my code? According to my limited understanding of an interpreter, it reads program expressions in as strings and then converts those strings into code. It seems that every time it parses a comment, that is wasted time. Is this the case? Is there some convention for comments in interpreted languages, or is the effect negligible? For the case of Python, source files are compiled before being executed (the .pyc

Is Ruby really an interpreted language if all of its implementations are compiled into bytecode?

雨燕双飞 提交于 2019-11-27 01:22:13
问题 In the chosen answer for this question about Blue Ruby, Chuck says: All of the current Ruby implementations are compiled to bytecode. Contrary to SAP's claims, as of Ruby 1.9, MRI itself includes a bytecode compiler, though the ability to save the compiled bytecode to disk disappeared somewhere in the process of merging the YARV virtual machine. JRuby is compiled into Java .class files. I don't have a lot of details on MagLev, but it seems safe to say it will take that road as well. I'm

How to run a haskell file in interpreted mode

僤鯓⒐⒋嵵緔 提交于 2019-11-26 19:13:52
问题 I've been told you can interpret haskell files (which I assume means they will work like Ruby/Python/Perl). Can't find the command line option on ghc to do this, though. It always wants to compile my file. Took a look at ghci as well, but it always dumps me into a repl. I'm basically wanting to just do ghc -i MyFile.hs (where -i is a made up flag that I'm pretending correllates to interpreted mode) and have it execute so that I can get quick feedback while I'm trying out ideas and learning.

Do comments slow down an interpreted language?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 11:16:01
问题 I am asking this because I use Python, but it could apply to other interpreted languages as well (Ruby, PHP, JavaScript). Am I slowing down the interpreter whenever I leave a comment in my code? According to my limited understanding of an interpreter, it reads program expressions in as strings and then converts those strings into code. It seems that every time it parses a comment, that is wasted time. Is this the case? Is there some convention for comments in interpreted languages, or is the

If Python is interpreted, what are .pyc files?

爱⌒轻易说出口 提交于 2019-11-26 01:25:17
问题 I\'ve been given to understand that Python is an interpreted language... However, when I look at my Python source code I see .pyc files, which Windows identifies as \"Compiled Python Files\". Where do these come in? 回答1: They contain byte code, which is what the Python interpreter compiles the source to. This code is then executed by Python's virtual machine. Python's documentation explains the definition like this: Python is an interpreted language, as opposed to a compiled one, though the

Is Python interpreted, or compiled, or both?

◇◆丶佛笑我妖孽 提交于 2019-11-26 01:04:11
问题 From my understanding: An interpreted language is a high-level language run and executed by an interpreter (a program which converts the high-level language to machine code and then executing) on the go; it processes the program a little at a time. A compiled language is a high-level language whose code is first converted to machine-code by a compiler (a program which converts the high-level language to machine code) and then executed by an executor (another program for running the code).