Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
prob-teaching-notebooks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
prob-teaching-notebooks
Commits
203f5210
You need to sign in or sign up before continuing.
Commit
203f5210
authored
4 years ago
by
Chris
Browse files
Options
Downloads
Patches
Plain Diff
Jupyter Error mit sys.exit() behoben
parent
7caff8cf
No related branches found
No related tags found
1 merge request
!1
Master
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
info4/kapitel-8/Interpreter/interpreter.py
+22
-19
22 additions, 19 deletions
info4/kapitel-8/Interpreter/interpreter.py
with
22 additions
and
19 deletions
info4/kapitel-8/Interpreter/interpreter.py
+
22
−
19
View file @
203f5210
...
@@ -42,7 +42,7 @@ class ErrorHandler:
...
@@ -42,7 +42,7 @@ class ErrorHandler:
print
(
"
Variable
"
+
k
+
"
:
"
+
str
(
v
))
print
(
"
Variable
"
+
k
+
"
:
"
+
str
(
v
))
user_input
=
input
(
"
Drücke ENTER zum Fotfahren oder schreibe EXIT zum Beenden:
"
)
user_input
=
input
(
"
Drücke ENTER zum Fotfahren oder schreibe EXIT zum Beenden:
"
)
if
user_input
.
lower
()
==
'
exit
'
:
if
user_input
.
lower
()
==
'
exit
'
:
sys
.
exit
(
0
)
raise
KeyboardInterrupt
def
process_assignment
(
value_list
,
forbidden_identifiers
,
identifier_token_1
):
def
process_assignment
(
value_list
,
forbidden_identifiers
,
identifier_token_1
):
...
@@ -239,6 +239,7 @@ def next_nonempty_token(current_function, expected_token):
...
@@ -239,6 +239,7 @@ def next_nonempty_token(current_function, expected_token):
def
interpret
(
program
):
def
interpret
(
program
):
try
:
global
error_handler
,
lex
,
values
global
error_handler
,
lex
,
values
lex
=
lexer
.
Lexer
(
regex_to_token
,
program
)
lex
=
lexer
.
Lexer
(
regex_to_token
,
program
)
error_handler
=
ErrorHandler
(
program
)
error_handler
=
ErrorHandler
(
program
)
...
@@ -257,3 +258,5 @@ def interpret(program):
...
@@ -257,3 +258,5 @@ def interpret(program):
if
"
x0
"
in
values
:
if
"
x0
"
in
values
:
return
values
.
get
(
"
x0
"
)
return
values
.
get
(
"
x0
"
)
return
0
return
0
except
KeyboardInterrupt
:
return
-
1
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment