Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Shen, Siran
wacc
Commits
3b7cb2dd
Commit
3b7cb2dd
authored
Mar 17, 2021
by
徐世桐
Browse files
sx119: delete feature of import a standard library
parent
9ff7e162
Changes
2
Show whitespace changes
Inline
Side-by-side
antlr_config/WACCParser.g4
View file @
3b7cb2dd
...
...
@@ -12,9 +12,7 @@ func : type IDENT OPEN_PARENTHESES param_list? CLOSE_PARENTHESES IS stat
param_list : param (COMMA param )* ;
param : type IDENT;
import_file : IMPORT FILE_NAME # ImportUserDefine // import example.hwacc
| IMPORT '<' FILE_NAME '>' # ImportSTDFile// import <FILE_FROM_LIB.hwacc>
;
import_file : IMPORT FILE_NAME;
stat : skp #StatSkipStat // This visitor will be replaced by #SkipStat
...
...
src/frontend/SemanticChecker.java
View file @
3b7cb2dd
...
...
@@ -50,7 +50,6 @@ public class SemanticChecker extends WACCParserBaseVisitor<Node> {
/* where the compiling file lives, used for determine include file */
private
String
path
;
private
final
String
STD_PATH
=
"lib/waccLib/"
;
/* recording the current SymbolTable during parser tree visits */
private
SymbolTable
currSymbolTable
;
...
...
@@ -240,16 +239,11 @@ public class SemanticChecker extends WACCParserBaseVisitor<Node> {
}
@Override
public
Node
visitImport
UserDe
fi
n
e
(
Import
UserDe
fi
n
eContext
ctx
)
{
public
Node
visitImport
_
fi
l
e
(
Import
_
fi
l
eContext
ctx
)
{
visitImport
(
ctx
,
path
+
ctx
.
FILE_NAME
().
getText
());
return
null
;
}
@Override
public
Node
visitImportSTDFile
(
ImportSTDFileContext
ctx
)
{
visitImport
(
ctx
,
STD_PATH
+
ctx
.
FILE_NAME
().
getText
());
return
null
;
}
public
void
visitImport
(
ParserRuleContext
ctx
,
String
importFile
)
{
/* detect circular import */
...
...
Write
Preview
Supports
Markdown
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