Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f0a944c

Browse files
authored
Add LALR from LR(0) Method to GUI
1 parent 4514ec5 commit f0a944c

15 files changed

+5613
-0
lines changed

‎InhaCC/App.config‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
5+
</startup>
6+
<appSettings>
7+
<add key="graphVizLocation" value="C:\Program Files (x86)\Graphviz2.38\bin"/>
8+
</appSettings>
9+
</configuration>

‎InhaCC/Graph.cs‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
3+
Copyright (C) 2019. rollrat All Rights Reserved.
4+
5+
Author: Jeong HyunJun
6+
7+
*/
8+
9+
using GraphVizWrapper;
10+
using GraphVizWrapper.Commands;
11+
using GraphVizWrapper.Queries;
12+
using System;
13+
using System.Collections.Generic;
14+
using System.Drawing;
15+
using System.IO;
16+
using System.Linq;
17+
using System.Text;
18+
using System.Threading.Tasks;
19+
20+
namespace InhaCC
21+
{
22+
public class Graph
23+
{
24+
public static Bitmap ToImage(string str)
25+
{
26+
var getStartProcessQuery = new GetStartProcessQuery();
27+
var getProcessStartInfoQuery = new GetProcessStartInfoQuery();
28+
var registerLayoutPluginCommand = new RegisterLayoutPluginCommand(getProcessStartInfoQuery, getStartProcessQuery);
29+
30+
var wrapper = new GraphGeneration(getStartProcessQuery,
31+
getProcessStartInfoQuery,
32+
registerLayoutPluginCommand);
33+
34+
byte[] output = wrapper.GenerateGraph(str /*"digraph{a -> b; b -> c; c -> a;}"*/, Enums.GraphReturnType.Png);
35+
36+
return ByteToImage(output);
37+
}
38+
39+
40+
private static Bitmap ByteToImage(byte[] blob)
41+
{
42+
MemoryStream mStream = new MemoryStream();
43+
byte[] pData = blob;
44+
mStream.Write(pData, 0, Convert.ToInt32(pData.Length));
45+
Bitmap bm = new Bitmap(mStream, false);
46+
mStream.Dispose();
47+
return bm;
48+
}
49+
50+
}
51+
}

‎InhaCC/InhaCC.csproj‎

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{F608DB8C-F9F1-40C1-866F-BA348E566E64}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>InhaCC</RootNamespace>
10+
<AssemblyName>InhaCC</AssemblyName>
11+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<TargetFrameworkProfile />
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
36+
<DebugSymbols>true</DebugSymbols>
37+
<OutputPath>bin\x64\Debug\</OutputPath>
38+
<DefineConstants>DEBUG;TRACE</DefineConstants>
39+
<DebugType>full</DebugType>
40+
<PlatformTarget>x64</PlatformTarget>
41+
<LangVersion>7.3</LangVersion>
42+
<ErrorReport>prompt</ErrorReport>
43+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
44+
<Prefer32Bit>true</Prefer32Bit>
45+
</PropertyGroup>
46+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
47+
<OutputPath>bin\x64\Release\</OutputPath>
48+
<DefineConstants>TRACE</DefineConstants>
49+
<Optimize>true</Optimize>
50+
<DebugType>pdbonly</DebugType>
51+
<PlatformTarget>x64</PlatformTarget>
52+
<LangVersion>7.3</LangVersion>
53+
<ErrorReport>prompt</ErrorReport>
54+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
55+
<Prefer32Bit>true</Prefer32Bit>
56+
</PropertyGroup>
57+
<ItemGroup>
58+
<Reference Include="GraphVizWrapper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
59+
<HintPath>..\packages\GraphViz.NET.1.0.0\lib\net40\GraphVizWrapper.dll</HintPath>
60+
</Reference>
61+
<Reference Include="System" />
62+
<Reference Include="System.Collections.Immutable, Version=1.0.34.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
63+
<HintPath>..\packages\Microsoft.Bcl.Immutable.1.0.34\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
64+
</Reference>
65+
<Reference Include="System.Core" />
66+
<Reference Include="System.Xml.Linq" />
67+
<Reference Include="System.Data.DataSetExtensions" />
68+
<Reference Include="Microsoft.CSharp" />
69+
<Reference Include="System.Data" />
70+
<Reference Include="System.Deployment" />
71+
<Reference Include="System.Drawing" />
72+
<Reference Include="System.Net.Http" />
73+
<Reference Include="System.Windows.Forms" />
74+
<Reference Include="System.Xml" />
75+
</ItemGroup>
76+
<ItemGroup>
77+
<Compile Include="cc\ParserGenerator.cs" />
78+
<Compile Include="cc\ScannerGenerator.cs" />
79+
<Compile Include="Graph.cs" />
80+
<Compile Include="MainForm.cs">
81+
<SubType>Form</SubType>
82+
</Compile>
83+
<Compile Include="MainForm.Designer.cs">
84+
<DependentUpon>MainForm.cs</DependentUpon>
85+
</Compile>
86+
<Compile Include="Program.cs" />
87+
<Compile Include="Properties\AssemblyInfo.cs" />
88+
<EmbeddedResource Include="MainForm.resx">
89+
<DependentUpon>MainForm.cs</DependentUpon>
90+
</EmbeddedResource>
91+
<EmbeddedResource Include="Properties\Resources.resx">
92+
<Generator>ResXFileCodeGenerator</Generator>
93+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
94+
<SubType>Designer</SubType>
95+
</EmbeddedResource>
96+
<Compile Include="Properties\Resources.Designer.cs">
97+
<AutoGen>True</AutoGen>
98+
<DependentUpon>Resources.resx</DependentUpon>
99+
<DesignTime>True</DesignTime>
100+
</Compile>
101+
<None Include="packages.config" />
102+
<None Include="Properties\Settings.settings">
103+
<Generator>SettingsSingleFileGenerator</Generator>
104+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
105+
</None>
106+
<Compile Include="Properties\Settings.Designer.cs">
107+
<AutoGen>True</AutoGen>
108+
<DependentUpon>Settings.settings</DependentUpon>
109+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
110+
</Compile>
111+
</ItemGroup>
112+
<ItemGroup>
113+
<None Include="App.config" />
114+
</ItemGroup>
115+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
116+
</Project>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /