This repository has been archived by the owner on Dec 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmicroc.fsproj
81 lines (71 loc) · 2.72 KB
/
microc.fsproj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<Project Sdk="Microsoft.NET.Sdk" >
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<FsLex Include="CLex.fsl">
<OtherFlags>--module CLex --unicode</OtherFlags>
</FsLex>
<FsYacc Include="CPar.fsy">
<OtherFlags>--module CPar</OtherFlags>
</FsYacc>
<Compile Include="Absyn.fs" />
<Compile Include="Debug.fs" />
<Compile Include="CPar.fs" />
<Compile Include="CLex.fs" />
<Compile Include="Parse.fs" />
<Compile Include="Machine.fs" />
<Compile Include="Backend.fs" />
<Compile Include="Comp.fs" />
<Compile Include="microc.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FsLexYacc" Version="10.2.0" />
</ItemGroup>
<ItemGroup>
<MyItem Include="example\char.c"/>
<MyItem Include="example\float.c"/>
<MyItem Include="example\assign_dec.c"/>
<MyItem Include="example\cond_expr.c"/>
<MyItem Include="example\self_op.c"/>
<MyItem Include="example\for.c"/>
<MyItem Include="example\do_while.c"/>
<MyItem Include="example\break.c"/>
<MyItem Include="example\continue.c"/>
<MyItem Include="example\switch.c"/>
</ItemGroup>
<Target Name="ccrun">
<Exec Command="
echo -----------compile------------
dotnet run -p ./microc.fsproj -g %(MyItem.RelativeDir)%(MyItem.FileName).c
echo -------------run svm-----------
java Machine %(MyItem.RelativeDir)%(MyItem.FileName).out %(MyItem.Args)
echo %13
echo -------------run svm trace-----
java Machinetrace %(MyItem.RelativeDir)%(MyItem.FileName).out %(MyItem.Args)"
/>
</Target>
<Target Name="ccrunx86">
<Exec Command="
echo -----------compile------------
dotnet run -p ./microc.fsproj %(MyItem.RelativeDir)%(MyItem.FileName).c
echo -------assemble and link-------
nasm -f win64 -o %(MyItem.RelativeDir)%(MyItem.FileName).o %(MyItem.RelativeDir)%(MyItem.FileName).asm
echo nasm -f elf64 -o %(MyItem.RelativeDir)%(MyItem.FileName).o %(MyItem.RelativeDir)%(MyItem.FileName).asm
gcc -c driver.c
gcc -g -o %(MyItem.RelativeDir)%(MyItem.FileName).exe %(MyItem.RelativeDir)%(MyItem.FileName).o driver.o
echo -------------run x86-----------
%(MyItem.RelativeDir)%(MyItem.FileName).exe %(MyItem.Args) "
/>
</Target>
<ItemGroup>
<CleanDir Include="example\*.c"/>
</ItemGroup>
<Target Name="cclean">
<Exec Command="
echo -----------clean------------
rm %(CleanDir.RelativeDir)*.ins %(CleanDir.RelativeDir)*.insx86 %(CleanDir.RelativeDir)*.out %(CleanDir.RelativeDir)*.asm %(CleanDir.RelativeDir)*.o %(CleanDir.RelativeDir)*.obj %(CleanDir.RelativeDir)*.exe"
/>
</Target>
</Project>