Skip to content

Releases: Matway/mpl-c

MPL compiler version 200409

09 Apr 12:50
Compare
Choose a tag to compare
  • Removed [module] built-in

Attached files:

  • mplc.ll - precompiled MPL Compiler (LLVM IR)
  • mplc.exe - Windows binary

MPL compiler version 200302

01 Mar 22:14
d1dca3c
Compare
Choose a tag to compare
  • Allowed [call] for static text
  • Added [callField] built-in
  • Forced @ built-in to reify virtual values
  • Forced textSize built-in to check the type of dynamic argument

Attached files:

  • mplc.ll - precompiled MPL Compiler (LLVM IR)
  • mplc.exe - Windows binary

MPL compiler version 200123

23 Jan 08:38
Compare
Choose a tag to compare
  • Added command-line options for setting compiler limits

Attached files:

  • mplc.ll - precompiled MPL Compiler (LLVM IR)
  • mplc.exe - Windows binary

MPL compiler version 191213

13 Dec 12:26
Compare
Choose a tag to compare
  • Fixed crash when failed capture from PRE processed in list constructor
  • Enforced passing through PRE for several errors

Attached files:

  • mplc.ll - precompiled MPL Compiler (LLVM IR)
  • mplc - Linux binary
  • mplc.exe - Windows binary

MPL compiler version 191207

09 Dec 11:35
Compare
Choose a tag to compare

Changed representation for object schemas: used structures instead of strings. Removed redundant IR type and debug type strings building: compiler builds these strings only once for each distinct schema. Removed one hashtable used for linking schema to debug type declaration string: this information stored in schema object now.

Self build debug, seconds release, seconds
without interning 146.50 27.61
with interning 65.95 24.34

Attached files:

  • mplc.ll - precompiled MPL Compiler (LLVM IR)
  • mplc - Linux binary
  • mplc.exe - Windows binary

MPL compiler version 191125 debug

09 Dec 11:40
9b99808
Compare
Choose a tag to compare
Pre-release

Language changes

  • Built-in string literals

    • Built-in string literals are stored in read-only memory and accessible for users only by pointers. Previously, string literal were leaving value-type on the stack, but semantically it was behaving like a reference
    • From now on, string literal leaves reference to a value of some internal type. It is impossible to have a value of this type, only a reference to it, same as with codeRef
    • copy, storageSize and alignment built-ins are no longer applicable to built-in string literals, for there is no more sense in that
  • getCallTrace ( -- ( TraceElement ) ) built-in

    • Built-in returns list with information about call stack. Each element contains a file name, line number, and position in line. This built-in could be enabled by compiler option -call_trace
      Example:
trace: getCallTrace;  
[
  trace.first trace.last is [
    FALSE
  ] [
    () LF printf
    (trace.last.name trace.last.line copy trace.last.column copy)
    "in %s at %i:%i" printf
    trace.last.prev trace.last addressToReference @trace.!last
    TRUE
  ] if
] loop

Compiler changes

  • -call_trace x compiler option

    • -call_trace 0 no trace
    • -call_trace 1 enables trace only for single-threaded application
    • -call_trace 2 enables trace for any application for x86, thread-safe
  • Improved error output

    • Compiler points out to a local variable, that was captured in a context that could potentially outlive that variable scope
# test.mpl
[
  x: 1;
  f: {} {} {} codeRef;
  [a: x;] !f
] call

->

test.mpl(5,7): error, [x], real function can not have real local capture
test.mpl(5,11): [!f], called from here
test.mpl(6,3): [call], called from here
  • Improved function matching performance

Bug fixes

  • Fixed type of the argument that was declared as reference

# test.mpl
{in: 0nx 0 addressToReference const;} () {} [
  printStack drop:;
] "load" exportFunction

Previous version:

> mplc -o test.ll test.mpl
stack:
depth=1
i32CC

Current version:

> mplc -o test.ll test.mpl
stack:
depth=1
i32C
  • Fixed compilation fault for an overloaded function-member that uses a non-virtual variable of its own

