Skip to content
Snippets Groups Projects
Commit b040304b authored by viniciusmioto's avatar viniciusmioto
Browse files

inicia avalia trabs

parent 403a0487
Branches
No related tags found
No related merge requests found
Showing
with 4866 additions and 32 deletions
File added
This diff is collapsed.
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
PROGRAM = 258,
ABRE_PARENTESES = 259,
FECHA_PARENTESES = 260,
VIRGULA = 261,
PONTO_E_VIRGULA = 262,
DOIS_PONTOS = 263,
PONTO = 264,
T_BEGIN = 265,
T_END = 266,
VAR = 267,
IDENT = 268,
ATRIBUICAO = 269,
LABEL = 270,
TYPE = 271,
ARRAY = 272,
PROCEDURE = 273,
FUNCTION = 274,
GOTO = 275,
IF = 276,
THEN = 277,
ELSE = 278,
WHILE = 279,
DO = 280,
OR = 281,
DIV = 282,
AND = 283,
NOT = 284,
IGUAL = 285,
DIFERENTE = 286,
MENOR_IGUAL = 287,
MAIOR_IGUAL = 288,
MENOR = 289,
MAIOR = 290,
MAIS = 291,
MENOS = 292,
ASTERISCO = 293,
NUMERO = 294,
READ = 295,
WRITE = 296,
LOWER_THAN_ELSE = 297
};
#endif
/* Tokens. */
#define PROGRAM 258
#define ABRE_PARENTESES 259
#define FECHA_PARENTESES 260
#define VIRGULA 261
#define PONTO_E_VIRGULA 262
#define DOIS_PONTOS 263
#define PONTO 264
#define T_BEGIN 265
#define T_END 266
#define VAR 267
#define IDENT 268
#define ATRIBUICAO 269
#define LABEL 270
#define TYPE 271
#define ARRAY 272
#define PROCEDURE 273
#define FUNCTION 274
#define GOTO 275
#define IF 276
#define THEN 277
#define ELSE 278
#define WHILE 279
#define DO 280
#define OR 281
#define DIV 282
#define AND 283
#define NOT 284
#define IGUAL 285
#define DIFERENTE 286
#define MENOR_IGUAL 287
#define MAIOR_IGUAL 288
#define MENOR 289
#define MAIOR 290
#define MAIS 291
#define MENOS 292
#define ASTERISCO 293
#define NUMERO 294
#define READ 295
#define WRITE 296
#define LOWER_THAN_ELSE 297
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE yylval;
This diff is collapsed.
File added
File added
...@@ -6,7 +6,7 @@ var n, s, i : integer; ...@@ -6,7 +6,7 @@ var n, s, i : integer;
q:=i*i; q:=i*i;
if (i div 2) * 2 = i if (i div 2) * 2 = i
then then
s:=s+q; s:=s+q
else else
s:=s-q; s:=s-q;
end; end;
......
...@@ -5,7 +5,7 @@ var z, t : integer; ...@@ -5,7 +5,7 @@ var z, t : integer;
begin begin
t:=2*t; t:=2*t;
x:=2*t; x:=2*t;
z:=x+1 z:=x+1;
end; end;
begin begin
z:=3; z:=3;
...@@ -13,6 +13,6 @@ begin ...@@ -13,6 +13,6 @@ begin
g(t); write (z,t); g(t); write (z,t);
g(z); write (z,t); g(z); write (z,t);
g(t+z); write (z,t); g(t+z); write (z,t);
g(7); write (z,t) g(7); write (z,t);
end. end.
\ No newline at end of file
...@@ -4,7 +4,7 @@ var z, x: integer; ...@@ -4,7 +4,7 @@ var z, x: integer;
var y : integer; var y : integer;
begin begin
y:=t*t; z:=z+x+y; y:=t*t; z:=z+x+y;
write(z) write(z);
end; end;
procedure h (y : integer); procedure h (y : integer);
...@@ -13,19 +13,19 @@ var z, x: integer; ...@@ -13,19 +13,19 @@ var z, x: integer;
var t : integer; var t : integer;
begin begin
t:=z+x+y; g(t); t:=z+x+y; g(t);
z:=t z:=t;
end; end;
begin begin
x:=y+1; x:=y+1;
f(x); f(x);
g(z+x) g(z+x);
end; end;
begin begin
z:=1; z:=1;
x:=3; x:=3;
h(x); h(x);
g(x); g(x);
write(x,z) write(x,z);
end. end.
...@@ -5,16 +5,16 @@ var p, q : integer; ...@@ -5,16 +5,16 @@ var p, q : integer;
begin begin
if n<2 then if n<2 then
begin begin
f:=n; k:=0 f:=n; k:=0;
end end
else else
begin begin
f:=f(n-1,p) + f(n-2,q); f:=f(n-1,p) + f(n-2,q);
k:=p+q+1 k:=p+q+1;
end; end;
write (n, k) write (n, k);
end; end;
begin begin
n:=f(3,m); n:=f(3,m);
write(n, m) write(n, m);
end. end.
...@@ -10,7 +10,7 @@ begin ...@@ -10,7 +10,7 @@ begin
f3:=f1+f2; f3:=f1+f2;
f1:=f2; f1:=f2;
f2:=f3; f2:=f3;
k:=k+1 k:=k+1;
end; end;
write(n, f1) write(n, f1);
end. end.
...@@ -7,10 +7,10 @@ var x, y : integer; ...@@ -7,10 +7,10 @@ var x, y : integer;
if z>1 if z>1
then p then p
else y:=1; else y:=1;
y:=y*z y:=y*z;
end; end;
begin begin
read (x); read (x);
p; p;
write (x,y) write (x,y);
end. end.
...@@ -7,7 +7,7 @@ begin ...@@ -7,7 +7,7 @@ begin
if z>1 if z>1
then p then p
else y:=1; else y:=1;
y:=y*z y:=y*z;
end; end;
procedure q; procedure q;
...@@ -19,11 +19,11 @@ begin ...@@ -19,11 +19,11 @@ begin
if ( (s div 2)*2) = s if ( (s div 2)*2) = s
then q then q
else p; else p;
y:=y*s y:=y*s;
end; end;
begin begin
read(x); read(x);
q; q;
write(y) write(y);
end. end.
...@@ -9,17 +9,17 @@ var x, y : integer; ...@@ -9,17 +9,17 @@ var x, y : integer;
if s=1 if s=1
then p then p
else y:=1; else y:=1;
y:=y*s y:=y*s;
end; end;
begin begin
z:=x; x:=x-1; z:=x; x:=x-1;
if z>1 if z>1
then p then p
else y:=1; else y:=1;
y:=y*z y:=y*z;
end; end;
begin begin
read(x); read(x);
p; p;
write(y) write(y);
end. end.
...@@ -7,10 +7,10 @@ var x, y : integer; ...@@ -7,10 +7,10 @@ var x, y : integer;
then p(t-1) then p(t-1)
else y:=1; else y:=1;
z:=y; z:=y;
y:=z*t y:=z*t;
end; end;
begin begin
read(x); read(x);
p(x); p(x);
write(y) write(y);
end. end.
...@@ -10,13 +10,13 @@ begin ...@@ -10,13 +10,13 @@ begin
h:=g; h:=g;
p(n-1,h); p(n-1,h);
g:=h; g:=h;
p(n-2, g) p(n-2, g);
end; end;
write(n,g) write(n,g);
end; end;
begin begin
k:=0; k:=0;
p(3,k) p(3,k);
end. end.
...@@ -4,5 +4,5 @@ begin ...@@ -4,5 +4,5 @@ begin
read (n); read (n);
read (k); read (k);
n := n>k; n := n>k;
write (n) write (n);
end. end.
...@@ -4,5 +4,5 @@ begin ...@@ -4,5 +4,5 @@ begin
read (n); read (n);
read (k); read (k);
if (n+1) then n:=1; if (n+1) then n:=1;
write (n) write (n);
end. end.
This diff is collapsed.
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment