code
stringlengths
1
1.72M
language
stringclasses
1 value
''' Created on 3/06/2014 @author: Juan Pablo Moreno - 20111020059 @author: @author: @author: ''' from PyQt4.QtGui import QMainWindow, QDialog, QFileDialog, QSizePolicy from PyQt4.QtGui import QComboBox, QPushButton, QMessageBox, QLabel class VentanaMenu(QMainWindow): def __init__(self): super(VentanaMenu, ...
Python
from interfaz import VentanaMenu
Python
#==================================================================== # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you ...
Python
#!/usr/bin/python from bottle import route,run,get,post,response,static_file,request import cv2,cv import thread import base64 #import carcontrol module from controlServer import * cam=cv2.VideoCapture(0) if(cam.isOpened()==False): print("cant open cam") exit() cam.set(cv.CV_CAP_PROP_FRAME_WIDTH,320) cam.set(cv.CV_C...
Python
import RPi.GPIO as gpio import RPi.GPIO as GPIO import time import thread from threading import * GPIO_SIG = 8 #Motor 1 GPIO Pin IC1A = 25 IC2A = 10 #Motor 2 GPIO Pin IC3A = 17 IC4A = 4 #get semaphore sem=Semaphore() def getAndPrint(): for i in range(100): global sem sem.acquire() ...
Python
# -*- coding: utf-8 -*- """ Created on Mon May 05 14:51:22 2014 @author: JuanMed """ lectura = 0 inp = raw_input("Ingrese la conversion ADC obtenida (de 0 a 4096): ") lectura = int(inp) lectura = (lectura*2.5)/4096 print "Voltaje en ADC: ",lectura lectura = (lectura * 2) print "Voltaje en Paneles (a ...
Python
#!/usr/bin/python3 #coding=utf-8 import os #读取文件列表 f=open('etc/list') clist=[] for line in f: if len(line.strip('\n').strip('\r'))>0: clist.append(line.strip('\n').strip('\r')) #生成文档 docCommand='java -jar lib/jsdoc/jsrun.jar lib/jsdoc/app/run.js \ -a -v -p -t=lib/jsdoc/templates/CodeView -D="title:Castle API" -D...
Python
#!/usr/bin/python3 #coding=utf-8 import os #读取文件列表 f=open('etc/list') clist=[] for line in f: if len(line.strip('\n').strip('\r'))>0: clist.append(line.strip('\n').strip('\r')) #生成文档 docCommand='java -jar lib/jsdoc/jsrun.jar lib/jsdoc/app/run.js \ -a -v -p -t=lib/jsdoc/templates/CodeView -D="title:Castle API" -D...
Python
__version__ = '1.3.0' from kivy.app import App from kivy.uix.widget import Widget from kivy.properties import NumericProperty, OptionProperty, ObjectProperty from kivy.graphics import Color, BorderImage from kivy.clock import Clock from kivy.vector import Vector from kivy.metrics import dp from kivy.animation import A...
Python
# Game services for Android from jnius import autoclass, PythonJavaClass, java_method from android.runnable import run_on_ui_thread import android import android.activity PythonActivity = autoclass('org.renpy.android.PythonActivity') GameHelper = autoclass('com.google.example.games.basegameutils.GameHelper') Games = au...
Python
__version__ = '1.3.0' from kivy.app import App from kivy.uix.widget import Widget from kivy.properties import NumericProperty, OptionProperty, ObjectProperty from kivy.graphics import Color, BorderImage from kivy.clock import Clock from kivy.vector import Vector from kivy.metrics import dp from kivy.animation import A...
Python
# Game services for Android from jnius import autoclass, PythonJavaClass, java_method from android.runnable import run_on_ui_thread import android import android.activity PythonActivity = autoclass('org.renpy.android.PythonActivity') GameHelper = autoclass('com.google.example.games.basegameutils.GameHelper') Games = au...
Python
import sqlite3 #import time #conn = sqlite3.connect("mydatabase.db") #cursor=conn.cursor() #cursor.execute('CREATE TABLE mytable (Id INTEGER PRIMARY KEY, Date TEXT, Entry TEXT)') #today="monday" #cursor.execute('INSERT INTO mytable VALUES(null, ?, ?)', (today, "This entry could be the first item on a To-Do List...
Python
class Cage(): def __init__(self, cageName, cageDescription, numDoors = 2, doorsOpen = False): self.cageName = cageName self.cageDescription = cageDescription self.numDoors = numDoors self.doorsOpen = doorsOpen def openDoor(self): print("hello") ...
Python
class Cage(): cageID = "" doorNumber = 1 cageMaxPopCap = 1 currentCap = 1 doorStatus = True numberOfDoors = 1 cageDescription = "" exhibitOccupied = True cageSize = "" def main(): lionCage = Cage("Lion", True, 21, 10, "A real environment", 2, True) lionCage.clo...
Python
//take 2 revsion import random class Zoo(): cages = list[] def addCage(cageID): cages.append(cageID) def removeCage(cageID): cages.remove(cageID) class Cage(): def openDoor(): #stuff for opening the door return 0 def closeDoor(): #stuff for clos...
Python
import unittest import zooMonitoring import zoo class CageTests(unittest.TestCase): def testNoCagesPresent(self): zoo1 = zoo.Zoo() #Test to check no cages are initially present self.assertEqual(zoo1.getNumCages(), 1) print zoo1.cages def testAddPresent(sel...
Python
import zoo import cage class ZooMonitoring(): def __init__(self): jcu = zoo.Zoo() jcu.addCage("lion", "the lion lives here") jcu.addCage("tim", "timmy lives here") print jcu.getNumCages() jcu.cages[0].openDoor() def main(): pri...
Python
from turtle import * import forest import os f = forest() x = 1 t = Turtle() t.write("home =", True, align="center") t.showturtle() speed("fastest") while x < 100: pd() sety(121) setx(66) c = ["red","green","yellow","blue","purple","cyan","pink"] color(c[x%7]) forward(45) rig...
Python
import zooMonitoring import database import zoo if __name__ == '__main__': z = zoo.Zoo() db = database.dataBase() choice = None menuNotChosen = True choice = raw_input("Please Choose Option \ncage \nadmin\n Choose: ") while choice: if choice == "cage": ...
Python
import sqlite3 #import time #conn = sqlite3.connect("mydatabase.db") #cursor=conn.cursor() #cursor.execute('CREATE TABLE mytable (Id INTEGER PRIMARY KEY, Date TEXT, Entry TEXT)') #today="monday" #cursor.execute('INSERT INTO mytable VALUES(null, ?, ?)', (today, "This entry could be the first item on a To-Do List, or it...
Python
class Cage(): def __init__(self, cageName, cageDescription, numDoors = 2, doorsOpen = False, humanInside = False): self.cageName = cageName self.cageDescription = cageDescription self.numDoors = numDoors self.doorsOpen = doorsOpen self.humanInside = humanInside ...
Python
import cage import database class Zoo: def __init__(self): self.cages = [] print self.cages #dont USE!! def addCage(self, cageName, cageDescription): cageName = cage.Cage(cageName, cageDescription) self.cages.append(cageName) def addCag...
Python
def tree(tlist, size, level, widthfactor, branchlists, angledist=10, sizedist=5): # benutzt Liste von turtles und Liste von Zweiglisten, # fuer jede turtle eine! if level > 0: lst = [] brs = [] for t, branchlist in list(zip(tlist,branchlists)): t.pensize( size * wi...
Python
import unittest #import zooMonitoring import zoo class CageTests(unittest.TestCase): def testNoCagesPresent(self): emptyZoo = zoo.Zoo() #emptyZoo.cages = [] #Test to check no cages are initially present #emptyZoo.addCage("Monkey", "Chimpanzee lives here") self.assertEqu...
Python
from turtle import * from random import randrange from time import clock def writeZoo(): width(10) color("blue") penup() setx(-300) sety(300) pendown() pendown() forward(75) right(135) forward(100) left(135) forward(75) penup() setx(-180...
Python
import sqlite3 conn = sqlite3.connect('example.db') c = conn.cursor() # Create table #c.execute('''CREATE TABLE cages # (cageName, cageDescription, numDoors, doorsOpen)''') # Insert a row of data c.execute("INSERT INTO cages VALUES ('bear','this is the bears houese','2','False')") # Save (co...
Python
import zoo import cage class ZooMonitoring: def __init__(self): jcu = zoo.Zoo() #jcu.addCageList("lion", "1") #jcu.addCageList("moose", "2") #jcu.addCageList("panda", "3") #jcu.addCageList("bird", "4") # print jcu.getNumCages() # print jcu...
Python
#-*- coding: utf-8 -*- #! /usr/bin/python ####################################################################################### # # # File: online_keeper.py # # Pa...
Python
#This contains global definition of Browser class and other useful thing ####################################################################################### # # # File: browser_bogus.py ...
Python
#! /usr/bin/python # -*- coding: utf-8 -*- from distutils.core import setup import py2exe import main from glob import glob data_files = [("Microsoft.VC100.CRT", glob(r'E:\important\应用软件\开发工具\python\开发代码\Microsoft.VC100.CRT\*.*'))] setup( options = {"py2exe": {"optimize": 2, ...
Python
#!/usr/bin/python from socket import * import struct,os,time,sys from ntp_server_lib import get_random_ntp_server # print get_random_ntp_server() # Script to set Linux hardware clock (/usr/sbin/hwclock) from an NTP # time server. Run as "setclock.py" to simply print the time from # the NTP ...
Python
#-*- coding: utf-8 -*- #! /usr/bin/python import urllib import urllib2 import time import socket from browser_bogus import Browser def logd(content,fname = "sysrun.log",dolog = True): if dolog: try: if fname == None: fname = "sysrun.log" fp = open(fnam...
Python
# -*- coding: utf-8 -*- #! /usr/bin/python ####################################################################################### # # # File: main.py # # Par...
Python
import random NS_NTP = ["132.163.4.101", "132.163.4.102", "132.163.4.103", "128.138.140.44", "69.25.96.13", "64.236.96.53"] #print len(UA_MSIE10) #print len(UA_MSIE9) #print len(UA_MSIE8) #print len(UA_MSIE7) #print len(UA_MSIE6) def get_random_ntp_server(): random.seed() i = random.randra...
Python
####################################################################################### # # File: user_agent_lib # Part of pcbeta-cheater # Home: http://pcbeta-cheater.googlecode.com # # ...
Python
#! /usr/bin/python # -*- coding: utf-8 -*- from distutils.core import setup import py2exe import main from glob import glob data_files = [("Microsoft.VC100.CRT", glob(r'E:\important\应用软件\开发工具\python\开发代码\Microsoft.VC100.CRT\*.*'))] setup( options = {"py2exe": {"optimize": 2, ...
Python
#!/usr/bin/python from socket import * import struct,os,time,sys from ntp_server_lib import get_random_ntp_server # print get_random_ntp_server() # Script to set Linux hardware clock (/usr/sbin/hwclock) from an NTP # time server. Run as "setclock.py" to simply print the time from # the NTP ...
Python
# -*- coding: utf-8 -*- ####################################################################################### # # # File: Core.py # # Part of stage1st_cheater ...
Python
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'MainDialog.ui' # # Created: Mon Feb 17 23:47:19 2014 # by: PyQt4 UI code generator 4.10.1 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf...
Python
#-*- coding: utf-8 -*- #! /usr/bin/python ####################################################################################### # # # File: online_keeper.py # # Pa...
Python
#This contains global definition of Browser class and other useful thing ####################################################################################### # # # File: browser_bogus.py ...
Python
#! /usr/bin/python # -*- coding: utf-8 -*- from distutils.core import setup import py2exe import main from glob import glob data_files = [("Microsoft.VC100.CRT", glob(r'E:\important\应用软件\开发工具\python\开发代码\Microsoft.VC100.CRT\*.*'))] setup( options = {"py2exe": {"optimize": 2, ...
Python
#!/usr/bin/python from socket import * import struct,os,time,sys from ntp_server_lib import get_random_ntp_server print get_random_ntp_server() # Script to set Linux hardware clock (/usr/sbin/hwclock) from an NTP # time server. Run as "setclock.py" to simply print the time from # the NTP se...
Python
# -*- coding: utf-8 -*- #! /usr/bin/python ####################################################################################### # # # File: main.py # # Par...
Python
import random NS_NTP = ["132.163.4.101", "132.163.4.102", "132.163.4.103", "128.138.140.44", "69.25.96.13", "64.236.96.53"] #print len(UA_MSIE10) #print len(UA_MSIE9) #print len(UA_MSIE8) #print len(UA_MSIE7) #print len(UA_MSIE6) def get_random_ntp_server(): random.seed() i = random.randra...
Python
####################################################################################### # # File: user_agent_lib # Part of pcbeta-cheater # Home: http://pcbeta-cheater.googlecode.com # # ...
Python
#! /usr/bin/python # -*- coding: utf-8 -*- from distutils.core import setup import py2exe import main from glob import glob data_files = [("Microsoft.VC100.CRT", glob(r'E:\important\应用软件\开发工具\python\开发代码\Microsoft.VC100.CRT\*.*'))] setup( options = {"py2exe": {"optimize": 2, ...
Python
#!/usr/bin/python from socket import * import struct,os,time,sys from ntp_server_lib import get_random_ntp_server print get_random_ntp_server() # Script to set Linux hardware clock (/usr/sbin/hwclock) from an NTP # time server. Run as "setclock.py" to simply print the time from # the NTP se...
Python
# -*- coding: utf-8 -*- ####################################################################################### # # # File: Core.py # # Part of stage1st_cheater ...
Python
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'MainDialog.ui' # # Created: Sun May 29 21:22:32 2011 # by: PyQt4 UI code generator 4.8.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8...
Python
""" FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2008 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.org/license...
Python
import pygame, sys, math class Glass(): def __init__(self, speed = [2,2], size = [100,100], pos = (0,0)): """ self.images = [] for image in images: newimage = pygame.image.load(image) newimage = pygame.transform.scale(newimage, size) self.images += [newim...
Python
import pygame, sys, math class Enlarge(): def __init__(self, speed = [2,2], pos = (0,0)): self.type = "Enlarge" self.image = pygame.image.load("Resources/Cow/U.png") self.rect = self.image.get_rect() self.radius = self.rect.width/2 self.place(pos) self.speedx = speed...
Python
import pygame, sys, math class Ball(): def __init__(self, image, speed = [2,2], size = [100,100], pos = (0,0)): self.image = pygame.image.load(image) self.image = pygame.transform.scale(self.image, size) self.rect = self.image.get_rect() self.speedx = speed[0] self.speedy = ...
Python
import pygame, sys, math, random pygame.init() from Ball import Ball from PlayerBall import PlayerBall clock = pygame.time.Clock() width = 640 height = 480 size = width, height screen = pygame.display.set_mode(size) bgImage = pygame.image.load("rsc/bg/startbg.png") bgRect = bgImage.get_rect() bgColor = r,g,b = 0...
Python
import pygame, sys, math class PlayerBall(): def __init__(self, images, speed = [2,2], size = [100,100], pos = (0,0)): self.images = [] for image in images: newimage = pygame.image.load(image) newimage = pygame.transform.scale(newimage, size) self.images += [newi...
Python
import pygame, sys, math class Milk(): def __init__(self, speed = [2,2], size = [100,100], pos = (0,0)): self.image = pygame.image.load("Resources/Milk/MILK3.png") self.image = pygame.transform.scale(self.image, size) self.rect = self.image.get_rect() self.speedx = speed[0] ...
Python
import pygame, sys, math, random pygame.init() from Ball import Ball from PlayerBall import PlayerBall clock = pygame.time.Clock() width = 640 height = 480 size = width, height screen = pygame.display.set_mode(size) bgImage = pygame.image.load("rsc/bg/startbg.png") bgRect = bgImage.get_rect() bgColor = r,g,b = 0...
Python
import pygame, os, sys, math from pygame.locals import * pygame.init() #From https://code.google.com/p/pong-drew-liam-nate/source/browse/Scoreboard.py class ScoreBoard(): def __init__(self, pos = (0,0)): self.baseimage = pygame.image.load("Resources/scoreboard.png") self.image = self.baseimage.cop...
Python
import pygame, sys, math, random pygame.init() pygame.joystick.init() joysticks = [pygame.joystick.Joystick(x) for x in range(pygame.joystick.get_count())] for joystick in joysticks: joystick.init() print joystick.get_name() from Milk import Milk from Glass import Glass from ScoreBoard import ScoreBoard fro...
Python
__author__ = 'Binary_Ninja' from tkinter import * import tkinter.messagebox import Board from BoardSquare import * class GUI(Frame): def __init__(self, master=NONE): Frame.__init__(self, master) self.__init_color_dict() self.board = Board.Board() self.create_labels() ...
Python
__author__ = 'Binary Ninja' from BoardSquare import * import random class Board: size = 4 def __init__(self): self.__squares = self.__generate_board_squares() self.__set_empty_square() self.game_over = False def __generate_board_squares(self): squares = [] ...
Python
__author__ = 'Binary Ninja' class BoardSquare: empty_value = -1 def __init__(self, x, y, value): assert isinstance(value, int) assert isinstance(x, int) assert isinstance(y, int) self.value = value self.x = x self.y = y def get_coordinates(se...
Python
# -*- coding: UTF-8 -*- # MISSING-DOCSTRING: pylint: disable=C0111 """ Based on ``behave tutorial`` Feature: Fight or Flight (Natural Language) In order to increase the ninja survival rate, #< Business goal As a ninja commander #< Role I want my ninjas to decide whether to take...
Python
""" This is the "example" module. The example module supplies one function, factorial(). For example, >>> factorial(5) 120 """ def factorial(n): """Return the factorial of n, an exact integer >= 0. If the result is small enough to fit in an int, return an int. Else return a long. >>> [factorial(n...
Python
# @mark.steps # ---------------------------------------------------------------------------- # STEPS: # ---------------------------------------------------------------------------- from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.by import By from selenium.webdriver.support.u...
Python
import os import sys import signal import subprocess from selenium import webdriver def before_all(context): # NOTE: you can change to whatever driver you want, I use Firefox as a demo context.browser = webdriver.Firefox() # start the app engine server # make sure dev_appserver.py is in your PATH ...
Python
#!/usr/bin/env python import os import urllib from google.appengine.api import users from google.appengine.ext import ndb import jinja2 import webapp2 JINJA_ENVIRONMENT = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), extensions=['jinja2.ext.autoescape'], autoescape=True) ...
Python
__author__ = 'wlee' import Pycluster import random from collections import deque import numpy import math checkins = open('Brightkite_totalCheckins.txt','rb') kmlstatement=[] geos=[] geo_avgs=dict() id=0 count = 0 valid_ids =[] write_valid_ids = open('valid_ids2.txt','wb') us_num = 0 def check_simila...
Python
''' Created on Dec 7, 2011 @author: jeongjin ''' import os import random #src_path = "./" src_path = "/Users/jeongjin/Dropbox/224w/data/AgraphTestData/" label_path = "" label_file = None feature_file_dct = {} result_size = 500000 result_file_name = src_path+"data_"+str(result_size)+".csv" for filename in os.listd...
Python
import re __author__ = 'N Tech2' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr> ...
Python
import re __author__ = 'YeeHin Kwok' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr>...
Python
import re __author__ = 'YeeHin Kwok' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr>...
Python
import re __author__ = 'YeeHin Kwok' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr>...
Python
import re __author__ = 'YeeHin Kwok' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr>...
Python
import re __author__ = 'YeeHin Kwok' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr>...
Python
import re __author__ = 'YeeHin Kwok' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr>...
Python
import re __author__ = 'YeeHin Kwok' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr>...
Python
import re __author__ = 'YeeHin Kwok' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr>...
Python
import re __author__ = 'YeeHin Kwok' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr>...
Python
import re __author__ = 'YeeHin Kwok' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr>...
Python
import re __author__ = 'YeeHin Kwok' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr>...
Python
import re __author__ = 'YeeHin Kwok' """ MicroCompiler <program> ::= program <id>; declare declareList; { StmtList} <declareList> ::= varDeclare {, varDeclare}; <varDeclare> ::= idsym [ = number | "[" number "]" <stmt> ::= variable( = expression | parameter) | <printStmt...
Python
import re __author__ = 'YeeHin Kwok' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr>...
Python
import re __author__ = 'YeeHin Kwok' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <varDeclare > <stmtlist> } <varDeclare> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <exp...
Python
import re __author__ = 'YeeHin Kwok' """ MicroCompiler <program> ::= program <id>; declare declareList; { StmtList} <declareList> ::= varDeclare {, varDeclare}; <varDeclare> ::= idsym [ = number | "[" number "]" <stmt> ::= variable( = expression | parameter) | <printStmt...
Python
import re __author__ = 'YeeHin Kwok' """ MicroCompiler <program> ::= program <id>; declare declareList; { StmtList} <declareList> ::= varDeclare {, varDeclare}; <varDeclare> ::= idsym [ = number | "[" number "]" <stmt> ::= variable( = expression | parameter) | <printStmt...
Python
import re __author__ = 'N Tech2' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr> ...
Python
''' Created on Jun 16, 2014 @author: Brian ''' #filename:Lexer.py import sys flag=0 keyword=[] keyword.extend(['program','var','begin','end','integer','if','then', 'else','while','do','read','write','procedure','function']) simpleword='+-*/,;()[]' doubleword='><=!:' filename=raw_input('Please input the so...
Python
""" Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr> ::= <factor> { (+ | -)...
Python
""" Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr> ::= <factor> { <op...
Python
""" Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr> ::= <factor> { (+ | -)...
Python
import re __author__ = 'N Tech2' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr> ...
Python
""" Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr> ::= <factor> { (+ | -)...
Python
""" Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr> ::= <factor> { (+ | -)...
Python
""" Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr> ::= <factor> { (+ | -)...
Python
""" Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr> ::= <factor> { (+ | -)...
Python
''' Created on Jun 23, 2014 @author: Brian ''' """ Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr>...
Python
""" Giovanni's MicroCompiler Demo <program> ::= { <id> ; <vars > <stmtlist> } <vars> ::= V { <id> ; } % DECLARATIONS <stmtlist> ::= <stmt> { ; <stmt> } <stmt> ::= P <id> | <id> = <expr> <expr> ::= <factor> { (+ | -)...
Python