From cdb18b1e79bef443c49553eba6dcafb729471cfa Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Mon, 12 Feb 2018 18:52:23 +0000 Subject: Add support for top-level letbindings to C backend --- language/bytecode.ott | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'language/bytecode.ott') diff --git a/language/bytecode.ott b/language/bytecode.ott index 11244f4d..19c4d9cc 100644 --- a/language/bytecode.ott +++ b/language/bytecode.ott @@ -59,7 +59,7 @@ ctyp :: 'CT_' ::= | mpz_t :: :: mpz % Arbitrary precision GMP integer, mpz_t in C. }} | bv_t ( bool ) :: :: bv -% Variable length bitvector - flag represents direction, inc or dec }} +% Variable length bitvector - flag represents direction, true - dec or false - inc }} | 'uint64_t' ( nat , bool ) :: :: uint64 % Fixed length bitvector that fits within a 64-bit word. - int % represents length, and flag is the same as CT_bv. }} @@ -83,6 +83,8 @@ ctyp :: 'CT_' ::= % into C. We don't fully worry about precise implementation details at % this point, as C doesn't have variants or tuples natively, but these % need to be encoded. + | vector ( bool , ctyp ) :: :: vector +% A vector type for non-bit vectors cval :: 'CV_' ::= {{ ocaml fragment * ctyp }} @@ -130,6 +132,11 @@ instr :: 'I_' ::= cdef :: 'CDEF_' ::= | register id : ctyp :: :: reg_dec | ctype_def :: :: type + | let nat ( id0 : ctyp0 , ... , idn : ctypn ) = { + instr0 ; ... ; instrm + } { + instr0 ; ... ; instri + } :: :: let | function id mid ( id0 , ... , idn ) { instr0 ; ... ; instrm } :: :: fundef \ No newline at end of file -- cgit v1.2.3