five months of coastal living: coastML at four months
Today marks five 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 = … }
)✓
case
forms within other forms, such as function calls
✓
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
formsStill so on the fence about these…
❏
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-*
have been stubbed out✓ array-length
✓ array-get
✓ array-set!
✓ array-make
✓ array-init
✓ array-make-matrix
✓ array-append
✓ array-append!
❏ array-concat
❏ array-concat!
✓ array-sub
✓ array-copy
❏ array-fill!
❏ array-blit!
❏ array→list
❏ list→array
✓ array-iter
✓ array-map
✓ array-iter-index
✓ array-map-index
❏ array-foldl
❏ array-foldr
❏ array-sort
✓ array-sort!
❏ array-stable-sort
❏ array-fast-sort
✓ string-length
✓ string-get
❏ string-make
❏ string-init
✓ string-split
✓ string-append
❏ string-join
❏ string-contains
❏ string-concat
❏ string-copy
❏ string→array
✓ string-iter
✓ string-map
✓ string-iter-index
❏ string-map-index
❏ string-foldl
❏ string-foldr
✓ string-sort
❏ compare
❏ char-code
❏ char-chr
❏ char-escaped
❏ char-lowercase
❏ char-uppercase
❏ char-compare
More of the OS interaction stuff out of the Pervasives API
❏ basis library modules (modular forms, e.g.
array-get
becomesArray::get
)
❏ support for the
is
form❏ code generation
❏ C
❏ C++
❏ Go
✓ Python
❏ 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
✓
return
prepended to forms that are rewritten tofor
loops✓ fix spacing between
class
forms in Python output✓ fixed bugs with parsing & displaying characters
❏
case
forms at the start of a(call)
form are assumed to be functions instead of evaluated for a lambda(case … | 10 { " " } | _ { "nope" } esac …)
is assumed to be a lambda already… whoops
✓
case
forms in a function call in assignment clobbers the assignmentex:
a = string-split-char ':' case (OS::getenv "PATH") | (Result.Some s) { s } | (Result.None) { "" } esac;
produces
a = res1 = …
which is obviously in correct
✓
case
forms that destructuretype
forms don’t indent correctly and don’t nestif-elif-else
correctly✓
case
forms that bind a function call do not indent the initialif
correctly✓ destructuring binds didn’t actually apply a
.format
correctly
I fixed quite a few case
related bugs this month, mostly
around output. Additionally, the pipelining operators |>
and <|
now generate the expected code:
>>> c = carpet.CarpetPython("(3 + 4) |> bar |> baz |> blah |> print;")
>>> c.load()
>>> c.generate()
print(blah(baz(bar((3 + 4)))))
>>> c = carpet.CarpetPython("print <| blah <| baz <| bar <| (3 + 4);")
>>> c.load()
>>> c.generate()
print(blah(baz(bar((3 + 4)))))
>>>
This month, I’d like to focus on the last few places
case
forms can exist (at the start of call blocks, for
example) and lambda lifting in the same way as case
forms
are lifted. Additionally, I’d like to focus on new pervasives, such as
array-iter-while
and array-map-until
, for
handling while
blocks in Python.