-Parsed.__bytes__
This commit is contained in:
parent
5c597ce1f9
commit
f95c639b38
@ -1,8 +1,8 @@
|
||||
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
||||
|
||||
from bu4.evaluation.targets.avtarget import AVTarget
|
||||
from bu4.evaluation.constructs.evaluable import Evaluable
|
||||
from bu4.evaluation.constructs.evalue import EValue
|
||||
from bu4.evaluation.targets.avtarget import AVTarget
|
||||
|
||||
__all__ = ('AfterValue',)
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
from typing import Mapping, Iterator
|
||||
|
||||
from bu4.evaluation.av.aftervalue import AfterValue
|
||||
from bu4.evaluation.targets.avcontainer import AVContainer
|
||||
from bu4.evaluation.av.envtype import envtype
|
||||
from bu4.evaluation.constructs.evaluable import Evaluable
|
||||
from bu4.evaluation.targets.avcontainer import AVContainer
|
||||
|
||||
__all__ = ('LambdaEnv',)
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
||||
|
||||
from bu4.evaluation.constructs.elinked import ELinked
|
||||
from bu4.evaluation.av.envtype import envtype
|
||||
from bu4.evaluation.av.lambdaenv import LambdaEnv
|
||||
from bu4.evaluation.constructs.elinked import ELinked
|
||||
from bu4.evaluation.constructs.evaluable import Evaluable
|
||||
from bu4.evaluation.constructs.evalue import EValue
|
||||
from bu4.evaluation.av.lambdaenv import LambdaEnv
|
||||
from bu4.parsing.constructs.linked import Linked
|
||||
|
||||
__all__ = ('ELambda',)
|
||||
|
@ -3,10 +3,10 @@
|
||||
from typing import Any
|
||||
|
||||
from bu4.evaluation.av.aftervalue import AfterValue
|
||||
from bu4.evaluation.targets.avtarget import AVTarget
|
||||
from bu4.evaluation.constructs.evaluable import Evaluable
|
||||
from bu4.evaluation.constructs.evalue import EValue
|
||||
from bu4.evaluation.sync import sync
|
||||
from bu4.evaluation.targets.avtarget import AVTarget
|
||||
|
||||
__all__ = ('eproxy', 'antiproxy')
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
||||
|
||||
from bu4.evaluation.targets.avtarget import AVTarget
|
||||
from bu4.evaluation.constructs.elinked import ELinked
|
||||
from bu4.evaluation.av.envtype import envtype
|
||||
from bu4.evaluation.constructs.elinked import ELinked
|
||||
from bu4.evaluation.constructs.evaluable import Evaluable
|
||||
from bu4.evaluation.constructs.evalue import EValue
|
||||
from bu4.evaluation.targets.avtarget import AVTarget
|
||||
from bu4.parsing.constructs.linked import Linked
|
||||
|
||||
__all__ = ('AVCall',)
|
||||
|
@ -1,9 +1,9 @@
|
||||
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
||||
|
||||
from bu4.evaluation.av.aftervalue import AfterValue
|
||||
from bu4.evaluation.targets.avtarget import AVTarget
|
||||
from bu4.evaluation.constructs.evaluable import Evaluable
|
||||
from bu4.evaluation.constructs.evalue import EValue
|
||||
from bu4.evaluation.targets.avtarget import AVTarget
|
||||
|
||||
__all__ = ('AVContainer',)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
||||
|
||||
from bu4.evaluation.constructs.elinked import ELinked
|
||||
from bu4.evaluation.av.envtype import envtype
|
||||
from bu4.evaluation.constructs.elinked import ELinked
|
||||
from bu4.linking.prepare import prepare
|
||||
from bu4.parsing.constructs.linked import Parsed
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
||||
|
||||
from bu4.linking.states.afterlinking import AfterLinking
|
||||
from bu4.linking.targets.alchain import ALChain
|
||||
from bu4.linking.states.linkingfinished import LinkingFinished
|
||||
from bu4.linking.states.linkingparsed import LinkingParsed
|
||||
from bu4.linking.states.linkingstate import LinkingState
|
||||
from bu4.linking.targets.alchain import ALChain
|
||||
from bu4.parsing.constructs.linked import Linked
|
||||
|
||||
__all__ = ('prepare',)
|
||||
|
@ -1,8 +1,8 @@
|
||||
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
||||
|
||||
from bu4.linking.states.afterlinking import AfterLinking
|
||||
from bu4.linking.targets.altarget import ALTarget
|
||||
from bu4.linking.states.linkingstate import LinkingState
|
||||
from bu4.linking.targets.altarget import ALTarget
|
||||
from bu4.parsing.constructs.linked import Linked
|
||||
|
||||
__all__ = ('ALChain',)
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
from typing import Callable
|
||||
|
||||
from bu4.linking.targets.altarget import ALTarget
|
||||
from bu4.linking.states.linkingstate import LinkingState
|
||||
from bu4.linking.targets.altarget import ALTarget
|
||||
from bu4.parsing.constructs.linked import Linked
|
||||
|
||||
__all__ = ('ALLambda',)
|
||||
|
@ -2,16 +2,15 @@
|
||||
|
||||
from bu4.evaluation.av.aftervalue import AfterValue
|
||||
from bu4.evaluation.av.envtype import envtype
|
||||
from bu4.linking.states.linkingstate import LinkingState
|
||||
from bu4.parsing.codes import CODE_CALL
|
||||
from bu4.evaluation.targets.avcall import AVCall
|
||||
from bu4.evaluation.constructs.elinked import ELinked
|
||||
from bu4.evaluation.constructs.evaluable import Evaluable
|
||||
from bu4.evaluation.targets.avcall import AVCall
|
||||
from bu4.linking.states.afterlinking import AfterLinking
|
||||
from bu4.linking.targets.allambda import ALLambda
|
||||
from bu4.parsing.constructs.linked import Linked, Parsed
|
||||
from bu4.linking.states.linkingfinished import LinkingFinished
|
||||
from bu4.linking.states.linkingparsed import LinkingParsed
|
||||
from bu4.evaluation.constructs.evaluable import Evaluable
|
||||
from bu4.linking.states.linkingstate import LinkingState
|
||||
from bu4.linking.targets.allambda import ALLambda
|
||||
from bu4.parsing.constructs.linked import Linked, Parsed
|
||||
|
||||
__all__ = ('PCall',)
|
||||
|
||||
@ -60,6 +59,3 @@ class PCall(Parsed):
|
||||
|
||||
def link(self, promise: set[bytes]) -> Linked:
|
||||
return LCall(promise, self.value, self.lambda_)
|
||||
|
||||
def __bytes__(self):
|
||||
return bytes([CODE_CALL, *bytes(self.value), *bytes(self.lambda_)])
|
||||
|
@ -20,13 +20,7 @@ class Linked:
|
||||
def unlink(self) -> 'Parsed':
|
||||
raise NotImplementedError
|
||||
|
||||
def __bytes__(self):
|
||||
return bytes(self.unlink())
|
||||
|
||||
|
||||
class Parsed:
|
||||
def link(self, promise: set[bytes]) -> Linked:
|
||||
raise NotImplementedError
|
||||
|
||||
def __bytes__(self):
|
||||
raise NotImplementedError
|
||||
|
@ -1,15 +1,14 @@
|
||||
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
||||
|
||||
from bu4.evaluation.av.envtype import envtype
|
||||
from bu4.linking.states.linkingstate import LinkingState
|
||||
from bu4.parsing.codes import CODE_MAKE, CODE_NULL
|
||||
from bu4.evaluation.constructs.elambda import ELambda
|
||||
from bu4.evaluation.constructs.evaluable import Evaluable
|
||||
from bu4.linking.states.afterlinking import AfterLinking
|
||||
from bu4.linking.targets.allambda import ALLambda
|
||||
from bu4.parsing.constructs.linked import Linked, Parsed
|
||||
from bu4.linking.states.linkingfinished import LinkingFinished
|
||||
from bu4.linking.states.linkingparsed import LinkingParsed
|
||||
from bu4.evaluation.constructs.evaluable import Evaluable
|
||||
from bu4.linking.states.linkingstate import LinkingState
|
||||
from bu4.linking.targets.allambda import ALLambda
|
||||
from bu4.parsing.constructs.linked import Linked, Parsed
|
||||
|
||||
__all__ = ('PLambda',)
|
||||
|
||||
@ -52,6 +51,3 @@ class PLambda(Parsed):
|
||||
|
||||
def link(self, promise: set[bytes]) -> Linked:
|
||||
return LLambda(promise, self.name, self.value)
|
||||
|
||||
def __bytes__(self):
|
||||
return bytes([CODE_MAKE, *self.name, CODE_NULL, *bytes(self.value)])
|
||||
|
@ -1,12 +1,10 @@
|
||||
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
||||
|
||||
from bu4.evaluation.av.envtype import envtype
|
||||
from bu4.linking.states.linkingstate import LinkingState
|
||||
from bu4.parsing.codes import CODE_NAME, CODE_NULL
|
||||
from bu4.parsing.constructs.linked import Linked, Parsed
|
||||
from bu4.linking.states.linkingfinished import LinkingFinished
|
||||
from bu4.evaluation.constructs.evaluable import Evaluable
|
||||
|
||||
from bu4.linking.states.linkingfinished import LinkingFinished
|
||||
from bu4.linking.states.linkingstate import LinkingState
|
||||
from bu4.parsing.constructs.linked import Linked, Parsed
|
||||
|
||||
__all__ = ('PName',)
|
||||
|
||||
@ -36,6 +34,3 @@ class PName(Parsed):
|
||||
|
||||
def link(self, promise: set[bytes]) -> Linked:
|
||||
return LName(promise, self.name)
|
||||
|
||||
def __bytes__(self):
|
||||
return bytes([CODE_NAME, *self.name, CODE_NULL])
|
||||
|
@ -1,13 +1,11 @@
|
||||
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
||||
|
||||
from bu4.evaluation.constructs.enull import ENull
|
||||
from bu4.evaluation.av.envtype import envtype
|
||||
from bu4.linking.states.linkingstate import LinkingState
|
||||
from bu4.parsing.codes import CODE_NULL
|
||||
from bu4.parsing.constructs.linked import Linked, Parsed
|
||||
from bu4.linking.states.linkingfinished import LinkingFinished
|
||||
from bu4.evaluation.constructs.enull import ENull
|
||||
from bu4.evaluation.constructs.evaluable import Evaluable
|
||||
|
||||
from bu4.linking.states.linkingfinished import LinkingFinished
|
||||
from bu4.linking.states.linkingstate import LinkingState
|
||||
from bu4.parsing.constructs.linked import Linked, Parsed
|
||||
|
||||
__all__ = ('PNull',)
|
||||
|
||||
@ -32,6 +30,3 @@ class LNull(Linked):
|
||||
class PNull(Parsed):
|
||||
def link(self, promise: set[bytes]) -> Linked:
|
||||
return LNull()
|
||||
|
||||
def __bytes__(self):
|
||||
return bytes([CODE_NULL])
|
||||
|
@ -3,8 +3,8 @@
|
||||
from bu4.parsing.constructs.lcall import PCall
|
||||
from bu4.parsing.states.psafter import PSAfter
|
||||
from bu4.parsing.states.psfinal import PSFinal
|
||||
from bu4.parsing.targets.pslambda import PSLambda
|
||||
from bu4.parsing.states.psread import PSRead
|
||||
from bu4.parsing.targets.pslambda import PSLambda
|
||||
|
||||
__all__ = ('pscall',)
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
from bu4.parsing.constructs.linked import Parsed
|
||||
from bu4.parsing.parser import Parser
|
||||
|
||||
|
||||
__all__ = ('parse',)
|
||||
|
||||
|
||||
|
@ -38,5 +38,5 @@ def transply(source: str) -> bytes:
|
||||
b.write(bytes([CODE_QCLS]))
|
||||
else:
|
||||
value = c.encode()
|
||||
b.write(value if len(value) == 1 else value.hex().encode())
|
||||
b.write(value if len(value) == 1 else f'[{value.hex()}]'.encode())
|
||||
return b.getvalue()
|
||||
|
5
main.py
5
main.py
@ -1,12 +1,15 @@
|
||||
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
||||
import sys
|
||||
|
||||
from bu4.common_interface import with_common_interface
|
||||
from bu4.evaluation.constructs.proxy import antiproxy, eproxy
|
||||
from bu4.evaluation.sync import sync
|
||||
from bu4.evaluation.synced import synced
|
||||
from bu4.synced import synced
|
||||
from bu4.parsing.toolchain.readfile import readfile
|
||||
from timesample import TimeSample
|
||||
|
||||
sys.setrecursionlimit(13)
|
||||
|
||||
with TimeSample('all'):
|
||||
with TimeSample('sys0'):
|
||||
with TimeSample('compilation'):
|
||||
|
Loading…
Reference in New Issue
Block a user