Shogoth -> Shoggoth

This commit is contained in:
Reid D. 'arrdem' McKenzie 2022-05-31 19:04:14 -06:00
parent d146b90250
commit 1e7517138a
26 changed files with 36 additions and 36 deletions

View file

@ -1,6 +1,6 @@
py_project(
name = "shogoth",
main = "src/python/shogoth/repl/__main__.py",
name = "shoggoth",
main = "src/python/forerunner/repl/__main__.py",
main_deps = [
py_requirement("prompt_toolkit"),
py_requirement("yaspin"),

View file

@ -1,4 +1,4 @@
# Shogot'im
# Shoggot'im
> "The shoggot'im, they're called: servitors. There are several kinds of advanced robotic systems made out of molecular components: they can change shape, restructure material at the atomic level -- act like corrosive acid, or secrete diamonds. Some of them are like a tenuous mist -- what Doctor Drexler at MIT calls a utility fog -- while others are more like an oily globule. Apparently they may be able to manufacture more of themselves, but they're not really alive in any meaning of the term we're familiar with. They're programmable, like robots, using a command language deduced from recovered records of the forerunners who left them here. The Molotov Raid of 1930 brought back a large consignment of them; all we have to go on are the scraps they missed, and reports by the Antarctic Survey. Professor Liebkunst's files in particular are most frustrating --''
>

View file

@ -6,7 +6,7 @@ from abc import ABC
from dataclasses import dataclass
import typing as t
from shogoth.types import (
from shoggoth.types import (
Keyword,
List,
Symbol,
@ -84,7 +84,7 @@ class FnExpr(Expr):
body: Expr
BOOTSTRAP = "lang.shogoth.v0.bootstrap"
BOOTSTRAP = "lang.shoggoth.v0.bootstrap"
SPECIALS = Namespace(Symbol(BOOTSTRAP), {
Symbol("if*"): None,
Symbol("let*"): None,
@ -92,7 +92,7 @@ SPECIALS = Namespace(Symbol(BOOTSTRAP), {
})
GLOBALS = Namespace(Symbol("lang.shogoth.v0.core"), {
GLOBALS = Namespace(Symbol("lang.shoggoth.v0.core"), {
})

View file

@ -0,0 +1,6 @@
"""Published interface to the shoggoth parser."""
from .impl import parse
__all__ = ["parse"]

View file

@ -60,6 +60,6 @@ COMMENT: /;.*?\n/
def parse(input: str) -> Any:
'''Parse a string using the shogoth (lisp) gramar, returning an unmodified tree.'''
'''Parse a string using the shoggoth (lisp) gramar, returning an unmodified tree.'''
return PARSER.parse(input)

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""The shogoth reader."""
"""The shoggoth reader."""
import sys
@ -11,8 +11,8 @@ import re
from typing import Any
from lark import Token, Tree
from shogoth.parser import parse
from shogoth.types import (
from shoggoth.parser import parse
from shoggoth.types import (
Keyword,
List,
Symbol,

View file

@ -3,14 +3,14 @@
from prompt_toolkit import PromptSession
from prompt_toolkit.history import FileHistory
from prompt_toolkit.styles import Style
from shogoth.analyzer import (
from shoggoth.analyzer import (
Analyzer,
GLOBALS,
Namespace,
SPECIALS,
)
from shogoth.reader import Reader
from shogoth.types import Symbol
from shoggoth.reader import Reader
from shoggoth.types import Symbol
from yaspin import Spinner, yaspin
@ -31,7 +31,7 @@ def main():
analyzer = Analyzer(SPECIALS, GLOBALS)
ns = Namespace(Symbol("user"), {})
session = PromptSession(history=FileHistory(".shogoth.history"))
session = PromptSession(history=FileHistory(".shoggoth.history"))
while True:
try:

View file

@ -1,4 +1,4 @@
"""The public interface for shogoth's baked-in types."""
"""The public interface for shoggoth's baked-in types."""
import typing as t

View file

@ -6,13 +6,13 @@ Hopefully no "real" interpreter ever uses this code, since it's obviously replac
from .isa import Module, Opcode
from shogoth.types import *
from shoggoth.types import *
BOOTSTRAP = Module()
NOT = BOOTSTRAP.define_function(
";/lang/shogoth/v0/bootstrap/not;bool;bool",
";/lang/shoggoth/v0/bootstrap/not;bool;bool",
[
Opcode.IF(target=3),
Opcode.FALSE(),
@ -23,7 +23,7 @@ NOT = BOOTSTRAP.define_function(
)
OR = BOOTSTRAP.define_function(
";/lang/shogoth/v0/bootstrap/or;bool,bool;bool",
";/lang/shoggoth/v0/bootstrap/or;bool,bool;bool",
[
Opcode.IF(target=3),
Opcode.TRUE(),
@ -37,7 +37,7 @@ OR = BOOTSTRAP.define_function(
)
AND = BOOTSTRAP.define_function(
";/lang/shogoth/v0/bootstrap/and;bool,bool;bool",
";/lang/shoggoth/v0/bootstrap/and;bool,bool;bool",
[
Opcode.IF(target=3),
Opcode.IF(target=3),
@ -50,7 +50,7 @@ AND = BOOTSTRAP.define_function(
)
XOR = BOOTSTRAP.define_function(
";/lang/shogoth/v0/bootstrap/xor;bool,bool;bool",
";/lang/shoggoth/v0/bootstrap/xor;bool,bool;bool",
[
Opcode.DUP(nargs=2),
# !A && B
@ -73,16 +73,16 @@ XOR = BOOTSTRAP.define_function(
)
TRUE = BOOTSTRAP.define_type(
"/lang/shogoth/v0/true",
"/lang/shoggoth/v0/true",
ProductExpr([]),
)
FALSE = BOOTSTRAP.define_type(
"/lang/shogoth/v0/false",
"/lang/shoggoth/v0/false",
ProductExpr([]),
)
BOOL = BOOTSTRAP.define_type(
"/lang/shogoth/v0/bool",
"/lang/shoggoth/v0/bool",
SumExpr([TRUE, FALSE])
)

View file

@ -2,8 +2,8 @@
"""The Shogoth VM implementation.
The whole point of shogoth is that program executions are checkpointable and restartable. This requires that rather than
using a traditional recursive interpreter which is difficult to snapshot, interpretation in shogoth occur within a
The whole point of shoggoth is that program executions are checkpointable and restartable. This requires that rather than
using a traditional recursive interpreter which is difficult to snapshot, interpretation in shoggoth occur within a
context (a virtual machine) which DOES have an easily introspected and serialized representation.
## The Shogoth VM Architecture

View file

@ -3,7 +3,7 @@
from typing import NamedTuple
from shogoth.types import FunctionRef
from shoggoth.types import FunctionRef
class Opcode:

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import pytest
from shogoth.parser import parse
from shoggoth.parser import parse
@pytest.mark.parametrize("example", [

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import pytest
from shogoth.vm import *
from shoggoth.vm import *
@pytest.fixture

View file

@ -3,7 +3,7 @@
from .fixtures import * # noqa
import pytest
from shogoth.vm import *
from shoggoth.vm import *
@pytest.mark.parametrize("stack,ret", [

View file

@ -5,7 +5,7 @@ Tests coverign the VM interpreter
from .fixtures import * # noqa
import pytest
from shogoth.vm import *
from shoggoth.vm import *
def test_true(vm):

View file

@ -1,6 +0,0 @@
"""Published interface to the shogoth parser."""
from .impl import parse
__all__ = ["parse"]