# test.mpl
Obj: {
  fun: {
    CALL: [val];
    val:  42;
  };

  fun: {PRE:[FALSE]; CALL:[];};
};

[Obj.fun] call _:;

Previous version:

> mplc -o test.ll test.mpl
ASSERTION FAILED!!!
Wrong refToVar!
...

Current version:

> mplc -o test.ll test.mpl

  • Fixed visibility issues for overloads when member-function were called from ASSIGN, CALL, DIE or INIT:

#test.mpl

f: [];

g: {
  CALL: [f];

  f: {
    PRE:[0 same]; CALL:[do];
    do: [_:; f];
  };
};

0 g

Previous version:

> mplc -o test.ll test.mpl
test.mpl(8,14): error, [f], unknown name:f
test.mpl(7,25): [do], called from here
test.mpl(4,10): [f], called from here
test.mpl(12,3): [g], called from here

Current version:

> mplc -o test.ll test.mpl
  • Fixed double call of non-virtual function from a recursive function

# test.mpl
{} {} {} "F" importFunction

print: [
  recursive
  [
    a:;
    a 0 > [
      0 print
    ] [] if
  ] call
  F
];

() () {} [
  1 print
] "main" exportFunction

Previous version:

> mplc -ndebug -o test.ll test.mpl

# part of test.ll
define internal void @func.11.print(i32* %var.3) {
label1:
  call void @func.14.call(i32* %var.3)
  call void @F()
  call void @F()
  ret void
}

Current version:

> mplc -call_trace 0 -ndebug -o test.ll test.mpl

# part of test.ll
define internal void @func.11.print(i32* %var.3) {
label1:
  call void @func.14.call(i32* %var.3)
  call void @F()
  ret void
}
  • Fixed crash on attempt to assign a virtual value that was indirectly marked dynamic

# test.mpl
 _: 0 [dynamic] call virtual;

Previous version:

> mplc -o test.ll test.mpl
ASSERTION FAILED!!!
Index out of range!
While compiling: at filename: ../test.mpl, token: _: nodeIndex: 2, line 2, column 1

Current version:

> mplc -o test.ll test.mpl
test.mpl(2,2): error, [_:], value for virtual label must be static
  • Fixed crash on attempt to mark schema dynamic

# test.mpl
a: 0 schema;
a dynamic

Previous version:

> mplc -o test.ll test.mpl
ASSERTION FAILED!!!
Ref must be only Static or Dynamic!
at filename: test.mpl, token: dynamic, line: 2, column: 3

Current version:

> mplc -o test.ll test.mpl
test.mpl(3,3): error, [dynamic], can't dynamize schema
  • Fixed crash on attempt to create an object with virtual field initialized by virtual string literal

# test.mpl
a: "" virtual;
x: {a: a virtual;};

Previous version:

