Rename to picalc.*, improve messages slightly master
authorNick Downing <nick@ndcode.org>
Sat, 14 May 2022 11:25:33 +0000 (21:25 +1000)
committerNick Downing <nick@ndcode.org>
Sat, 14 May 2022 11:32:31 +0000 (21:32 +1000)
Makefile
picalc.l [moved from cal_py.l with 100% similarity]
picalc.py [moved from cal.py with 96% similarity]
picalc.t [moved from cal_py.t with 100% similarity]
picalc.y [moved from cal_py.y with 92% similarity]

index 4343700..04c1cc0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,13 +3,13 @@ all: element.py lex_yy.py t_def.py y_tab.py
 element.py:
        pitree --install-element
 
-lex_yy.py: cal_py.l
+lex_yy.py: picalc.l
        pilex --element --groups --python $<
 
-t_def.py: cal_py.t
+t_def.py: picalc.t
        pitree --python $<
 
-y_tab.py: cal_py.y
+y_tab.py: picalc.y
        piyacc --element --python $<
 
 clean:
similarity index 100%
rename from cal_py.l
rename to picalc.l
similarity index 96%
rename from cal.py
rename to picalc.py
index 160da64..f60c0ed 100755 (executable)
--- a/cal.py
+++ b/picalc.py
@@ -21,7 +21,7 @@ import element
 import sys
 import y_tab
 
-sys.stdout.write('Enter the expression: ')
+sys.stdout.write('Enter an expression:\n')
 sys.stdout.flush()
 _ast = y_tab.yyparse(t_def.AST)
 element.serialize(_ast, sys.stdout)
similarity index 100%
rename from cal_py.t
rename to picalc.t
similarity index 92%
rename from cal_py.y
rename to picalc.y
index 8c66253..c83cf78 100644 (file)
--- a/cal_py.y
+++ b/picalc.y
 %%
 
 S : S E '\n' {
-    sys.stdout.write('Answer: {0:g}\nEnter:\n'.format($2))
+    sys.stdout.write('Answer: {0:g}\nEnter an expression:\n'.format($2))
   }
   | S '\n'
   |
   | error '\n' {
-  yyerror('Error: Enter once more...\n')
+  yyerror('Error, please try again:\n')
   yyerrok()
 }
   ;