Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
latte
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zygzagZ
latte
Commits
1f3906a4
Commit
1f3906a4
authored
Dec 07, 2020
by
zygzagZ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix makefile
parent
f5cf7cdc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
78 deletions
+14
-78
.gitignore
.gitignore
+1
-1
Latte.cpp
Latte.cpp
+3
-3
Makefile
Makefile
+10
-10
Test.cpp
Test.cpp
+0
-64
No files found.
.gitignore
View file @
1f3906a4
...
@@ -2,4 +2,4 @@
...
@@ -2,4 +2,4 @@
*.l
*.l
*.y
*.y
/lat/
/lat/
/TestGrammar
/latc
\ No newline at end of file
\ No newline at end of file
Latte.cpp
View file @
1f3906a4
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include "Parser.h"
#include "Parser.h"
#include "Printer.h"
#include "Printer.h"
#include "Absyn.h"
#include "Absyn.h"
#include "Compiler.h"
//
#include "Compiler.h"
#include <fstream>
#include <fstream>
#include <iostream>
#include <iostream>
#include <filesystem>
#include <filesystem>
...
@@ -63,7 +63,7 @@ int main(int argc, char ** argv)
...
@@ -63,7 +63,7 @@ int main(int argc, char ** argv)
binaryPath
=
argv
[
0
];
binaryPath
=
argv
[
0
];
std
::
filesystem
::
path
file
(
filename
?
filename
:
"Instant"
);
std
::
filesystem
::
path
file
(
filename
?
filename
:
"Instant"
);
Compiler
c
(
file
);
/*
Compiler c(file);
std::string out = c.compile(parse_tree);
std::string out = c.compile(parse_tree);
if (!filename) {
if (!filename) {
...
@@ -81,6 +81,6 @@ int main(int argc, char ** argv)
...
@@ -81,6 +81,6 @@ int main(int argc, char ** argv)
ll << out;
ll << out;
ll.close();
ll.close();
Compiler
::
externalCommand
(
file
);
Compiler::externalCommand(file);
*/
}
}
Makefile
View file @
1f3906a4
CC
=
g++
CC
=
g++
CCFLAGS
=
-g
-W
-Wall
CCFLAGS
=
-g
-W
-Wall
-O3
-std
=
c++1z
FLEX
=
flex
FLEX
=
flex
FLEX_OPTS
=
-PGrammar
FLEX_OPTS
=
-PGrammar
...
@@ -11,17 +11,17 @@ OBJS=Absyn.o Lexer.o Parser.o Printer.o
...
@@ -11,17 +11,17 @@ OBJS=Absyn.o Lexer.o Parser.o Printer.o
.PHONY
:
clean distclean
.PHONY
:
clean distclean
all
:
TestGrammar
all
:
latc
clean
:
clean
:
rm
-f
*
.o
TestGrammar
Grammar.aux Grammar.log Grammar.pdf Grammar.dvi Grammar.ps Grammar
rm
-f
*
.o
latc
Grammar.aux Grammar.log Grammar.pdf Grammar.dvi Grammar.ps Grammar
distclean
:
clean
#
distclean : clean
rm
-f
Absyn.cpp Absyn.h Test
.cpp Parser.cpp Parser.h Lexer.cpp Skeleton.cpp Skeleton.h Printer.cpp Printer.h Makefile Grammar.l Grammar.y Grammar.tex
# rm -f Absyn.cpp Absyn.h Latte
.cpp Parser.cpp Parser.h Lexer.cpp Skeleton.cpp Skeleton.h Printer.cpp Printer.h Makefile Grammar.l Grammar.y Grammar.tex
TestGrammar
:
${OBJS} Test
.o
latc
:
${OBJS} Latte
.o
@
echo
"Linking
TestGrammar
..."
@
echo
"Linking
latc
..."
${
CC
}
${
CCFLAGS
}
${
OBJS
}
Test.o
-o
TestGrammar
${
CC
}
${
CCFLAGS
}
${
OBJS
}
Latte.o
-o
latc
Absyn.o
:
Absyn.cpp Absyn.h
Absyn.o
:
Absyn.cpp Absyn.h
${
CC
}
${
CCFLAGS
}
-c
Absyn.cpp
${
CC
}
${
CCFLAGS
}
-c
Absyn.cpp
...
@@ -44,5 +44,5 @@ Printer.o : Printer.cpp Printer.h Absyn.h
...
@@ -44,5 +44,5 @@ Printer.o : Printer.cpp Printer.h Absyn.h
Skeleton.o
:
Skeleton.cpp Skeleton.h Absyn.h
Skeleton.o
:
Skeleton.cpp Skeleton.h Absyn.h
${
CC
}
${
CCFLAGS
}
-Wno-unused-parameter
-c
Skeleton.cpp
${
CC
}
${
CCFLAGS
}
-Wno-unused-parameter
-c
Skeleton.cpp
Test.o
:
Test
.cpp Parser.h Printer.h Absyn.h
Latte.o
:
Latte
.cpp Parser.h Printer.h Absyn.h
${
CC
}
${
CCFLAGS
}
-c
Test
.cpp
${
CC
}
${
CCFLAGS
}
-c
Latte
.cpp
Test.cpp
deleted
100644 → 0
View file @
f5cf7cdc
/*** Compiler Front-End Test automatically generated by the BNF Converter ***/
/* */
/* This test will parse a file, print the abstract syntax tree, and then */
/* pretty-print the result. */
/* */
/****************************************************************************/
#include <stdio.h>
#include <string.h>
#include "Parser.h"
#include "Printer.h"
#include "Absyn.h"
void
usage
()
{
printf
(
"usage: Call with one of the following argument combinations:
\n
"
);
printf
(
"
\t
--help
\t\t
Display this help message.
\n
"
);
printf
(
"
\t
(no arguments) Parse stdin verbosely.
\n
"
);
printf
(
"
\t
(files)
\t\t
Parse content of files verbosely.
\n
"
);
printf
(
"
\t
-s (files)
\t
Silent mode. Parse content of files silently.
\n
"
);
}
int
main
(
int
argc
,
char
**
argv
)
{
FILE
*
input
;
int
quiet
=
0
;
char
*
filename
=
NULL
;
if
(
argc
>
1
)
{
if
(
strcmp
(
argv
[
1
],
"-s"
)
==
0
)
{
quiet
=
1
;
if
(
argc
>
2
)
{
filename
=
argv
[
2
];
}
else
{
input
=
stdin
;
}
}
else
{
filename
=
argv
[
1
];
}
}
if
(
filename
)
{
input
=
fopen
(
filename
,
"r"
);
if
(
!
input
)
{
usage
();
exit
(
1
);
}
}
else
input
=
stdin
;
/* The default entry point is used. For other options see Parser.H */
Program
*
parse_tree
=
pProgram
(
input
);
if
(
parse_tree
)
{
printf
(
"
\n
Parse Successful!
\n
"
);
if
(
!
quiet
)
{
printf
(
"
\n
[Abstract Syntax]
\n
"
);
ShowAbsyn
*
s
=
new
ShowAbsyn
();
printf
(
"%s
\n\n
"
,
s
->
show
(
parse_tree
));
printf
(
"[Linearized Tree]
\n
"
);
PrintAbsyn
*
p
=
new
PrintAbsyn
();
printf
(
"%s
\n\n
"
,
p
->
print
(
parse_tree
));
}
return
0
;
}
return
1
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment