Case sensitivity/insensitivity

Peter Schneider-Kamp petersc at stud.ntnu.no
Mon May 22 13:09:22 EDT 2000


Peter Schneider-Kamp wrote:
> 
> I would be okay with internationalized grammars so I can compile a
> German version of the interpreter (maybe called wuerge_schlange).

There seem to be some difficulties with replacing identifiers
by multiple words. (saa lenge som instead of while etc.).

Just for fun a German grammar attached.

it's-all-about-fun-ly y'rs Peter
--
Peter Schneider-Kamp          ++47-7388-7331
Herman Krags veg 51-11        mailto:peter at schneider-kamp.de
N-7050 Trondheim              http://schneider-kamp.de
-------------- next part --------------
*** Grammar	Mon May 22 19:05:16 2000
--- Grammar.german	Mon May 22 19:04:58 2000
***************
*** 33,71 ****
  small_stmt: expr_stmt | print_stmt  | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt | assert_stmt
  expr_stmt: testlist ('=' testlist)*
  # For assignments, additional restrictions enforced by the interpreter
! print_stmt: 'print' (test ',')* [test]
! del_stmt: 'del' exprlist
! pass_stmt: 'pass'
  flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt
! break_stmt: 'break'
  continue_stmt: 'continue'
! return_stmt: 'return' [testlist]
! raise_stmt: 'raise' [test [',' test [',' test]]]
! import_stmt: 'import' dotted_name (',' dotted_name)* | 'from' dotted_name 'import' ('*' | NAME (',' NAME)*)
  dotted_name: NAME ('.' NAME)*
  global_stmt: 'global' NAME (',' NAME)*
  #access_stmt: 'access' ('*' | NAME (',' NAME)*) ':' accesstype  (',' accesstype)*
  #accesstype: NAME+
  ## accesstype should be ('public' | 'protected' | 'private') ['read'] ['write']
  ## but can't be because that would create undesirable reserved words!
! exec_stmt: 'exec' expr ['in' test [',' test]]
! assert_stmt: 'assert' test [',' test]
  
  compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
! if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
! while_stmt: 'while' test ':' suite ['else' ':' suite]
! for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
! try_stmt: ('try' ':' suite (except_clause ':' suite)+ #diagram:break
!            ['else' ':' suite] | 'try' ':' suite 'finally' ':' suite)
  # NB compile.c makes sure that the default except clause is last
! except_clause: 'except' [test [',' test]]
  suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
  
! test: and_test ('or' and_test)* | lambdef
! and_test: not_test ('and' not_test)*
! not_test: 'not' not_test | comparison
  comparison: expr (comp_op expr)*
! comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not'
  expr: xor_expr ('|' xor_expr)*
  xor_expr: and_expr ('^' and_expr)*
  and_expr: shift_expr ('&' shift_expr)*
--- 33,71 ----
  small_stmt: expr_stmt | print_stmt  | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt | assert_stmt
  expr_stmt: testlist ('=' testlist)*
  # For assignments, additional restrictions enforced by the interpreter
! print_stmt: 'schreib' (test ',')* [test]
! del_stmt: 'loesch' exprlist
! pass_stmt: 'passe'
  flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt
! break_stmt: 'brich_ab'
  continue_stmt: 'continue'
! return_stmt: 'zurueck' [testlist]
! raise_stmt: 'beschwoere' [test [',' test [',' test]]]
! import_stmt: 'importiere' dotted_name (',' dotted_name)* | 'aus' dotted_name 'importiere' ('*' | NAME (',' NAME)*)
  dotted_name: NAME ('.' NAME)*
  global_stmt: 'global' NAME (',' NAME)*
  #access_stmt: 'access' ('*' | NAME (',' NAME)*) ':' accesstype  (',' accesstype)*
  #accesstype: NAME+
  ## accesstype should be ('public' | 'protected' | 'private') ['read'] ['write']
  ## but can't be because that would create undesirable reserved words!
! exec_stmt: 'fuehr_aus' expr ['in' test [',' test]]
! assert_stmt: 'sicherezu' test [',' test]
  
  compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
! if_stmt: 'falls' test ':' suite ('sonstfalls' test ':' suite)* ['sonst' ':' suite]
! while_stmt: 'solange' test ':' suite ['sonst' ':' suite]
! for_stmt: 'fuer' exprlist 'in' testlist ':' suite ['sonst' ':' suite]
! try_stmt: ('versuch' ':' suite (except_clause ':' suite)+ #diagram:break
!            ['sonst' ':' suite] | 'versuch' ':' suite 'schliesslich' ':' suite)
  # NB compile.c makes sure that the default except clause is last
! except_clause: 'erwarte' [test [',' test]]
  suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
  
! test: and_test ('oder' and_test)* | lambdef
! and_test: not_test ('und' not_test)*
! not_test: 'nicht' not_test | comparison
  comparison: expr (comp_op expr)*
! comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'nicht' 'in'|'ist'|'ist' 'nicht'
  expr: xor_expr ('|' xor_expr)*
  xor_expr: and_expr ('^' and_expr)*
  and_expr: shift_expr ('&' shift_expr)*
***************
*** 84,90 ****
  testlist: test (',' test)* [',']
  dictmaker: test ':' test (',' test ':' test)* [',']
  
! classdef: 'class' NAME ['(' testlist ')'] ':' suite
  
  arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test)
  argument: [test '='] test	# Really [keyword '='] test
--- 84,90 ----
  testlist: test (',' test)* [',']
  dictmaker: test ':' test (',' test ':' test)* [',']
  
! classdef: 'klasse' NAME ['(' testlist ')'] ':' suite
  
  arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test)
  argument: [test '='] test	# Really [keyword '='] test


More information about the Python-list mailing list