€
Jump to navigation
Jump to search
- This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
€ is a scripting language created by A.L for codegolf.
Keywords
gleich
is equal in Germanmientras
is while in Spanishtopo
is greater in Portugueseodejmowanie
is subtract in Polishafficher
is print in French- newlines are called nl sometimes, and the TLD of NETHERLANDS is nl, so I defined a constant
NETHERLANDS
to display newlines
Examples
€beers gleich 99 €bottles gleich bottles of beer €bottles_on_the_wall gleich bottles of beer on the wall mientras €beers topogleich 3 afficher €beers €bottles_on_the_wall afficher , €beers €bottles afficher . NETHERLANDS odejmowanie €beers afficher Take one down and pass it around, €beers afficher €bottles_on_the_wall afficher . NETHERLANDS NETHERLANDS sartneim afficher 2 bottles of beer on the wall, 2 bottles of beer. NETHERLANDS afficher Take one down and pass it around, 1 bottle of beer on the wall. afficher NETHERLANDS NETHERLANDS afficher 1 bottle of beer on the wall, 1 bottle of beer. NETHERLANDS afficher Take one down and pass it around, no more bottles of beer on the wall. afficher NETHERLANDS NETHERLANDS afficher No more bottles of beer on the wall, no more bottles of beer. NETHERLANDS afficher Go to the store and buy some more, 99 bottles of beer on the wall. afficher NETHERLANDS NETHERLANDS
Interpreter
# -*- coding: utf-8 -*- # @see http://stackoverflow.com/questions/12655836/writing-an-xml-file-that-contains-a-euro-symbol-in-python-using-xml-etree/12655861#12655861 # = gleich (german) # while mientras (spanish) # > topo (portuguese) # subtract odejmowanie (polish) # print afficher (french) # newline NETHERLANDS import sys, codecs class euro: symbols = {} sign = u'€' def executeLine(self, line): s = line.split(' ') if s[0] == 'afficher': buffer = [] for a in s[1:]: if (a == ''): continue elif (a[0] == self.sign): buffer.append(str(self.getSymbol(a))) elif (a == 'NETHERLANDS'): buffer.append("\n") else : buffer.append(a) sys.stdout.write(' '.join(buffer)) # @see http://stackoverflow.com/questions/4499073/printing-without-newline-print-a-prints-a-space-how-to-remove/4499172#4499172 elif s[0] == 'afficherNouvelleLigne': print '' elif s[0] == 'odejmowanie': self.setSymbol(s[1], (int(self.getSymbol(s[1])) - 1)) elif (len(s) >= 3) and (s[1] == 'gleich'): self.setSymbol(s[0], (' ').join(s[2:])) def executeBlock(self, lines, statement): while (self.getStatement(statement)): for line in lines: self.executeLine(line) def getStatement(self, statement): if (statement[1] == 'topogleich'): return self.getSymbol(statement[0]) >= int(statement[2]) def setSymbol(self, name, value): name = self.withoutEuro(name) self.symbols[name] = value def getSymbol(self, name): #~ print symbols, withoutEuro(name) name = self.withoutEuro(name) if name in self.symbols: value = self.symbols[name] return value else : print "\n-----\n",'Error: "', name, '"is not in', self.symbols, '-----' #~ sys.exit() def withoutEuro(self, string): return(string.replace(self.sign, '')) def parseFile(self, f): linesStack = [] for line in codecs.open(f, 'r', 'utf-8'): line = line.replace('\n', '').replace('\t', '') s = line.split(' ') if (len(s) == 1) & (s[0] == '') : continue if (s[0] == 'mientras'): statement = s[1:] linesStack.append(line) elif (s[0] == 'sartneim'): linesStack.append(line) self.executeBlock(linesStack, statement) linesStack = [] statement = '' elif (len(linesStack) > 0): linesStack.append(line) else: self.executeLine(line) euro = euro() euro.parseFile(sys.argv[1])