Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
Nachhaltige Informationstechnologie
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Gerwinski
Nachhaltige Informationstechnologie
Commits
fec0a34e
Commit
fec0a34e
authored
May 6, 2024
by
Peter Gerwinski
Browse files
Options
Downloads
Patches
Plain Diff
Notizen und Beispiele 6.5.2024
parent
9ea79600
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
20240506/nit-20240506.txt
+25
-0
25 additions, 0 deletions
20240506/nit-20240506.txt
20240506/parse.tab.c
+2136
-0
2136 additions, 0 deletions
20240506/parse.tab.c
20240506/parse.y
+350
-0
350 additions, 0 deletions
20240506/parse.y
with
2511 additions
and
0 deletions
20240506/nit-20240506.txt
+
25
−
0
View file @
fec0a34e
...
@@ -43,3 +43,28 @@ Problem: Hohe RAM- und CPU-Last auf cassini
...
@@ -43,3 +43,28 @@ Problem: Hohe RAM- und CPU-Last auf cassini
- Wofür steht "Installation"?
- Wofür steht "Installation"?
Vorschlag: Administrator-Rechte erforderlich
Vorschlag: Administrator-Rechte erforderlich
--> PULT weiterhin nutzbar
--> PULT weiterhin nutzbar
06.05.2024, 12:06:11
~~~~~~~~~~~~~~~~~~~~
Blick von außen:
- Bei BBB ist die Bildqualität minimal schlechter als bei VNC.
- Die Tonqualität ist ungefähr gleich.
Bei BBB gibt es gelegentlich Schwankungen im Ton. (?)
--> Bei übertragenem Bildschirm im Vollbildmodus sind BBB und VNC gleichwertig.
Die Tonqualität ist ebenfalls gleichwertig.
Esoterische Programmiersprachen, 06.05.2024, 12:31:41
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fragestellung: Wie lesbar muß ein Quelltext sein,
damit die Software noch als Open Source gilt?
Brainfuck - esoterische Programmiersprache
--> In der theoretischen Informatik gibt es ähnlich "gut" lesbare mathematische Modelle
von Programmiersprachen. Anwendung: Beweis von Berechenbarkeit und/oder Sicherheit
Ook! - Brainfuck-Dialekt
Malbolge - Befehle sind verschlüsselt
INTERCAL - hat ein "COME FROM"
This diff is collapsed.
Click to expand it.
20240506/parse.tab.c
0 → 100644
+
2136
−
0
View file @
fec0a34e
This diff is collapsed.
Click to expand it.
20240506/parse.y
0 → 100644
+
350
−
0
View file @
fec0a34e
/* Parser for Class Schedule
Copyright 2012 Peter Gerwinski <http://www.peter.gerwinski.de>
This program is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
%{
#define YYLTYPE_IS_TRIVIAL 1
#define YYENABLE_NLS 0
static inline void yyerror (TLessonPlan *lpn, yyscan_t, const char *Message)
{
lpn->Error (Message);
}
%}
%pure-parser
%lex-param { TLessonPlan *lpn }
%parse-param { TLessonPlan *lpn }
%lex-param { yyscan_t yyscanner }
%parse-param { yyscan_t yyscanner }
%union {
char *CString;
int Integer;
TReal Real;
TString *String;
TFlightPhase *FlightPhase;
TParameterList *ParameterList;
TType ParameterType;
TExprList *ExprList;
TExpr *Expr;
TActionList *ActionList;
TAction *Action;
TStatementList *StatementList;
TStatement *Statement;
TBinaryOp BinaryOp;
TUnaryOp UnaryOp;
}
%token LEX_ASSIGN LEX_RATE LEX_FADE LEX_SMOOTH LEX_T
%token LEX_SEND LEX_STATE LEX_LABEL LEX_WAYPOINT LEX_JUMP
%token LEX_PHASE LEX_RETURN
%token LEX_WHILE LEX_DO LEX_ENDWHILE
%token LEX_IF LEX_THEN LEX_ELSE LEX_ENDIF
%token LEX_INTEGER LEX_REAL LEX_STRING
%token LEX_EQ LEX_NE LEX_LE LEX_GE LEX_SHL LEX_SHR LEX_AND LEX_OR LEX_XOR
%token <CString> LEX_NAME
%token <Integer> LEX_INTEGER_CONSTANT
%token <Real> LEX_REAL_CONSTANT
%token <String> LEX_STRING_CONSTANT
%type <FlightPhase> phase_declaration
%type <ParameterList> optional_formal_parameter_list formal_parameter_list
%type <ParameterType> type_name
%type <ExprList> optional_actual_parameter_list actual_parameter_list
%type <Expr> time_specification integer_expr real_expr
expr expr1 expr2 expr3 expr4 expr5 expr6 expr7
%type <ActionList> action_list
%type <Action> action
%type <StatementList> statement_block statement_sequence_list statement_list
%type <Statement> statement
%type <BinaryOp> or_op and_op rel_op add_op mult_op shift_op
%type <UnaryOp> unary_add_op unary_not_op
%%
lesson_component_list:
// empty
| lesson_component_list lesson_component
;
lesson_component:
constant_declaration ';'
| state_declaration ';'
| phase_declaration ';'
{ lpn->AddFlightPhase ($1); }
| action
{ lpn->AddAction ($1); }
;
constant_declaration:
LEX_NAME LEX_ASSIGN expr
{ lpn->DeclareConstant ($1, $3); free ($1); }
;
state_declaration:
LEX_STATE LEX_NAME
{ lpn->AddStateDeclaration ($2); free ($2); }
| state_declaration ',' LEX_NAME
{ lpn->AddStateDeclaration ($3); free ($3); }
;
phase_declaration:
LEX_PHASE LEX_NAME optional_formal_parameter_list
{ lpn->CurrentFormalParameters = $3; }
statement_block
{ lpn->CurrentFormalParameters = nullptr; $$ = new TFlightPhase ($2, $3, $5); free ($2); }
;
optional_formal_parameter_list:
// empty
{ $$ = nullptr; }
| '(' formal_parameter_list ')'
{ $$ = $2; }
;
formal_parameter_list:
// empty
{ $$ = nullptr; }
| type_name LEX_NAME
{ $$ = AppendParameterList (nullptr, $2, $1); free ($2); }
| formal_parameter_list ',' type_name LEX_NAME
{ $$ = AppendParameterList ($1, $4, $3); free ($4); }
;
type_name:
LEX_INTEGER
{ $$ = tt_Integer; }
| LEX_REAL
{ $$ = tt_Real; }
| LEX_STRING
{ $$ = tt_String; }
;
action_list:
// empty
{ $$ = new TActionList; }
| action_list action
{
$$ = $1;
$$->push_back (*$2);
delete $2;
}
;
action:
LEX_NAME optional_actual_parameter_list ';'
{ $$ = lpn->MakeFlyAction ($1, $2); free ($1); }
| LEX_NAME optional_actual_parameter_list '+' statement_block ';'
{ $$ = lpn->MakeFlyAction ($1, $2, $4); free ($1); }
| LEX_WHILE LEX_NAME LEX_DO action_list LEX_ENDWHILE
{ $$ = new TAction (atWhile, $2, $4); free ($2); }
| LEX_IF LEX_NAME LEX_THEN action_list LEX_ENDIF
{ $$ = new TAction (atIf, $2, $4); free ($2); }
| LEX_IF LEX_NAME LEX_THEN action_list LEX_ELSE action_list LEX_ENDIF
{ $$ = new TAction (atIf, $2, $4, $6); free ($2); }
;
statement_block:
'{' statement_sequence_list '}'
{ $$ = $2; }
;
statement_sequence_list:
// empty
{ $$ = new TStatementList; }
| statement_sequence_list time_specification statement_list
{ $$ = $1->Splice ($2, $3); }
;
time_specification:
'@' real_expr ':'
{ $$ = $2; }
| '@' LEX_T LEX_EQ real_expr ':'
{ $$ = $4; }
;
statement_list:
// empty
{ $$ = new TStatementList; }
| statement_list statement
{
$$ = $1;
$$->push_back (*$2);
delete $2;
}
;
statement:
LEX_NAME optional_actual_parameter_list ';'
{ $$ = lpn->MakePhaseCallStatement ($1, $2); free ($1); }
| LEX_NAME '=' real_expr ';'
{ $$ = new TStatement (stAssignment, $1, false, $3); free ($1); }
| LEX_NAME '=' real_expr LEX_FADE real_expr ';'
{ $$ = new TStatement (stAssignment, $1, false, $3, $5); free ($1); }
| LEX_NAME '=' real_expr LEX_FADE real_expr LEX_SMOOTH real_expr ';'
{ $$ = new TStatement (stAssignment, $1, false, $3, $5, $7); free ($1); }
| LEX_RATE LEX_NAME '=' real_expr ';'
{ $$ = new TStatement (stAssignment, $2, true, $4); free ($2); }
| LEX_RATE LEX_NAME '=' real_expr LEX_FADE real_expr ';'
{ $$ = new TStatement (stAssignment, $2, true, $4, $6); free ($2); }
| LEX_RATE LEX_NAME '=' real_expr LEX_FADE real_expr LEX_SMOOTH real_expr ';'
{ $$ = new TStatement (stAssignment, $2, true, $4, $6, $8); free ($2); }
| LEX_SEND LEX_NAME '=' integer_expr ';'
{ $$ = new TStatement (stSendEvent, $2, false, $4); free ($2); }
| LEX_STATE LEX_NAME '=' integer_expr ';'
{ $$ = new TStatement (stStateEvent, $2, false, $4); free ($2); }
| LEX_LABEL LEX_NAME '=' expr ';'
{ $$ = new TStatement (stLabel, $2, false, $4); free ($2); }
| LEX_WAYPOINT real_expr ',' real_expr ';'
{ $$ = new TStatement (stWayPoint, "", false, $2, $4); }
| LEX_JUMP ';'
{ $$ = new TStatement (stJump); }
| LEX_JUMP LEX_SMOOTH ';'
{ $$ = new TStatement (stJump, "", true, new TExprConstant (100.0)); }
| LEX_JUMP LEX_SMOOTH real_expr ';'
{ $$ = new TStatement (stJump, "", true, $3); }
| LEX_RETURN ';'
{ $$ = new TStatement (stReturn); }
;
optional_actual_parameter_list:
// empty
{ $$ = nullptr; }
| '(' actual_parameter_list ')'
{ $$ = $2; }
;
actual_parameter_list:
// empty
{ $$ = nullptr; }
| expr
{ $$ = AppendExprList (nullptr, $1); }
| actual_parameter_list ',' expr
{ $$ = AppendExprList ($1, $3); }
;
integer_expr:
expr
{
if (!($$ = $1)->TypeCheck (tt_Integer))
lpn->Error ("integer value expected");
}
;
real_expr:
expr
{
if (!($$ = $1)->TypeCheck (tt_Real))
lpn->Error ("numeric value expected");
}
;
expr:
expr1
| expr1 '?' expr ':' expr { $$ = new TExprIf (lpn, $1, $3, $5); }
;
expr1:
expr2
| expr1 or_op expr2 { $$ = new TExprBinary (lpn, $1, $2, $3); }
;
expr2:
expr3
| expr2 and_op expr3 { $$ = new TExprBinary (lpn, $1, $2, $3); }
;
expr3:
expr4
| expr4 rel_op expr4 { $$ = new TExprBinary (lpn, $1, $2, $3); }
;
expr4:
expr5
| unary_add_op expr5 { $$ = new TExprUnary (lpn, $1, $2); }
| expr4 add_op expr5 { $$ = new TExprBinary (lpn, $1, $2, $3); }
;
expr5:
expr6
| expr5 mult_op expr6 { $$ = new TExprBinary (lpn, $1, $2, $3); }
;
expr6:
expr7
| expr6 shift_op expr7 { $$ = new TExprBinary (lpn, $1, $2, $3); }
;
expr7:
'(' expr ')' { $$ = $2; }
| unary_not_op expr7 { $$ = new TExprUnary (lpn, $1, $2); }
| LEX_NAME { $$ = lpn->MakeExprIdentifier ($1); free ($1); }
| LEX_INTEGER_CONSTANT { $$ = new TExprConstant ($1); }
| LEX_REAL_CONSTANT { $$ = new TExprConstant ($1); }
| LEX_STRING_CONSTANT { $$ = new TExprConstant ($1); }
;
or_op:
LEX_OR { $$ = bo_Or; }
| '|' { $$ = bo_BitOr; }
| LEX_XOR { $$ = bo_XOr; }
| '^' { $$ = bo_BitXOr; }
;
and_op:
LEX_AND { $$ = bo_And; }
| '&' { $$ = bo_BitAnd; }
;
rel_op:
LEX_EQ { $$ = bo_EQ; }
| LEX_NE { $$ = bo_NE; }
| '<' { $$ = bo_LT; }
| '>' { $$ = bo_GT; }
| LEX_LE { $$ = bo_LE; }
| LEX_GE { $$ = bo_GE; }
;
add_op:
'+' { $$ = bo_Add; }
| '-' { $$ = bo_Subtract; }
;
unary_add_op:
'+' { $$ = uo_Plus; }
| '-' { $$ = uo_Minus; }
;
mult_op:
'*' { $$ = bo_Multiply; }
| '/' { $$ = bo_Divide; }
| '%' { $$ = bo_Modulo; }
;
shift_op:
LEX_SHL { $$ = bo_ShL; }
| LEX_SHR { $$ = bo_ShR; }
;
unary_not_op:
'!' { $$ = uo_Not; }
| '~' { $$ = uo_BitNot; }
;
%%
}
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