three months of coastal living: coastML at three months
Today marks three months of coastal living; let’s checkout the running burndown chart:
✓ assignments
✓ functions
✓
case
forms✓ thread assignments into
case
forms (e.g.a = case x …
becomescase x | … { a = … }
)
✓
type
forms✓ Python generation
✓ decomposition in
case
forms✓ including pattern matching
❏ array pattern matching
❏ string pattern matching (this could get interesting…)
✓ accessors (both variables and lambdas) for
type
❏
gn
forms❏
fc
forms❏
mod
andsig
forms❏ an analog to SML’s
op
, using backticks❏ basis library (stubbed out, need to actually compile)
✓ basic basis stubs: some members of
array-
,string-</emphasis>
have been stubbed out❏ basis library modules (modular forms, e.g.
array-get
becomesArray::get
)
❏ support for the
is
form❏ code generation
❏ C
❏ C++
❏ Go
❏ type inference
❏ refinement types
❏ a compiler
❏ lambda lifter
❏ closure conversion
❏
pragma
to control certain aspects of compilation❏ checking of accessors prior to compilation
❏ value restriction for
ref
types
bugs fixed
✓ nested arrays
[[[1] [2]] [[3] [4]]]
✓ missing
/
character in identifier/operator character sets✓ floating point numbers with two integral digits (e.g.
0.12
and1.12
worked but not10.12
)this was noticed when attempting to write some software to generate Julian dates
✓
return
logic✓ indentation of blocks
✓ missing
bool
type✓ parsing
type
definitions that have other complex types in them❏ munging idents (ex:
julian-date
becomesjulian_date
)✓ stripping comments prior to output
really need to handle these so that we can output them into the compiled language, but for now this suffices
I still enjoy skipping stones in the shallow tide waters, even if work has taken more of my time than it normally would. I think the most interesting thing is that I changed the syntax of type
forms to be simpler, and set the stage for parsing is
more easily. We now have a Basis library started, which includes Daffodil, the start of a native coastML JSON parser ported from my RoseJSON system. Work this month focused around some simple fixes to the Python code generator as well, but now we can nicely parse & generate type
forms:
% ./carpet.py load basis/Daffodil.coast
main ['./carpet.py', 'load', 'basis/Daffodil.coast']
loading: basis/Daffodil.coast
type Daffodil
| Assoc is [array[string] array[Daffodil]]
| Array is [array[Daffodil]]
| Int is [int]
| Float is [float]
| Null
| Bool is [bool]
| String is [string]
epyt
% ./carpet.py python basis/Daffodil.coast
main ['./carpet.py', 'python', 'basis/Daffodil.coast']
pythonizing: basis/Daffodil.coast
class Daffodil:
pass
@dataclass
class Daffodil_Assoc(Daffodil):
m_0 : list
m_1 : list
@dataclass
class Daffodil_Array(Daffodil):
m_0 : list
@dataclass
class Daffodil_Int(Daffodil):
m_0 : int
@dataclass
class Daffodil_Float(Daffodil):
m_0 : float
@dataclass
class Daffodil_Null(Daffodil):
pass
@dataclass
class Daffodil_Bool(Daffodil):
m_0 : bool
@dataclass
class Daffodil_String(Daffodil):
m_0 : str
You might also notice one other difference… we can now call carpet.py
from the command line. I added a simple help system and a few commands to get started:
% ./carpet.py
main ['./carpet.py']
usage: carpet.py [command] [file]
commands:
load - load a file, and dump the resulting coastML
python - dump python from a coastML file, without the compiler
cpython - dump python from a coastML file, with the compiler
note, the last two will be merged at some point