Commit d9771cbd by James A. Morrison

treelang.texi: Fix whitespacing.

2005-02-25  James A. Morrison  <phython@gcc.gnu.org>

        * treelang.texi: Fix whitespacing.

From-SVN: r95568
parent ae7a0271
2005-02-25 James A. Morrison <phython@gcc.gnu.org>
* treelang.texi: Fix whitespacing.
2005-02-24 James A. Morrison <phython@gcc.gnu.org> 2005-02-24 James A. Morrison <phython@gcc.gnu.org>
PR other/19896 PR other/19896
......
...@@ -259,8 +259,8 @@ Reporting Bugs ...@@ -259,8 +259,8 @@ Reporting Bugs
Treelang was based on 'toy' by Richard Kenner, and also uses code from Treelang was based on 'toy' by Richard Kenner, and also uses code from
the GCC core code tree. Tim Josling first created the language and the GCC core code tree. Tim Josling first created the language and
documentation, based on the GCC Fortran compiler's documentation documentation, based on the GCC Fortran compiler's documentation
framework. Treelang was updated to use the TreeSSA infrastructure by James A. framework. Treelang was updated to use the TreeSSA infrastructure by
Morrison. James A. Morrison.
@itemize @bullet @itemize @bullet
@item @item
...@@ -618,9 +618,9 @@ be absent, and if the function is not void the expression must be ...@@ -618,9 +618,9 @@ be absent, and if the function is not void the expression must be
present. present.
@item @item
expression: variable OR integer_constant OR expression+expression expression: variable OR integer_constant OR expression + expression
OR expression-expression OR expression==expression OR (expression) OR expression - expression OR expression == expression OR ( expression )
OR variable=expression OR function_call OR variable = expression OR function_call
An expression can be a constant or a variable reference or a An expression can be a constant or a variable reference or a
function_call. Expressions can be combined as a sum of two expressions function_call. Expressions can be combined as a sum of two expressions
...@@ -629,7 +629,7 @@ expresions. An assignment is also an expression. Expresions and operator ...@@ -629,7 +629,7 @@ expresions. An assignment is also an expression. Expresions and operator
precedence work as in C. precedence work as in C.
@item @item
function_call: function_name (comma_separated_expressions) function_call: function_name ( optional_comma_separated_expressions )
This invokes the function, passing to it the values of the expressions This invokes the function, passing to it the values of the expressions
as actual parameters. as actual parameters.
...@@ -746,7 +746,7 @@ The @code{libc} run-time library. This library contains the machine ...@@ -746,7 +746,7 @@ The @code{libc} run-time library. This library contains the machine
code needed to support capabilities of the Treelang language that are code needed to support capabilities of the Treelang language that are
not directly provided by the machine code generated by the not directly provided by the machine code generated by the
@code{treelang} compilation phase. This is the same library that the @code{treelang} compilation phase. This is the same library that the
main c compiler uses (libc). main C compiler uses (libc).
@cindex @code{tree1}, program @cindex @code{tree1}, program
@cindex programs, @code{tree1} @cindex programs, @code{tree1}
...@@ -939,7 +939,7 @@ To create a compiler that integrates into GCC, you need create many ...@@ -939,7 +939,7 @@ To create a compiler that integrates into GCC, you need create many
files. Some of the files are integrated into the main GCC makefile, to files. Some of the files are integrated into the main GCC makefile, to
build the various parts of the compiler and to run the test build the various parts of the compiler and to run the test
suite. Others are incorporated into various GCC programs such as suite. Others are incorporated into various GCC programs such as
GCC.c. Finally you must provide the actual programs comprising your @file{gcc.c}. Finally you must provide the actual programs comprising your
compiler. compiler.
@cindex files @cindex files
...@@ -1014,19 +1014,19 @@ usually generated, files should be excluded from diffs (ie when making ...@@ -1014,19 +1014,19 @@ usually generated, files should be excluded from diffs (ie when making
diff files to send in patches). Whether the equate 'stagestuff' is used diff files to send in patches). Whether the equate 'stagestuff' is used
is unknown (???). is unknown (???).
@cindex lang-options @cindex lang.opt
@item @item
lang-options. This file is included into GCC.c, the main GCC driver, and lang.opt. This file is included into @file{gcc.c}, the main GCC driver, and
tells it what options your language supports. This is only used to tells it what options your language supports. This is also used to
display help (is this true ???). display help.
@cindex lang-specs @cindex lang-specs.h
@item @item
lang-specs. This file is also included in GCC.c. It tells GCC.c when to lang-specs.h. This file is also included in @file{gcc.c}. It tells
call your programs and what options to send them. The mini-language @file{gcc.c} when to call your programs and what options to send them. The
'specs' is documented in the source of GCC.c. Do not attempt to write a mini-language 'specs' is documented in the source of @file{gcc.c}. Do not
specs file from scratch - use an existing one as the base and enhance attempt to write a specs file from scratch - use an existing one as the base
it. and enhance it.
@item @item
Your texi files. Texinfo can be used to build documentation in HTML, Your texi files. Texinfo can be used to build documentation in HTML,
...@@ -1041,20 +1041,21 @@ in the next section. You need to write or use the following programs: ...@@ -1041,20 +1041,21 @@ in the next section. You need to write or use the following programs:
@item @item
lexer. This breaks the input into words and passes these to the lexer. This breaks the input into words and passes these to the
parser. This is lex.l in treelang, which is passed through flex, a lex parser. This is @file{lex.l} in treelang, which is passed through flex, a lex
variant, to produce C code lex.c. Note there is a school of thought that variant, to produce C code @file{lex.c}. Note there is a school of thought
says real men hand code their own lexers, however you may prefer to that says real men hand code their own lexers. However, you may prefer to
write far less code and use flex, as was done with treelang. write far less code and use flex, as was done with treelang.
@item @item
parser. This breaks the program into recognizable constructs such as parser. This breaks the program into recognizable constructs such as
expressions, statements etc. This is parse.y in treelang, which is expressions, statements etc. This is @file{parse.y} in treelang, which is
passed through bison, which is a yacc variant, to produce C code parse.c. passed through bison, which is a yacc variant, to produce C code
@file{parse.c}.
@item @item
back end interface. This interfaces to the code generation back end. In back end interface. This interfaces to the code generation back end. In
treelang, this is tree1.c which mainly interfaces to toplev.c and treelang, this is @file{tree1.c} which mainly interfaces to @file{toplev.c} and
treetree.c which mainly interfaces to everything else. Many languages @file{treetree.c} which mainly interfaces to everything else. Many languages
mix up the back end interface with the parser, as in the C compiler for mix up the back end interface with the parser, as in the C compiler for
example. It is a matter of taste which way to do it, but with treelang example. It is a matter of taste which way to do it, but with treelang
it is separated out to make the back end interface cleaner and easier to it is separated out to make the back end interface cleaner and easier to
...@@ -1068,9 +1069,9 @@ the same header in your lexer. This technique is demonstrated in ...@@ -1068,9 +1069,9 @@ the same header in your lexer. This technique is demonstrated in
treelang. treelang.
@item @item
compiler main file. GCC comes with a program toplev.c which is a compiler main file. GCC comes with a file @file{toplev.c} which is a
perfectly serviceable main program for your compiler. treelang uses perfectly serviceable main program for your compiler. GNU Treelang uses
toplev.c but other languages have been known to replace it with their @file{toplev.c} but other languages have been known to replace it with their
own main program. Again this is a matter of taste and how much code you own main program. Again this is a matter of taste and how much code you
want to write. want to write.
...@@ -1095,12 +1096,12 @@ want to write. ...@@ -1095,12 +1096,12 @@ want to write.
The GCC compiler consists of a driver, which then executes the various The GCC compiler consists of a driver, which then executes the various
compiler phases based on the instructions in the specs files. compiler phases based on the instructions in the specs files.
Typically a program's language will be identified from its suffix (eg Typically a program's language will be identified from its suffix
.tree) for treelang programs. (e.g., @file{.tree}) for treelang programs.
The driver (gcc.c) will then drive (exec) in turn a preprocessor, the main The driver (@file{gcc.c}) will then drive (exec) in turn a preprocessor,
compiler, the assembler and the link editor. Options to GCC allow you to the main compiler, the assembler and the link editor. Options to GCC allow you
override all of this. In the case of treelang programs there is no to override all of this. In the case of treelang programs there is no
preprocessor, and mostly these days the C preprocessor is run within the preprocessor, and mostly these days the C preprocessor is run within the
main C compiler rather than as a separate process, apparently for reasons of speed. main C compiler rather than as a separate process, apparently for reasons of speed.
...@@ -1120,11 +1121,12 @@ much time tuning it until you know you need to do so. ...@@ -1120,11 +1121,12 @@ much time tuning it until you know you need to do so.
@node treelang main compiler, , treelang driver, treelang compiler interfaces @node treelang main compiler, , treelang driver, treelang compiler interfaces
@subsection treelang main compiler @subsection treelang main compiler
The main compiler for treelang consists of toplev.c from the main GCC The main compiler for treelang consists of @file{toplev.c} from the main GCC
compiler, the parser, lexer and back end interface routines, and the compiler, the parser, lexer and back end interface routines, and the
back end routines themselves, of which there are many. back end routines themselves, of which there are many.
toplev.c does a lot of work for you and you should almost certainly use it, @file{toplev.c} does a lot of work for you and you should almost certainly
use it.
Writing this code is the hard part of creating a compiler using GCC. The Writing this code is the hard part of creating a compiler using GCC. The
back end interface documentation is incomplete and the interface is back end interface documentation is incomplete and the interface is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment