diff options
author | James A. Morrison <phython@gcc.gnu.org> | 2004-10-02 15:18:16 +0000 |
---|---|---|
committer | James A. Morrison <phython@gcc.gnu.org> | 2004-10-02 15:18:16 +0000 |
commit | 64beac09f9ad034b925c684885d753ee7cf0856f (patch) | |
tree | 4c9abaf377ece055e5834c340e1d921096176a10 | |
parent | 66efeafc2ee0d483d6a50f6f1f8a53d07bcbb660 (diff) | |
download | gcc-64beac09f9ad034b925c684885d753ee7cf0856f.zip gcc-64beac09f9ad034b925c684885d753ee7cf0856f.tar.gz gcc-64beac09f9ad034b925c684885d753ee7cf0856f.tar.bz2 |
parse.y (ELSE): Set tok to $1.
2004-09-28 James A. Morrison <phython@gcc.gnu.org>
* parse.y (ELSE): Set tok to $1.
* treelang.texi: Wrap comments in @r{}. Indent example comments.
Use gcc when refering to the command line or website. Update function
definition.
From-SVN: r88425
-rw-r--r-- | gcc/treelang/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/treelang/parse.y | 2 | ||||
-rw-r--r-- | gcc/treelang/treelang.texi | 63 |
3 files changed, 41 insertions, 31 deletions
diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog index 6eb1dfc..c47c0ac 100644 --- a/gcc/treelang/ChangeLog +++ b/gcc/treelang/ChangeLog @@ -1,3 +1,10 @@ +2004-10-01 James A. Morrison <phython@gcc.gnu.org> + + * parse.y (ELSE): Set tok to $1. + * treelang.texi: Wrap comments in @r{}. Indent example comments. + Use gcc when refering to the command line or website. Update function + definition. + 2004-10-01 Jan Hubicka <jh@suse.cz> * treetree.c (treeland_expand_function): Update call of diff --git a/gcc/treelang/parse.y b/gcc/treelang/parse.y index 29da162..5a77398 100644 --- a/gcc/treelang/parse.y +++ b/gcc/treelang/parse.y @@ -515,7 +515,7 @@ ELSE { } LEFT_BRACE variable_defs_opt statements_opt RIGHT_BRACE { struct prod_token_parm_item* tok; - tok = $12; + tok = $1; tree_code_if_end (tok->tp.tok.location); } ; diff --git a/gcc/treelang/treelang.texi b/gcc/treelang/treelang.texi index 789ffff..557809b 100644 --- a/gcc/treelang/treelang.texi +++ b/gcc/treelang/treelang.texi @@ -2,7 +2,6 @@ @c NOTE THIS IS NOT A GOOD EXAMPLE OF HOW TO DO A MANUAL. FIXME!!! @c NOTE THIS IS NOT A GOOD EXAMPLE OF HOW TO DO A MANUAL. FIXME!!! -@c NOTE THIS IS NOT A GOOD EXAMPLE OF HOW TO DO A MANUAL. FIXME!!! @c %**start of header @@ -10,9 +9,9 @@ @include gcc-common.texi -@set version-treelang 1.0 +@set version-treelang 2.0 -@set last-update 2004-03-21 +@set last-update 2004-09-28 @set copyrights-treelang 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 @set email-general gcc@@gcc.gnu.org @@ -203,11 +202,6 @@ corresponds to the @value{which-treelang} version of @code{treelang}. @end ifnottex -@ifset DEVELOPMENT -@emph{Warning:} This document is still under development, and might not -accurately reflect the @code{treelang} code base of which it is a part. -@end ifset - @menu * Copying:: * Contributors:: @@ -272,7 +266,8 @@ Reporting Bugs 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 documentation, based on the GCC Fortran compiler's documentation -framework. +framework. Treelang was updated to use the TreeSSA infrastructure by James A. +Morrison. @itemize @bullet @item @@ -290,7 +285,7 @@ It would have been difficult to build treelang without access to Joachim Nadler's guide to writing a front end to GCC (written in German). A translation of this document into English is available via the CobolForGCC project or via the documentation links from the GCC home -page @uref{http://GCC.gnu.org}. +page @uref{http://gcc.gnu.org}. @end itemize @include funding.texi @@ -309,10 +304,13 @@ language. Therefore only language developers are likely to have an interest in it. This manual assumes familiarity with GCC, which you can obtain by using -it and by reading the manual @samp{Using and Porting GCC}. +it and by reading the manuals @samp{Using the GNU Compiler Collection (GCC)} +and @samp{GNU Compiler Collection (GCC) Internals}. To install treelang, follow the GCC installation instructions, -taking care to ensure you specify treelang in the configure step. +taking care to ensure you specify treelang in the configure step by adding +treelang to the list of languages specified by @option{--enable-langauges}, +e.g.@: @samp{--enable-languages=all,treelang}. If you're generally curious about the future of @code{treelang}, see @ref{Projects}. @@ -345,18 +343,18 @@ The main features missing are structures, arrays and pointers. A sample program follows: -@example -// function prototypes -// function 'add' taking two ints and returning an int +@smallexample +// @r{function prototypes} +// @r{function 'add' taking two ints and returning an int} external_definition int add(int arg1, int arg2); external_definition int subtract(int arg3, int arg4); external_definition int first_nonzero(int arg5, int arg6); external_definition int double_plus_one(int arg7); -// function definition +// @r{function definition} add @{ -// return the sum of arg1 and arg2 + // @r{return the sum of arg1 and arg2} return arg1 + arg2; @} @@ -368,9 +366,11 @@ subtract double_plus_one @{ -// aaa is a variable, of type integer and allocated at the start of the function + // @r{aaa is a variable, of type integer and allocated at the start of} + // @r{the function} automatic int aaa; -// set aaa to the value returned from add, when passed arg7 and arg7 as the two parameters + // @r{set aaa to the value returned from add, when passed arg7 and arg7 as} + // @r{the two parameters} aaa=add(arg7, arg7); aaa=add(aaa, aaa); aaa=subtract(subtract(aaa, arg7), arg7) + 1; @@ -379,7 +379,7 @@ double_plus_one first_nonzero @{ -// C-like if statement + // @r{C-like if statement} if (arg5) @{ return arg5; @@ -389,7 +389,7 @@ first_nonzero @} return arg6; @} -@end example +@end smallexample @node Lexical Syntax, Parsing Syntax, What is GNU Treelang?, Top @chapter Lexical Syntax @@ -415,7 +415,7 @@ of the line. C style comments (/* */) are not supported. For example, the assignment below is followed by a not very helpful comment. @smallexample -x=1; // Set X to 1 +x = 1; // @r{Set X to 1} @end smallexample @item @@ -427,7 +427,8 @@ used to start the statements in a function @item @} used to end the statements in a function @item ( -start list of function arguments, or to change the precedence of operators in an expression +start list of function arguments, or to change the precedence of operators in +an expression @item ) end list or prioritized operators in expression @item , @@ -494,7 +495,7 @@ file may contain one of more declarations. declaration: variable declaration OR function prototype OR function declaration @item -Function Prototype: storage type NAME ( parameter_list ) +Function Prototype: storage type NAME ( optional_parameter_list ) @smallexample static int add (int a, int b) @@ -506,10 +507,11 @@ variable_declaration: storage type NAME initial; Example: @smallexample -int temp1=1; +int temp1 = 1; @end smallexample -A variable declaration can be outside a function, or at the start of a function. +A variable declaration can be outside a function, or at the start of a +function. @item storage: automatic OR static OR external_reference OR external_definition @@ -602,7 +604,7 @@ list of statements may be empty, but both sets of braces and the else must be pr @smallexample if (a==b) @{ -// nothing +// @r{nothing} @} else @{ @@ -623,8 +625,9 @@ be absent, and if the function is not void the expression must be present. @item -expression: variable OR integer_constant OR expression+expression OR expression-expression - OR expression==expression OR (expression) OR variable=expression OR function_call +expression: variable OR integer_constant OR expression+expression +OR expression-expression OR expression==expression OR (expression) +OR variable=expression OR function_call An expression can be a constant or a variable reference or a function_call. Expressions can be combined as a sum of two expressions @@ -890,7 +893,7 @@ the GNU Compiler Collection (GCC)}, for information on the way different languages are handled by the GCC compiler (@code{gcc}). -You can use this, combined with the output of the @samp{GCC -v x.tree} +You can use this, combined with the output of the @samp{gcc -v x.tree} command to get the options applicable to treelang. Treelang programs must end with the suffix @samp{.tree}. |