Source string Read only

(itstool) path: step/para
Context English State
Ruby is an interpreter, pure object-oriented programming language. It has become widely popular because of its easy to understand syntax, flexibility when writing code, and the ability to easily develop and maintain large, complex programs.
Ruby is available from the Ports Collection as <package>lang/ruby25</package>.
Tcl and Tk
Tcl is an embeddable, interpreted language, that has become widely used and became popular mostly because of its portability to many platforms. It can be used both for quickly writing small, prototype applications, or (when combined with Tk, a GUI toolkit) fully-fledged, featureful programs.
Various versions of Tcl are available as ports for FreeBSD. The latest version, Tcl 8.5, can be found in <package>lang/tcl87</package>.
If you run it in the shell, you may get a core dump.
Compilers are rather different. First of all, you write your code in a file (or files) using an editor. You then run the compiler and see if it accepts your program. If it did not compile, grit your teeth and go back to the editor; if it did compile and gave you a program, you can run it either at a shell command prompt or in a debugger to see if it works properly.<_:footnote-1/>
Obviously, this is not quite as direct as using an interpreter. However it allows you to do a lot of things which are very difficult or even impossible with an interpreter, such as writing code which interacts closely with the operating system—or even writing your own operating system! It is also useful if you need to write very efficient code, as the compiler can take its time and optimize the code, which would not be acceptable in an interpreter. Moreover, distributing a program written for a compiler is usually more straightforward than one written for an interpreter—you can just give them a copy of the executable, assuming they have the same operating system as you.
As the edit-compile-run-debug cycle is rather tedious when using separate programs, many commercial compiler makers have produced Integrated Development Environments (<acronym>IDE</acronym>s for short). FreeBSD does not include an IDE in the base system, but <package>devel/kdevelop</package> is available in the Ports Collection and many use <application>Emacs</application> for this purpose. Using <application>Emacs</application> as an IDE is discussed in <xref linkend="emacs"/>.
Compiling with <command>cc</command>
This section deals with the <application>gcc</application> and <application>clang</application> compilers for C and C++, since they come with the FreeBSD base system. Starting with FreeBSD 10.X <command>clang</command> is installed as <command>cc</command>. The details of producing a program with an interpreter vary considerably between interpreters, and are usually well covered in the documentation and on-line help for the interpreter.
Once you have written your masterpiece, the next step is to convert it into something that will (hopefully!) run on FreeBSD. This usually involves several steps, each of which is done by a separate program.
Pre-process your source code to remove comments and do other tricks like expanding macros in C.
Check the syntax of your code to see if you have obeyed the rules of the language. If you have not, it will complain!
Convert the source code into assembly language—this is very close to machine code, but still understandable by humans. Allegedly.
Convert the assembly language into machine code—yep, we are talking bits and bytes, ones and zeros here.
Check that you have used things like functions and global variables in a consistent way. For example, if you have called a non-existent function, it will complain.
If you are trying to produce an executable from several source code files, work out how to fit them all together.
Work out how to produce something that the system's run-time loader will be able to load into memory and run.
Finally, write the executable on the filesystem.
The word <firstterm>compiling</firstterm> is often used to refer to just steps 1 to 4—the others are referred to as <firstterm>linking</firstterm>. Sometimes step 1 is referred to as <firstterm>pre-processing</firstterm> and steps 3-4 as <firstterm>assembling</firstterm>.
Fortunately, almost all this detail is hidden from you, as <command>cc</command> is a front end that manages calling all these programs with the right arguments for you; simply typing
<prompt>%</prompt> <userinput>cc foobar.c</userinput>
will cause <filename>foobar.c</filename> to be compiled by all the steps above. If you have more than one file to compile, just do something like
<prompt>%</prompt> <userinput>cc foo.c bar.c</userinput>
In case you did not know, a binary sort is an efficient way of sorting things into order and a bubble sort is not.
Note that the syntax checking is just that—checking the syntax. It will not check for any logical mistakes you may have made, like putting the program into an infinite loop, or using a bubble sort when you meant to use a binary sort.<_:footnote-1/>
There are lots and lots of options for <command>cc</command>, which are all in the manual page. Here are a few of the most important ones, with examples of how to use them.
<option>-o <replaceable>filename</replaceable></option>


No matching activity found.

Browse all component changes

Things to check

Multiple failing checks

The translations in several languages have failing checks



English English
No related strings found in the glossary.

Source information

Source string comment
(itstool) path: step/para
No labels currently set.
Source string location
Source string age
11 months ago
Translation file