diff --git a/.vs/Supercharger/Tiger/codemap.dat b/.vs/Supercharger/Tiger/codemap.dat new file mode 100644 index 0000000..8a2c280 --- /dev/null +++ b/.vs/Supercharger/Tiger/codemap.dat @@ -0,0 +1 @@ +Program.csProgram.csProgram.csProgram.csProgram.csProgram.csProgram.cs3615Program#Main12023-09-06T08:41:47.5530823+02:000string[]Program.csProgram.csProgram.csProgram.csProgram.csTiger \ No newline at end of file diff --git a/.vs/Supercharger/Tiger/global_history.dat b/.vs/Supercharger/Tiger/global_history.dat new file mode 100644 index 0000000..eec6e76 --- /dev/null +++ b/.vs/Supercharger/Tiger/global_history.dat @@ -0,0 +1 @@ +D:\yatc\YATC.Compiler\Program.csYATC.Compiler.Program.Mainstatic##int#string[]img\tvi\x_method-s_private-i_staticfalsefalseMainYATC.Compiler.ProgramD:\yatc\YATC.Compiler\Tiger.csprojD:\yatc\YATC.Compiler\Program.cs2023-09-06T08:43:08.8339312+02:00YATC.Compiler.Program.Printstatic##void#CommonTreeimg\tvi\x_method-s_private-i_staticfalsefalsePrintYATC.Compiler.ProgramD:\yatc\YATC.Compiler\Tiger.csprojD:\yatc\YATC.Compiler\Program.cs2023-09-06T08:43:02.6982502+02:00D:\yatc\YATC.Compiler\Program.csTiger \ No newline at end of file diff --git a/.vs/Supercharger/Tiger/workbench.dat b/.vs/Supercharger/Tiger/workbench.dat new file mode 100644 index 0000000..be43d93 --- /dev/null +++ b/.vs/Supercharger/Tiger/workbench.dat @@ -0,0 +1 @@ +Tiger \ No newline at end of file diff --git a/.vs/Supercharger/YATC/codemap.dat b/.vs/Supercharger/YATC/codemap.dat new file mode 100644 index 0000000..64d6015 --- /dev/null +++ b/.vs/Supercharger/YATC/codemap.dat @@ -0,0 +1 @@ +D:\yatc\Grammar\tigerLexer.csD:\yatc\Grammar\tigerLexer.csD:\yatc\Grammar\tigerParser.csD:\yatc\Grammar\tigerParser.csASTNodes\ProgramNode.csASTNodes\ProgramNode.csD:\yatc\Grammar\tigerLexer.cstigerLexer#DFAfalseD:\yatc\Grammar\tigerLexer.csD:\yatc\Grammar\tigerParser.csD:\yatc\Grammar\tigerParser.csASTNodes\ProgramNode.csASTNodes\ProgramNode.csD:\yatc\Grammar\tigerLexer.csD:\yatc\Grammar\tigerLexer.csD:\yatc\Grammar\tigerParser.csD:\yatc\Grammar\tigerParser.csASTNodes\ProgramNode.csASTNodes\ProgramNode.csD:\yatc\Grammar\tigerLexer.cs342tigerLexer#mFUNCTIONKEY12023-09-06T09:54:00.6943386+02:000D:\yatc\Grammar\tigerLexer.csD:\yatc\Grammar\tigerParser.csD:\yatc\Grammar\tigerParser.csASTNodes\ProgramNode.csASTNodes\ProgramNode.csD:\yatc\Grammar\tigerLexer.csD:\yatc\Grammar\tigerLexer.csD:\yatc\Grammar\tigerParser.csD:\yatc\Grammar\tigerParser.csASTNodes\ProgramNode.csASTNodes\ProgramNode.csD:\yatc\Grammar\tigerLexer.csD:\yatc\Grammar\tigerLexer.csD:\yatc\Grammar\tigerParser.csD:\yatc\Grammar\tigerParser.csASTNodes\ProgramNode.csASTNodes\ProgramNode.csYATC \ No newline at end of file diff --git a/.vs/Supercharger/YATC/global_history.dat b/.vs/Supercharger/YATC/global_history.dat new file mode 100644 index 0000000..d4f954a --- /dev/null +++ b/.vs/Supercharger/YATC/global_history.dat @@ -0,0 +1 @@ +D:\yatc\Grammar\tigerLexer.csYATC.Grammar.tigerLexer.mFUNCTIONKEY#void#img\tvi\x_method-s_private-i_instancefalsefalsemFUNCTIONKEYYATC.Grammar.tigerLexerD:\yatc\YATC\YATC.csprojD:\yatc\Grammar\tigerLexer.cs2023-09-06T09:21:05.7326172+02:00D:\yatc\Grammar\tigerLexer.csD:\yatc\Grammar\tigerParser.csYATC.Grammar.tigerParser.GrammarFileNameimg\tvi\x_property_override-s_public-i_instancefalsetrueGrammarFileNameYATC.Grammar.tigerParserD:\yatc\YATC\YATC.csprojD:\yatc\Grammar\tigerParser.cs2023-09-06T08:56:49.7403958+02:00D:\yatc\Grammar\tigerParser.csD:\yatc\YATC\ASTNodes\ProgramNode.csYATC.ASTNodes.ProgramNode.AddStdLib#void#img\tvi\x_method-s_private-i_instancefalsefalseAddStdLibYATC.ASTNodes.ProgramNodeD:\yatc\YATC\YATC.csprojD:\yatc\YATC\ASTNodes\ProgramNode.cs2023-09-06T08:56:15.8291369+02:00YATC.ASTNodes.ProgramNodeimg\tvi\y_class-s_public-i_instancefalsefalseProgramNodeYATC.ASTNodesD:\yatc\YATC\YATC.csprojD:\yatc\YATC\ASTNodes\ProgramNode.cs2023-09-06T08:55:41.7786924+02:00D:\yatc\YATC\ASTNodes\ProgramNode.csYATC \ No newline at end of file diff --git a/.vs/Supercharger/YATC/workbench.dat b/.vs/Supercharger/YATC/workbench.dat new file mode 100644 index 0000000..24a6f26 --- /dev/null +++ b/.vs/Supercharger/YATC/workbench.dat @@ -0,0 +1 @@ +YATC \ No newline at end of file diff --git a/.vs/Supercharger/_/DTabsHistory.dat b/.vs/Supercharger/_/DTabsHistory.dat new file mode 100644 index 0000000..0e640cc --- /dev/null +++ b/.vs/Supercharger/_/DTabsHistory.dat @@ -0,0 +1 @@ +D:0:0:{00000000-0000-0000-0000-000000000000}|<Solution>|Tiger||{95501C48-A850-47C1-A785-2AAA96637F81}D:0:0:{8B1FA297-B497-4F06-A6AE-87D73920AA57}|YATC.Compiler\Tiger.csproj|d:\yatc\yatc.compiler\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674} \ No newline at end of file diff --git a/.vs/YATC/FileContentIndex/3f07f1cc-4685-4b0d-9adc-b87b13487c2b.vsidx b/.vs/YATC/FileContentIndex/3f07f1cc-4685-4b0d-9adc-b87b13487c2b.vsidx new file mode 100644 index 0000000..490bb3d Binary files /dev/null and b/.vs/YATC/FileContentIndex/3f07f1cc-4685-4b0d-9adc-b87b13487c2b.vsidx differ diff --git a/.vs/YATC/FileContentIndex/acd5c18f-c380-4d13-bbff-b4bf68025f6d.vsidx b/.vs/YATC/FileContentIndex/acd5c18f-c380-4d13-bbff-b4bf68025f6d.vsidx new file mode 100644 index 0000000..736fda1 Binary files /dev/null and b/.vs/YATC/FileContentIndex/acd5c18f-c380-4d13-bbff-b4bf68025f6d.vsidx differ diff --git a/.vs/YATC/FileContentIndex/efc3d55b-f639-4562-b98d-3976465a80d7.vsidx b/.vs/YATC/FileContentIndex/efc3d55b-f639-4562-b98d-3976465a80d7.vsidx new file mode 100644 index 0000000..3431e4a Binary files /dev/null and b/.vs/YATC/FileContentIndex/efc3d55b-f639-4562-b98d-3976465a80d7.vsidx differ diff --git a/YATC.Compiler/Tiger.csproj b/YATC.Compiler/Tiger.csproj index a7e4f49..45dc371 100644 --- a/YATC.Compiler/Tiger.csproj +++ b/YATC.Compiler/Tiger.csproj @@ -11,6 +11,8 @@ tiger v4.5 512 + + AnyCPU @@ -32,8 +34,8 @@ 4 - - ..\Antlr3.Runtime.dll + + ..\packages\Antlr3.Runtime.3.5.1\lib\net40-client\Antlr3.Runtime.dll @@ -49,6 +51,7 @@ + diff --git a/YATC.Compiler/packages.config b/YATC.Compiler/packages.config new file mode 100644 index 0000000..9035c0e --- /dev/null +++ b/YATC.Compiler/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/YATC/YATC.csproj b/YATC/YATC.csproj index 9a13653..a003f3a 100644 --- a/YATC/YATC.csproj +++ b/YATC/YATC.csproj @@ -31,8 +31,8 @@ 4 - - ..\Antlr3.Runtime.dll + + ..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll @@ -134,6 +134,9 @@ YATC.Grammar + + + + + + MSBuild + 3.3.0.7239 + eb42632606e9261f + AntlrBuildTask, Version=$(TaskVersion), Culture=neutral, PublicKeyToken=$(TaskKeyToken) + + + + + + $(MSBuildBinPath) + $(AntlrBuildTaskPath) + $(MSBuildBinPath)\Antlr3\Antlr3.exe + $(AntlrToolPath) + + + + $(MSBuildProjectFile).AntlrGeneratedCodeFileListAbsolute.txt + + + + + + + + AntlrCompile; + AntlrCompileAddFilesGenerated; + $(PrepareResourcesDependsOn) + + + + + + AntlrCompileReadGeneratedFileList + + + + + + + + + + + + + + + + + + + DesignTimeGrammarCompilation; + $(CoreCompileDependsOn) + + + + + + + + + + + + + + + + <_IntellisenseOnlyCompile>false + <_IntellisenseOnlyCompile Condition="'$(BuildingProject)' != 'true'">true + + + + + + + + + + + + + + + + + + <_AntlrCodeGenFileWrites Condition="'@(AntlrGeneratedCodeFiles)' != ''" Include="@(AntlrGeneratedCodeFiles)" /> + <_AntlrCodeGenFileWrites Condition="'@(AntlrGeneratedCodeFiles)' == ''" Include="@(AntlrOutputCodeFilesList)" /> + + + + + + + + diff --git a/packages/Antlr34.3.4.19004.1/tools/Antlr4.StringTemplate.Visualizer.dll b/packages/Antlr34.3.4.19004.1/tools/Antlr4.StringTemplate.Visualizer.dll new file mode 100644 index 0000000..ba49dbc Binary files /dev/null and b/packages/Antlr34.3.4.19004.1/tools/Antlr4.StringTemplate.Visualizer.dll differ diff --git a/packages/Antlr34.3.4.19004.1/tools/Antlr4.StringTemplate.dll b/packages/Antlr34.3.4.19004.1/tools/Antlr4.StringTemplate.dll new file mode 100644 index 0000000..e24622e Binary files /dev/null and b/packages/Antlr34.3.4.19004.1/tools/Antlr4.StringTemplate.dll differ diff --git a/packages/Antlr34.3.4.19004.1/tools/AntlrBuildTask.dll b/packages/Antlr34.3.4.19004.1/tools/AntlrBuildTask.dll new file mode 100644 index 0000000..7be3707 Binary files /dev/null and b/packages/Antlr34.3.4.19004.1/tools/AntlrBuildTask.dll differ diff --git a/packages/Antlr34.3.4.19004.1/tools/Codegen/Templates/CSharp2/AST.stg b/packages/Antlr34.3.4.19004.1/tools/Codegen/Templates/CSharp2/AST.stg new file mode 100644 index 0000000..a898b69 --- /dev/null +++ b/packages/Antlr34.3.4.19004.1/tools/Codegen/Templates/CSharp2/AST.stg @@ -0,0 +1,430 @@ +/* + * [The "BSD license"] + * Copyright (c) 2007-2008 Johannes Luber + * Copyright (c) 2005-2007 Kunle Odutola + * Copyright (c) 2011 Sam Harwell + * Copyright (c) 2011 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +@outputFile.imports() ::= << +<@super.imports()> + + + +using Antlr.Runtime.Tree; +using RewriteRuleITokenStream = Antlr.Runtime.Tree.RewriteRuleTokenStream; + +>> + +@genericParser.members() ::= << +<@super.members()> + +>> + +parserCtorBody() ::= <% +<\n> +TreeAdaptor = + + + + new () + +; +%> + +/** Add an adaptor property that knows how to build trees */ +parserMembers() ::= << +private adaptor; + +public TreeAdaptor +{ + get + { + return adaptor; + } + + set + { + this.adaptor = value; + .TreeAdaptor = this.adaptor;}> + } +} +>> + +treeAdaptorType() ::= << + +>> + +ruleReturnBaseType() ::= <% +AstTreeParserRuleReturnScope\<, > +%> + +/** Add a variable to track rule's return AST */ +ruleDeclarations() ::= << + + root_0 = default();<\n> +>> + +ruleLabelDefs() ::= << + +<[ruleDescriptor.tokenLabels,ruleDescriptor.wildcardTreeLabels,ruleDescriptor.wildcardTreeListLabels] + :{it| _tree = default();}; separator="\n"> + _tree = default();}; separator="\n"> +Stream stream_=new RewriteRuleStream(adaptor,"token ");}; separator="\n"> +=new RewriteRuleSubtreeStream(adaptor,"rule ");}; separator="\n"> +>> + +/** When doing auto AST construction, we must define some variables; + * These should be turned off if doing rewrites. This must be a "mode" + * as a rule could have both rewrite and AST within the same alternative + * block. + */ +@alt.declarations() ::= << + + + +root_0 = ()adaptor.Nil(); + + + +>> + +// T r a c k i n g R u l e E l e m e n t s + +/** ID and track it for use in a rewrite rule */ +tokenRefTrack(token,label,elementIndex,terminalOptions) ::= << + +if () stream_.Add(