diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-11-25 22:29:55 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-11-25 22:29:55 -0600 |
commit | 4781982737ce297a79f71737445a62390e4e5c7d (patch) | |
tree | 7f166dff8fca40b58f255421cac35d1f163dab0a | |
parent | c77e283d7cf49001496f017764bac27e1b76a802 (diff) | |
download | javanol-4781982737ce297a79f71737445a62390e4e5c7d.tar.gz javanol-4781982737ce297a79f71737445a62390e4e5c7d.tar.bz2 javanol-4781982737ce297a79f71737445a62390e4e5c7d.zip |
Se añaden encabezados de licencia
-rw-r--r-- | compilador/arbol.py | 48 | ||||
-rw-r--r-- | compilador/astree/decl.py | 16 | ||||
-rw-r--r-- | compilador/astree/expr.py | 16 | ||||
-rw-r--r-- | compilador/astree/graphable.py | 16 | ||||
-rw-r--r-- | compilador/astree/ident.py | 16 | ||||
-rw-r--r-- | compilador/astree/type.py | 16 | ||||
-rw-r--r-- | compilador/astree/unit.py | 16 | ||||
-rw-r--r-- | compilador/errors.py | 16 | ||||
-rw-r--r-- | compilador/lexer.py | 16 | ||||
-rw-r--r-- | compilador/main.py | 16 | ||||
-rw-r--r-- | compilador/parse/base.py | 18 | ||||
-rw-r--r-- | compilador/parse/decl.py | 16 | ||||
-rw-r--r-- | compilador/parse/expr.py | 16 | ||||
-rw-r--r-- | compilador/parse/ident.py | 17 | ||||
-rw-r--r-- | compilador/parse/type.py | 16 | ||||
-rw-r--r-- | compilador/parse/unit.py | 17 | ||||
-rw-r--r-- | compilador/parser.py | 16 | ||||
-rw-r--r-- | compilador/shared.py | 16 | ||||
-rw-r--r-- | compilador/tabla.py | 16 | ||||
-rw-r--r-- | interfaz/main.py | 16 |
20 files changed, 305 insertions, 51 deletions
diff --git a/compilador/arbol.py b/compilador/arbol.py deleted file mode 100644 index 1ca2cd9..0000000 --- a/compilador/arbol.py +++ /dev/null @@ -1,48 +0,0 @@ -import uuid, json -import graphviz as gv -from pprint import pformat - -class Nodo: - def __init__(self, dato = None): - self.dato = dato - self.hijos = [] - - def print(self, n = 0): - s = ' ' * n + 'Nodo:' + "\n" - s += ' ' * n + "dato = " + str(self.dato) + "\n" - s += ' ' * n + "hijos =\n" - for h in self.hijos: - s += h.print(n + 1) - s += "\n" - return s - - def render(self, dot: gv.Digraph, parent: str): - name = uuid.uuid1().hex - fdato = pformat(self.dato, indent=2).replace('\n', '\l') - dot.node(name, fdato) - if parent: - dot.edge(parent, name) - - for h in self.hijos: - h.render(dot, name) - - def __str__(self): - return self.print() - - -class Arbol: - def __init__(self, raiz: Nodo = Nodo()): - self.raiz = raiz - - def render(self, filename, view = False): - dot = gv.Digraph() - dot.attr(rankdir='LR') - dot.attr('node', fontname='monospace') - dot.attr('node', shape='box') - self.raiz.render(dot, None) - dot.render(filename, view = view) - - def __str__(self): - if self.raiz: - return str(self.raiz) - return "None" diff --git a/compilador/astree/decl.py b/compilador/astree/decl.py index 99f5f75..8a316cd 100644 --- a/compilador/astree/decl.py +++ b/compilador/astree/decl.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. import uuid import graphviz as gv from dataclasses import dataclass diff --git a/compilador/astree/expr.py b/compilador/astree/expr.py index f4d150c..1015d74 100644 --- a/compilador/astree/expr.py +++ b/compilador/astree/expr.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. import uuid import graphviz as gv from dataclasses import dataclass diff --git a/compilador/astree/graphable.py b/compilador/astree/graphable.py index 99cfebf..002bd72 100644 --- a/compilador/astree/graphable.py +++ b/compilador/astree/graphable.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. import graphviz as gv from typing import Protocol, runtime_checkable from abc import abstractmethod diff --git a/compilador/astree/ident.py b/compilador/astree/ident.py index ecc7edf..0170966 100644 --- a/compilador/astree/ident.py +++ b/compilador/astree/ident.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. from typing import List from dataclasses import dataclass diff --git a/compilador/astree/type.py b/compilador/astree/type.py index b254b91..e0e3fd1 100644 --- a/compilador/astree/type.py +++ b/compilador/astree/type.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. import uuid import graphviz as gv from pprint import pformat diff --git a/compilador/astree/unit.py b/compilador/astree/unit.py index c089214..986e848 100644 --- a/compilador/astree/unit.py +++ b/compilador/astree/unit.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. import uuid import graphviz as gv from dataclasses import dataclass diff --git a/compilador/errors.py b/compilador/errors.py index 6bb05b8..b77c8ea 100644 --- a/compilador/errors.py +++ b/compilador/errors.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. import sys from typing import List diff --git a/compilador/lexer.py b/compilador/lexer.py index 4d97b9d..9854a51 100644 --- a/compilador/lexer.py +++ b/compilador/lexer.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. from enum import Enum from tabla import LexToken, TablaLex, Token, tokens, reservadas from parser import Parser diff --git a/compilador/main.py b/compilador/main.py index 48fb129..d3f7444 100644 --- a/compilador/main.py +++ b/compilador/main.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. import sys, getopt, os, traceback from enum import Enum from lexer import * diff --git a/compilador/parse/base.py b/compilador/parse/base.py index bf9277d..356064c 100644 --- a/compilador/parse/base.py +++ b/compilador/parse/base.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. from enum import Enum from tabla import LexToken, TablaLex, tokens from arbol import Arbol, Nodo @@ -65,6 +81,6 @@ class BaseParser: '''Returns a syntax error if cond is false and void otherwise. - ''' + '''< if not cond: return Error(msg = msg, numlinea = numlinea) diff --git a/compilador/parse/decl.py b/compilador/parse/decl.py index aa9e23a..d109629 100644 --- a/compilador/parse/decl.py +++ b/compilador/parse/decl.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. from typing import List, cast, Optional from more_itertools import peekable diff --git a/compilador/parse/expr.py b/compilador/parse/expr.py index 2401f30..f6527bd 100644 --- a/compilador/parse/expr.py +++ b/compilador/parse/expr.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. from typing import NoReturn, Optional, cast from tabla import Token, LexToken diff --git a/compilador/parse/ident.py b/compilador/parse/ident.py index 5887fa2..1853cb9 100644 --- a/compilador/parse/ident.py +++ b/compilador/parse/ident.py @@ -1,4 +1,19 @@ - +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. from tabla import Token, LexToken from parse.base import BaseParser from astree.ident import Ident diff --git a/compilador/parse/type.py b/compilador/parse/type.py index 1fd0957..b32397d 100644 --- a/compilador/parse/type.py +++ b/compilador/parse/type.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. from typing import List from parse.base import BaseParser diff --git a/compilador/parse/unit.py b/compilador/parse/unit.py index 954b8b4..07fb5fa 100644 --- a/compilador/parse/unit.py +++ b/compilador/parse/unit.py @@ -1,4 +1,19 @@ - +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. from errors import Error from astree.unit import Unit from parse.base import BaseParser diff --git a/compilador/parser.py b/compilador/parser.py index e7f86db..a8f86b9 100644 --- a/compilador/parser.py +++ b/compilador/parser.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. import sys import graphviz as gv from pprint import pprint diff --git a/compilador/shared.py b/compilador/shared.py index e356255..008d80a 100644 --- a/compilador/shared.py +++ b/compilador/shared.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. from enum import Enum class Control(Enum): diff --git a/compilador/tabla.py b/compilador/tabla.py index 7871a42..af45475 100644 --- a/compilador/tabla.py +++ b/compilador/tabla.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. import json, os from enum import Enum, auto from dataclasses import dataclass diff --git a/interfaz/main.py b/interfaz/main.py index 5c025e7..23da9d0 100644 --- a/interfaz/main.py +++ b/interfaz/main.py @@ -1,3 +1,19 @@ +#!/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2022 Iván Alejandro Ávalos Díaz <avalos@disroot.org> +# Edgar Alexis López Martínez <edgarmlmp@gmail.com> +# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>. from enum import Enum import gi, sys, os, subprocess, json, math, webbrowser gi.require_version('Gtk', '4.0') |