Console compiler добавил dll
This commit is contained in:
parent
36ba728b27
commit
6dd106d950
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "2";
|
||||
public const string Build = "0";
|
||||
public const string Revision = "1379";
|
||||
public const string Revision = "1381";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%COREVERSION%=0
|
||||
%REVISION%=1379
|
||||
%REVISION%=1381
|
||||
%MINOR%=2
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
14
InstallerSamples/LanguageFeatures/Tuples/MySqrt.pas
Normal file
14
InstallerSamples/LanguageFeatures/Tuples/MySqrt.pas
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
function MySqrt(x: real): real;
|
||||
begin
|
||||
var eps := 1e-15;
|
||||
(var a, var b) := (x, real.MaxValue);
|
||||
while abs(b-a) >= eps do
|
||||
(a,b) := (b,(a + x / a) / 2);
|
||||
Result := b;
|
||||
end;
|
||||
|
||||
begin
|
||||
Println(MySqrt(2));
|
||||
Println(MySqrt(3));
|
||||
Println(MySqrt(4));
|
||||
end.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
cd ..\bin
|
||||
del ..\Release\PACNETConsole.zip
|
||||
..\utils\pkzipc\pkzipc.exe -add ..\Release\PABCNETC.zip pabcnetc.exe pabcnetcclear.exe Compiler.dll CompilerTools.dll Errors.dll Localization.dll NETGenerator.dll ParserTools.dll ICSharpCode.NRefactory.dll SemanticTree.dll SyntaxTree.dll TreeConverter.dll OptimizerConversion.dll PascalABCParser.dll licence.txt PascalABCNET.chm System.Threading.dll SyntaxTreeConverters.dll YieldHelpers.dll
|
||||
..\utils\pkzipc\pkzipc.exe -add ..\Release\PABCNETC.zip pabcnetc.exe pabcnetcclear.exe Compiler.dll CompilerTools.dll Errors.dll Localization.dll NETGenerator.dll ParserTools.dll ICSharpCode.NRefactory.dll SemanticTree.dll SyntaxTree.dll TreeConverter.dll OptimizerConversion.dll PascalABCParser.dll licence.txt PascalABCNET.chm System.Threading.dll SyntaxTreeConverters.dll YieldHelpers.dll SyntaxVisitors.dll
|
||||
..\utils\pkzipc\pkzipc.exe -add -nozip -dir ..\Release\PABCNETC.zip Lib\*.pcu
|
||||
..\utils\pkzipc\pkzipc.exe -add -nozip -dir ..\Release\PABCNETC.zip Lng\*.dat
|
||||
..\utils\pkzipc\pkzipc.exe -add -nozip -dir ..\Release\PABCNETC.zip Lng\*.LanguageName
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.2.0.1379'
|
||||
!define VERSION '3.2.0.1381'
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
File "..\bin\SemanticTree.dll"
|
||||
File "..\bin\SyntaxTree.dll"
|
||||
File "..\bin\SyntaxTreeConverters.dll"
|
||||
File "..\bin\StandardSyntaxTreeConverter.dll"
|
||||
File "..\bin\SyntaxVisitors.dll"
|
||||
File "..\bin\YieldConversionSyntax.dll"
|
||||
File "..\bin\YieldHelpers.dll"
|
||||
|
|
@ -49,7 +48,6 @@
|
|||
${AddFile} "SemanticTree.dll"
|
||||
${AddFile} "SyntaxTree.dll"
|
||||
${AddFile} "SyntaxTreeConverters.dll"
|
||||
${AddFile} "StandardSyntaxTreeConverter.dll"
|
||||
${AddFile} "YieldHelpers.dll"
|
||||
${AddFile} "SyntaxVisitors.dll"
|
||||
${AddFile} "YieldConversionSyntax.dll"
|
||||
|
|
@ -255,8 +253,6 @@
|
|||
Call NGEN
|
||||
Push "YieldConversionSyntax.dll"
|
||||
Call NGEN
|
||||
Push "StandardSyntaxTreeConverter.dll"
|
||||
Call NGEN
|
||||
|
||||
; SetOutPath "$INSTDIR\Output"
|
||||
SectionEnd
|
||||
|
|
|
|||
|
|
@ -948,8 +948,28 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
}
|
||||
|
||||
public partial class dot_node
|
||||
{
|
||||
public static dot_node NewP(addressed_value avl, addressed_value avr, SourceContext sc)
|
||||
{
|
||||
var dn = new dot_node(avl, avr, sc);
|
||||
if (avl != null) avl.Parent = dn;
|
||||
if (avr != null) avr.Parent = dn;
|
||||
return dn;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class method_call
|
||||
{
|
||||
public static method_call NewP(addressed_value av, expression_list el, SourceContext sc)
|
||||
{
|
||||
var mc = new method_call(av, el, sc);
|
||||
if (av != null) av.Parent = mc;
|
||||
if (el != null) el.Parent = mc;
|
||||
return mc;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Простое имя метода. Возвращает null, если не удалось такое получить.
|
||||
/// </summary>
|
||||
|
|
@ -1640,6 +1660,11 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
}
|
||||
|
||||
public partial class slice_expr
|
||||
{
|
||||
public override string ToString() => this.v + "[" + this.from + ":" + this.to + ":" + this.step + "]";
|
||||
}
|
||||
|
||||
public partial class slice_expr_question
|
||||
{
|
||||
public slice_expr_question(addressed_value v, expression from, expression to, expression step) : base(v, from, to, step)
|
||||
|
|
@ -1648,5 +1673,21 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{ }
|
||||
}
|
||||
|
||||
public partial class sugared_addressed_value
|
||||
{
|
||||
public static sugared_addressed_value NewP(object sug, addressed_value av, SourceContext sc)
|
||||
{
|
||||
var res = new sugared_addressed_value(sug, av, sc);
|
||||
av.Parent = res;
|
||||
return res;
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return "{sug}" + this.new_addr_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
// Можно перенести сюда поскольку замена 1 на 1 позволяет пользоваться текущим DefaultVisit
|
||||
public void ReplaceUsingParent(syntax_tree_node from, syntax_tree_node to)
|
||||
{
|
||||
to.Parent = from.Parent;
|
||||
if (from.Parent == null)
|
||||
throw new Exception("У корневого элемента нельзя получить Parent");
|
||||
from.Parent.ReplaceDescendant(from, to);
|
||||
|
|
|
|||
|
|
@ -45,9 +45,10 @@ namespace SyntaxVisitors.SugarVisitors
|
|||
public override void visit(slice_expr sl)
|
||||
{
|
||||
var el = construct_expression_list_for_slice_expr(sl);
|
||||
var mc = new method_call(new dot_node(sl.v, new ident("SystemSlice", sl.v.source_context), sl.v.source_context), el, sl.source_context);
|
||||
// Проблема в том, что тут тоже надо перепрошивать Parent!
|
||||
var mc = method_call.NewP(dot_node.NewP(sl.v, new ident("SystemSlice", sl.v.source_context), sl.v.source_context), el, sl.source_context);
|
||||
|
||||
var sug = new sugared_addressed_value(sl, mc, sl.source_context);
|
||||
var sug = sugared_addressed_value.NewP(sl, mc, sl.source_context);
|
||||
|
||||
ReplaceUsingParent(sl, sug);
|
||||
visit(mc); // обойти заменённое на предмет наличия такого же синтаксического сахара
|
||||
|
|
|
|||
|
|
@ -1205,8 +1205,14 @@ function Odd(i: longword): boolean;
|
|||
function Odd(i: int64): boolean;
|
||||
///--
|
||||
function Odd(i: uint64): boolean;
|
||||
|
||||
// -----------------------------------------------------
|
||||
//>> Функции для работы с комплексными числами # Functions for Complex numbers
|
||||
// -----------------------------------------------------
|
||||
/// Конструирует комплексное число с вещественной частью re и мнимой частью im
|
||||
function Cplx(re,im: real): Complex;
|
||||
/// Вычисляет квадратный корень из комплексного числа
|
||||
function Sqrt(c: Complex): Complex;
|
||||
|
||||
// -----------------------------------------------------
|
||||
//>> Процедуры для работы со стандартными множествами # Subroutines for set of T
|
||||
|
|
@ -6971,6 +6977,12 @@ begin
|
|||
Result := new Complex(re,im);
|
||||
end;
|
||||
|
||||
function Sqrt(c: Complex): Complex;
|
||||
begin
|
||||
Result := Complex.Sqrt(c);
|
||||
end;
|
||||
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Dynamic arrays: implementation
|
||||
// -----------------------------------------------------
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1205,8 +1205,14 @@ function Odd(i: longword): boolean;
|
|||
function Odd(i: int64): boolean;
|
||||
///--
|
||||
function Odd(i: uint64): boolean;
|
||||
|
||||
// -----------------------------------------------------
|
||||
//>> Функции для работы с комплексными числами # Functions for Complex numbers
|
||||
// -----------------------------------------------------
|
||||
/// Конструирует комплексное число с вещественной частью re и мнимой частью im
|
||||
function Cplx(re,im: real): Complex;
|
||||
/// Вычисляет квадратный корень из комплексного числа
|
||||
function Sqrt(c: Complex): Complex;
|
||||
|
||||
// -----------------------------------------------------
|
||||
//>> Процедуры для работы со стандартными множествами # Subroutines for set of T
|
||||
|
|
@ -6971,6 +6977,12 @@ begin
|
|||
Result := new Complex(re,im);
|
||||
end;
|
||||
|
||||
function Sqrt(c: Complex): Complex;
|
||||
begin
|
||||
Result := Complex.Sqrt(c);
|
||||
end;
|
||||
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Dynamic arrays: implementation
|
||||
// -----------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue