What programming languages are commonly used for web development?

  • Thread starter Thread starter fog37
  • Start date Start date
  • Tags Tags
    Gui Shell
Click For Summary
SUMMARY

The discussion centers on the definitions and distinctions between shells, consoles, and terminals in the context of programming and operating systems. A shell, such as Bash or PowerShell, serves as a command-line interface that interacts with the operating system, while a console refers to the hardware used for input and output. The terminal acts as a logical device facilitating communication between the user and the shell. The Python interpreter, accessed via various shells, executes Python code, demonstrating the interconnectedness of these components.

PREREQUISITES
  • Understanding of command-line interfaces (CLI) such as Bash and PowerShell
  • Familiarity with the Python interpreter and its execution environment
  • Knowledge of operating system interactions with user commands
  • Basic concepts of input/output redirection in programming
NEXT STEPS
  • Explore the differences between various shell types, including Bash, Zsh, and PowerShell
  • Learn about the Python interpreter and its functionalities in different environments
  • Research input/output redirection techniques in Unix and Windows systems
  • Investigate the role of terminals in modern operating systems and their historical context
USEFUL FOR

This discussion is beneficial for software developers, system administrators, and anyone interested in understanding the intricacies of command-line interfaces and their interaction with programming languages like Python.

  • #31
PeterDonis said:
Btw, for those of us old enough to remember dialup connections, "terminal" was also used back then to refer to the application that you used to manage dialup connections. Early versions of Windows even called that application "Terminal".
Some of us old dudes would use "terminal" to refer to the physical keyboard/display unit that sits at the end of a terminal connection. The connection traditionally being RS-232c or 50 ma current loop. [Or 110 baud acoustic coupler when I was first learning]. The terminal being something like a VT52, VT100, ASR33 or LA120.

The "console" is then the specific terminal that is plugged into the console port which is where the computer displays critical error messages, accepts boot time commands and, perhaps, run time interrupts. For instance, halting the computer for everyone by hitting control-P on the console terminal.
 
  • Like
Likes   Reactions: FactChecker
Technology news on Phys.org
  • #32
fog37 said:
  • In general, is it correct to say that shells run interpreters? Is an interpreter any program converting user commands into instructions for the OS? Does every application program have to have an interpreter running under the hood every time the application is running? For example, when using a word processor, we don't need to run a shell. But is there an interpreter running somewhere?
Just to clarify the interpreter. An interpreter can work on each command as it is typed in by the user. That allows great flexibility for the user, who can see the results of one command before he decides what to do next. But the process of interpreting slows things down, and the user can make errors. If a programmer already knows what he wants a program to do from beginning to end, he can compile and link the program into an executable program. That allows the executable to run much faster every time without interpreting the original program each time, and often without needing constant interaction with the user. It might also reduce user errors in a repetitive process that might be tricky to get right every time. So there is a trade-off between the interpreter's step-by-step flexibility and the executable's speed and repeatability. Each has its place.
 
  • Like
Likes   Reactions: fog37
  • #33
FactChecker said:
Just to clarify the interpreter. An interpreter can work on each command as it is typed in by the user. That allows great flexibility for the user, who can see the results of one command before he decides what to do next. But the process of interpreting slows things down, and the user can make errors. If a programmer already knows what he wants a program to do from beginning to end, he can compile and link the program into an executable program. That allows the executable to run much faster every time without interpreting the original program each time, and often without needing constant interaction with the user. It might also reduce user errors in a repetitive process that might be tricky to get right every time. So there is a trade-off between the interpreter's step-by-step flexibility and the executable's speed and repeatability. Each has its place.

thanks FactChecker. So what kind of software programs generally need the assistance of an interpreter? Those programs that are run through a shell?

As mentioned, a word processor is a different type of software than Python whose purpose is to run Python code...
 
  • #34
fog37 said:
thanks FactChecker. So what kind of software programs generally need the assistance of an interpreter? Those programs that are run through a shell?

As mentioned, a word processor is a different type of software than Python whose purpose is to run Python code...
Essentially no software programs require the assistance of an interpreter. Word processors, spreadsheets, email programs, complex numerical applications, video games, flight control programs, etc. They can all run standalone. They will typically use operating system API's directly.

The exception to this rule are things like shell scripts. Roughly speaking, these are sequences of commands that a shell can execute.

e.g.

Code:
$ cat zonedump.sh
#!/bin/bash
/opt/nwreg2/local/usrbin/nrcmd <<EOD > zonelist.tmp
zone listnames
EOD
egrep "\.$" zonelist.tmp | awk '{print "./dumpzone.sh ", $1}' > zonelist.sh
. zonelist.sh

$ cat dumpzone.sh
$!/bin/bash
dig @127.0.0.1 $1 axfr | grep $1 | grep -v ";;" | sort -u > zones/${1}dump

One could argue that things like Basic programs, Perl scripts, Python scripts, Java applets, etc need a Basic interpreter, a Perl interpreter or a Python interpreter or a Java run time environment, etc in order to be executed.