> mplc -o test.ll test.mpl
ASSERTION FAILED!!!
Ref got from parent, but dont have shadow!
While compiling:
at filename: test.mpl, token: {, nodeIndex: 2, line: 3, column: 4
stack:
depth=0
Terminating...

Current version:

> mplc -o test.ll test.mpl
  • Fixed endless loop on attempt to create an object with a field that contains schema of some virtual extrnal value

# test.mpl
virtual a: "";
{a schema b:;}

Previous version:

> mplc test.mpl -o test.ll 
(does not terminate)

Current version:

> mplc test.mpl -o test.ll
(terminates)
  • Fixed incorrect matching resolution if it was based on result of calling an argument

# test.mpl
fact: [[] [0.AssertionFiled] uif]; #! condition

ok?: [_:; FALSE];
ok?: {PRE: [call TRUE]; CALL: [_:; TRUE];};

empty?: [[_:;] ok? ~];

empty? fact
42 empty? ~ fact _:;

Previous version:

> mplc -o test.ll test.mpl
test.mpl(1,13): error, [.AssertionFiled], not a combined
test.mpl(9,12): [fact], called from here

Current version:

> mplc -o test.ll test.mpl

Attached files:

  • mplc.ll - precompiled MPL Compiler (LLVM IR)
  • mplc - Linux binary
  • mplc.exe - Windows binary

MPL compiler version 190813 debug

13 Aug 14:03
Compare
Choose a tag to compare
Pre-release

Language changes

  • Calling conventions support

    An options object in function signatures can now specify a calling convention. The compiler passes conventions directly to LLVM IR without any checks. There are functions cdecl and stdcall in mpl-sl/conventions.mpl that return string constants for corresponding conventions. The list of supported calling conventions is available in LLVM documentation.

    Example:

    {} {} {convention: "ccc";} "test" importFunction
    
  • Unified syntax for callables

    If a name that captured a [code] used without @, the content would be called, same as with other callables.

  • Removed built-in functions new, delete

    Use functions new, delete from mpl-sl/memory.mpl instead.

Compiler changes

  • Global static data storage

    The compiler places global static arrays in a global LLVM IR variable and initialises them in-place.
  • Independent compilation of exported functions

    Previously, the compiler could report only one error per compilation. Errors from functions that have a user-defined signature do not stop a compilation now.

    Example:

    test.mpl:
    {} {} {convention: "ccc";} [
      test2: {} {} {convention: "ccc";} codeRef;
      [123] !test2
      [x:;] !test2
      [] !test2
      test2
    ] "test1" exportFunction
    
    {} {} {convention: "ccc";} [1 "" +] "test3" exportFunction
    
    command line:
    mplc.exe -o test.ll test.mpl
    
    output:
    test.mpl(3,10): error, [!test2], signature is void, export function must be without output
    test.mpl(7,11): [exportFunction], called from here
    
    test.mpl(4,5): error, [x:], stack underflow
    test.mpl(4,10): [!test2], called from here
    test.mpl(7,11): [exportFunction], called from here
    
    test.mpl(9,34): error, [+], second argument invalid
    test.mpl(9,45): [exportFunction], called from here
    
  • Error report improvements:

    • added name and type of capture to the error message about a local capture in non-virtual function
    • fixed error messages about local exportFunction\exportVariable
    • added filename, line and column to the printed schema of a [code]
  • Bug fixes:

    • limited PRE recursion depth
    • dynamised all variable-dependent entities if a reference to that variable put in a dynamic context
    • fixed order of writes to the type names in the debug info
    • fixed IR for calls of variadic functions with no arguments
    • fixed crash when a code assigned to a reference to a variadic function
    • fixed crash when used-defined names "closure" and "self" shadow compiler-defined names
    • started to use PRE captures in matching
    • removed confusing compilation error when dynamic codeRef created inside the dynamic loop
    • fixed order of the dereferences of function outputs
    • removed confusing compilation error when virtual variable wrapped into a built-in list
    • made distinguishable function signatures with the same arguments type but different levels of indirection
    • suppressed errors from PRE when one of the previous errors is recursion depth limit exceeding
    • fixed that built-in textSplit would have no return value when the input is an empty string
    • fixed that parser would recognize 0x as a valid token
    • added possibility to cast a number to a schema of a number
    • prohibited virtual codeRef's
    • fixed IR for non-virtual usages of virtual strings
    • fixed crash when built-in function dynamic applied to a schema
    • made parser correctly recognize names consisting of dots
    • made compiler correctly process local overloads
    • fixed IR for codeRefs in failed PRE
    • limited number of unwrapped calls in one node
    • dynamized global variables
    • made non-virtual functions implicitly touch the last input whenever it was not touched

Attached files:

  • mplc.ll - precompiled MPL Compiler (LLVM IR)
  • mplc - Linux binary
  • mplc.exe - Windows binary

MPL Fast compiler version 181205 debug

05 Dec 17:49
Compare
Choose a tag to compare
Pre-release

Changes:

  • Fixed memory leak when objects were created inside conditional branch

Attached files:

  • mplc.ll - precompiled MPL Compiler (LLVM IR)
  • mplc - Linux binary
  • mplc.exe - Windows binary

MPL Fast compiler version 181203 debug

03 Dec 17:02
Compare
Choose a tag to compare
Pre-release

Attached files:

  • mplc.ll - precompiled MPL Compiler (LLVM IR)
  • mplc - Linux binary
  • mplc.exe - Windows binary