Skip to content
This repository has been archived by the owner on Jul 26, 2018. It is now read-only.

Refactor VisualStudio project #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 161 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,164 @@
greg
greg.exe
samples/*.leg.c


# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app


# Compiled #
############
*.com
*.class
*.dll
*.dylib
*.exe
*.slo
*.lo
*.o
*.so
*.lai
*.la
*.a
*.d


# Make #
########
config.build
config.make
*.cache/**


# autogenerated make from CDT #
##############################
subdir.mk
objects.mk
sources.mk
makefile
Makefile
Makefile.in
aclocal.m4
configure
config.h
config.status


# CMake #
########
cmake_install.cmake
cmake_uninstall.cmake
CMakeFiles
CMakeCache.txt
CPackConfig.cmake
CPackSourceConfig.cmake


# Logs and databases #
######################
*.log*
*.sqlite
*.db



# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
*~

# VS generated files #
######################
.vs/
*.opendb
*.bsc
*.sbr
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.ipch
*.ncb
*.suo
*.sdf
*.opensdf
*.tlb
*.tlh
*.ilk
*.lib
*.exp
*.idb
*.rc
*.res
*.manifest
*.tlog
*.lastbuildstate
*.iobj
*.ipdb
*.unsuccessfulbuild
*nativecodeanalysis*
*codeanalysis*


# Eclipse generated files #
###########################
#.project
#.cproject
.settings
cmake-build/
.metadata/
RemoteSystemsTempFiles/

# Eclipse Maven m2e generated files #
#####################################
**/target/


# Temporary files #
###################
*.bak


# Eclipse generated class directory #
#####################################
/cls

# makedep dependencies files #
##############################
**/.deps/
11 changes: 5 additions & 6 deletions MSVC/calc/calc.vcxproj → msvc/calc/calc.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
Expand All @@ -14,18 +14,19 @@
<ProjectGuid>{607AA625-3E9D-4691-B9A5-9BDBB4620AF1}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>calc</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand All @@ -41,6 +42,7 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetName>$(ProjectName)d</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
Expand Down Expand Up @@ -79,9 +81,6 @@
<None Include="..\..\samples\calc.leg" />
<None Include="..\..\samples\calc.ref" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\samples\calc.leg.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,4 @@
<None Include="..\..\samples\calc.leg" />
<None Include="..\..\samples\calc.ref" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\samples\calc.leg.c">
<Filter>Fichiers sources</Filter>
</ClCompile>
</ItemGroup>
</Project>
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion MSVC/greg-vs120.sln → msvc/greg-vs140.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "greg", "greg-vs120.vcxproj", "{DE253F1D-68B4-4A2B-A6FD-1A7176934DD1}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "greg", "greg-vs140.vcxproj", "{DE253F1D-68B4-4A2B-A6FD-1A7176934DD1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "calc", "calc\calc.vcxproj", "{607AA625-3E9D-4691-B9A5-9BDBB4620AF1}"
EndProject
Expand Down
6 changes: 3 additions & 3 deletions MSVC/greg-vs120.vcxproj → msvc/greg-vs140.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
Expand All @@ -20,13 +20,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down
24 changes: 12 additions & 12 deletions samples/calc.leg
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ int vars[26];
%}

Stmt = - e:Expr EOL { printf("%d\n", e); }
| ( !EOL . )* EOL { printf("error\n"); }
| ( !EOL . )* EOL { printf("error\n"); }

Expr = i:ID ASSIGN s:Sum { $$= vars[i]= s; }
| s:Sum { $$= s; }
| s:Sum { $$= s; }

Sum = l:Product
( PLUS r:Product { l += r; }
| MINUS r:Product { l -= r; }
)* { $$= l; }
( PLUS r:Product { l += r; }
| MINUS r:Product { l -= r; }
)* { $$= l; }

Product = l:Value
( TIMES r:Value { l *= r; }
| DIVIDE r:Value { l /= r; }
)* { $$= l; }
( TIMES r:Value { l *= r; }
| DIVIDE r:Value { l /= r; }
)* { $$= l; }

Value = i:NUMBER { $$= atoi(yytext); }
| i:ID !ASSIGN { $$= vars[i]; }
| OPEN i:Expr CLOSE { $$= i; }
Value = i:NUMBER { $$= atoi(yytext); }
| i:ID !ASSIGN { $$= vars[i]; }
| OPEN i:Expr CLOSE { $$= i; }

NUMBER = < [0-9]+ > - { $$= atoi(yytext); }
ID = < [a-z] > - { $$= yytext[0] - 'a'; }
ID = < [a-z] > - { $$= yytext[0] - 'a'; }
ASSIGN = '=' -
PLUS = '+' -
MINUS = '-' -
Expand Down