In the Unix environment, such programs are identified by a stylized first line that identifies the program that needs to be used to run them. In the above example, those two scripts need to use the bash shell which lives in /bin/bash.

For a Perl script, one might have...

Code:
$ head /usr/local/scripts/imac-add.pl
#!/usr/bin/perl
#
# imac-add.pl -- process an IMAC add or rediscover
#
# Usage: imac-add.pl hostname ip > cnrcommands.txt
[...]

In other environments, different approaches are taken to activating the needed support environment. For instance, in Windows, the Registry records what application is to be used then "opening" a file with a particular extension. So Perl might be automatically activated when invoking a program with a .pl extension.
 
Last edited:
  • #35
fog37 said:
thanks FactChecker. So what kind of software programs generally need the assistance of an interpreter? Those programs that are run through a shell?

As mentioned, a word processor is a different type of software than Python whose purpose is to run Python code...
There are trade-offs and a large gray area in between. In general, I prefer interpreted languages when I am developing a process/algorithm and want to see the results of intermediate steps. That allows me to correct mistakes and decide what to do next. This is especially true if I do not think that I will need to repeat that exact process often enough to make an executable program.
Suppose I have a process that will be repeated and the steps are tricky. Once I think that I have the correct sequence of commands, I would usually put them into a script in that same language and run the script through the interpreter for future runs.
Now suppose the process is one where the interpreted language is too slow. A compiled executable has a distinct advantage there. It does not need to reinterpret the code every time. It can also do a lot more optimization of the process because it knows the entire sequence of steps from beginning to end and can do a lot of smart things to speed up the process. If that is true, it would be worthwhile to convert the program to a compilable language.
The decision of which language to use can get blurred. There has been a lot of work to improve the speed of interpreted languages and to allow them to make compiled versions or partially compiled p-code. But I am not aware of any interpreted language that can achieve the speed of optimized executables from C, C++, Fortran, etc. unless they are also compiled and optimized.
 
  • Like
Likes   Reactions: fog37
  • #36
To further muddy the waters, there are many cases where a program can be interpreted, or compiled into an executable. Same program, user's choice, independent of language. There have even been a few FORTRAN interpreters.
 
  • Like
Likes   Reactions: FactChecker
  • #37
Yes, as a beginner in coding, I am familiar with compiled, interpreted, and hybrid computer languages.
Either way, a compiler or translator is simply a program that translates high-level instructions into machine readable instructions.
This whole discussion started in my head when I pondered if other programs (applications like Word, Photoshop, etc.), besides the simple Python programs I am writing, needed an "interpreter" and a shell too to operate...

So here we are :)
 
  • #38
jbriggs444 said:
The exception to this rule are things like shell scripts. Roughly speaking, these are sequences of commands that a shell can execute.
jbriggs444 said:
One could argue that things like Basic programs, Perl scripts, Python scripts, Java applets, etc need a Basic interpreter, a Perl interpreter or a Python interpreter or a Java run time environment, etc in order to be executed.

And similarly, a shell script needs a shell interpreter in order to be executed. In other words, as I pointed out a number of posts back, a shell program like bash is an interpreter.

fog37 said:
This whole discussion started in my head when I pondered if other programs (applications like Word, Photoshop, etc.), besides the simple Python programs I am writing, needed an "interpreter" and a shell too to operate...

Programs in languages like Python do not need a shell in order to operate, they just need the Python interpreter. Don't be confused by the fact that you can start an interactive session with the Python interpreter from a shell prompt; while the Python interpreter is running, the shell program (bash, for example) is just sitting there doing nothing; the Python interpreter doesn't need the shell to run Python code.
 
  • Like
Likes   Reactions: pbuk
  • #39
FactChecker said:
An interpreter can work on each command as it is typed in by the user.
Not all interpreters can do that, and there is a modern term for this mode: a read-eval(uate)-print loop (REPL).
 
  • Informative
Likes   Reactions: FactChecker
  • #40
jbriggs444 said:
Essentially no software programs require the assistance of an interpreter.
The code that runs this website requires an interpreter, as does the code that runs Wikipedia, WordPress.com, parts of Twitter, Facebook and Google apps, GitHub...
 
  • #41
pbuk said:
Not all interpreters can do that

Can you give examples of ones that can't?

pbuk said:
The code that runs this website requires an interpreter

Can you clarify what code you are referring to?
 
  • #42
PeterDonis said:
Can you give examples of ones that can't?
The standard implementation of Perl, the JavaScript interpreter in some web browsers, most 'traditional' (i.e. with line numbers) versions of BASIC, PHP in some environments.

PeterDonis said:
Can you clarify what code you are referring to?
The forum software XenForo which is written in PHP.
 
Last edited:

Similar threads

Replies
5
Views
1K
Replies
33
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
Replies
3
Views
2K
Replies
38
Views
3K
  • · Replies 13 ·
Replies
13
Views
2K
Replies
86
Views
2K
  • · Replies 17 ·
Replies
17
Views
2K
Replies
4
Views
2K
Replies
11
Views
2K