Skip to content

Commit

Permalink
changed code page to add two atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisMitchell committed May 11, 2018
1 parent 26ac638 commit 83efa29
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
6 changes: 4 additions & 2 deletions jelly/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,19 @@
elif char == 'n':
end = '\n'

compat = str.maketrans('\nụṿ', '¶§Ä')

if flag_file:
with open(argv[2], 'rb') as file:
code = file.read()
if flag_utf8:
code = ''.join(char for char in code.decode('utf-8').replace('\n', '¶') if char in code_page)
code = ''.join(char for char in code.decode('utf-8').translate(compat) if char in code_page)
else:
code = ''.join(code_page[i] for i in code)
else:
code = argv[2]
if flag_utf8:
code = ''.join(char for char in code.replace('\n', '¶') if char in code_page)
code = ''.join(char for char in code.translate(compat) if char in code_page)
else:
code = ''.join(code_page[ord(i)] for i in code)

Expand Down
14 changes: 12 additions & 2 deletions jelly/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
random, sympy, urllib_request = lazy_import('random sympy urllib.request')

code_page = '''¡¢£¤¥¦©¬®µ½¿€ÆÇÐÑ×ØŒÞßæçðıȷñ÷øœþ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¶'''
code_page += '''°¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ƁƇƊƑƓƘⱮƝƤƬƲȤɓƈɗƒɠɦƙɱɲƥʠɼʂƭʋȥẠḄḌẸḤỊḲḶṂṆỌṚṢṬỤṾẈỴẒȦḂĊḊĖḞĠḢİĿṀṄȮṖṘṠṪẆẊẎŻạḅḍẹḥịḳḷṃṇọṛṣṭụṿẉỵẓȧḃċḋėḟġḣŀṁṅȯṗṙṡṫẇẋẏż«»‘’“”'''
code_page += '''°¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ƁƇƊƑƓƘⱮƝƤƬƲȤɓƈɗƒɠɦƙɱɲƥʠɼʂƭʋȥẠḄḌẸḤỊḲḶṂṆỌṚṢṬỤṾẈỴẒȦḂĊḊĖḞĠḢİĿṀṄȮṖṘṠṪẆẊẎŻạḅḍẹḥịḳḷṃṇọṛṣṭ§Äẉỵẓȧḃċḋėḟġḣŀṁṅȯṗṙṡṫẇẋẏż«»‘’“”'''

# Unused symbols for single-byte atoms/quicks: (kquƁƇƘⱮƬȤɦɱɲƥʠɼʂȥẈẒŻḥḳṇụṿẉỵẓḋėġṅẏ
# Unused symbols for single-byte atoms/quicks: (kquƁƇƘⱮƬȤɦɱɲƥʠɼʂȥẈẒŻḥḳṇẉỵẓḋėġṅẏ

str_digit = '0123456789'
str_lower = 'abcdefghijklmnopqrstuvwxyz'
Expand Down Expand Up @@ -1775,6 +1775,16 @@ def zip_ragged(array):
arity = 2,
call = lambda x, y: zip_ragged([x, y])
),
'§': attrdict(
arity = 1,
ldepth = 1,
call = sum
),
'Ä': attrdict(
arity = 1,
ldepth = 1,
call = lambda z: list(itertools.accumulate(z))
),
'!': attrdict(
arity = 1,
ldepth = 0,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name = 'jellylanguage',
version = '0.1.10',
version = '0.1.11',
packages = [
'jelly'
],
Expand Down

0 comments on commit 83efa29

Please sign in to comment.