Commit Graph

367 Commits

Author SHA1 Message Date
Romain Goyet
07f749ff2a Poincare: Proper macro to enable expression debug
Change-Id: Ie1e880f5f80a5ce49424319a9af9d97bf10f2ef4
2016-04-07 15:51:16 +02:00
Romain Goyet
d2a010be70 Poincare: RuleGen now uses a more explicit grammar
Change-Id: I22ca00a7115d8c60fd0aa95ec17deec829e0a69d
Examples: Integer.a and Integer["0"]
2016-04-07 15:51:16 +02:00
Romain Goyet
1f64dfda9d Ignore the rulegen generated files
Change-Id: Icbbe984dedbedf7c4b74e496fbd43279cc49b7e0
2016-04-07 15:51:16 +02:00
Romain Goyet
e41150f56d Poincare: Removing dead code
Change-Id: I6d38a7f7be99e8b219f541673b6cb5815b9408d9
2016-04-07 15:51:16 +02:00
Romain Goyet
d9354ac1cc ExpressionBuilder now has both BuildFromType and BuildFromTypeAndValue
Change-Id: If4a25b9b4df4097b0b3b7e92cbd49e2ac764d075
2016-04-07 15:51:16 +02:00
Romain Goyet
91505631c7 Poincare: Simplification is not a POD object either but uses constexpr
Change-Id: If7b6a33720eddb41b5cdf016e131bde873474043
2016-04-07 15:51:16 +02:00
Romain Goyet
c870c28e61 Poincare: ExpressionBuilder and ExpressionSelector are not PODs anymore
This means we cannot initialize them by using C99-style static init.
C++11 to the rescue: we're using constexpr constructor to build them
statically, without any runtime cost.

This allows us to have private member variables, and a base class.

Change-Id: I0617d196e87f946b48375f42b600eb73e366d87d
2016-04-07 15:51:16 +02:00
Romain Goyet
acef4c079e Poincare: Add a ContiguousTree class
Note that this class is not being used yet.

Change-Id: Iaf58ab2e90f54df11ab81ed4ac62ab26b524b99d
2016-04-07 15:51:16 +02:00
Felix Raimundo
11a5550bfd Fix issue in a selector.
Change-Id: I8079ffd7aeb4117f0edec9c292cacb56adf20a7f
2016-04-07 12:44:05 +02:00
Felix Raimundo
7a7df647f3 Fix the printing of integers.
Because yes, multiples of 10 would not print...

Change-Id: Id58305086d499eb091ea5612fedcc5ec6f25c415
2016-04-07 12:44:05 +02:00
Felix Raimundo
5c96e04a6a Add tests for the simplification rules.
Change-Id: I086e18b2fcea5deb725872cf1254b6c2636a032a
2016-04-07 12:44:05 +02:00
Felix Raimundo
906363d4f6 Make simplifictaion able to deal with commutativity.
Change-Id: Ide620b0453ac54f0edbf2efa4c986f969392a701
2016-04-07 12:44:05 +02:00
Félix Raimundo
68cc944cdc Merge "Fix the build" 2016-04-07 12:43:53 +02:00
Felix Raimundo
e584bdf4b9 Big fingers
Change-Id: I54b0515cb519fc395c0e24ea0809316ffec1a42f
2016-04-06 19:04:24 +02:00
Romain Goyet
344c2d1ead Fix the build
Change-Id: I17bb89c51b1d4231a3cec3b91b453583e872d1b2
2016-04-06 15:20:36 +02:00
Félix Raimundo
c50125e631 Merge changes I0b5de34d,I2b67ac89,I657df96c,I9a2ed44d,I682fed31, ...
* changes:
  Add the multip[lictaion by zero rule.
  Add coment to move operator in expression match.
  Add the isCommutative method to expression.
  Fix untreated case in rule generation.
  Fix the precedence of the operations.
  Fix unitialized variables in HorizontalLayout.
  Writes the simplified version of an expression.
2016-04-05 16:02:37 +02:00
Félix Raimundo
ade4dd30ed Merge "Draw rectangles with lines." 2016-04-05 16:01:57 +02:00
Felix Raimundo
43b90c104c Add the multip[lictaion by zero rule.
Also fix the writting of Wildcard.

Change-Id: I0b5de34d6528b8eb0cb73b77c65396b28e63c2dc
2016-04-05 15:53:29 +02:00
Felix Raimundo
8366cf71ec Add coment to move operator in expression match.
Change-Id: I2b67ac892a69d5b711adff5623259fce811ec31f
2016-04-05 15:53:29 +02:00
Felix Raimundo
ac29d1e9aa Add the isCommutative method to expression.
Change-Id: I657df96c5e24168ecd04470252549ed84eb2cfe3
2016-04-05 15:53:29 +02:00
Felix Raimundo
b7a1bb9cdb Fix untreated case in rule generation.
Add an assert showing that a case is not implemented.

Change-Id: I9a2ed44d52cb7b1df1fab1b2765f966a67c95586
2016-04-05 15:53:29 +02:00
Felix Raimundo
c94b209729 Fix the precedence of the operations.
Change-Id: I682fed318aaefdcc64489e922ba0e91c0cb4979d
2016-04-05 15:53:29 +02:00
Felix Raimundo
50c5a3b08e Fix unitialized variables in HorizontalLayout.
Change-Id: I37beaae4e0e1bd6931c420d72b145ba42d5fb452
2016-04-05 15:53:20 +02:00
Romain Goyet
195e8932af Merge "Poincare: Make the rulegen step silent" 2016-04-05 12:56:35 +02:00
Romain Goyet
792b89dc07 Poincare: Make the rulegen step silent
Change-Id: Ic2fd2b603ed6d0a84e5a738c17fb179403844c72
2016-04-04 14:40:04 +02:00
Felix Raimundo
ff83c8c4da Draw rectangles with lines.
Change-Id: I257ea485e67d2cc1c2ad5f9405fe507f3f4d00f1
2016-04-04 11:05:49 +02:00
Felix Raimundo
10c383d102 Writes the simplified version of an expression.
Change-Id: If0e89735a85a684ad4c044ae4b8d6f8a9ae81dac
2016-04-04 11:05:49 +02:00
Félix Raimundo
89647c995d Merge "Poincare: Silent build" 2016-04-04 11:05:32 +02:00
Félix Raimundo
586a850610 Merge "Add a delete button to the keyboard." 2016-04-04 10:50:03 +02:00
Felix Raimundo
f9b7836e1e Add a delete button to the keyboard.
Change-Id: I10e57f19a7edfb4a59fb3c2f48bc0f8a8a58643f
2016-04-01 15:13:47 +02:00
Romain Goyet
6cd646cc98 Poincare: Silent build
Change-Id: I49afd7f71c211dbaa8453608570d3972ecb08517
2016-04-01 15:12:12 +02:00
Romain Goyet
b9722aa0d8 Merge branch 'master' of ssh://git.numworks.com:29418/CalcOS
Change-Id: I3a0f53c58707de1100412dc6572abe6b852e9cb2
2016-04-01 15:09:34 +02:00
Felix Raimundo
a9a522f29c Remove bad debug.
Change-Id: Id8a0780aa9782ebbbf4118ed210de3acaa9ae9ff
2016-04-01 15:05:20 +02:00
Felix Raimundo
6238b5a110 Add the ability to match on values.
Change-Id: Id38aad5b64913c948966c980fb4415749b2c435d
2016-04-01 15:05:20 +02:00
Felix Raimundo
b0c44dc39e wip
Change-Id: I7ac1cea7dc59ca2fa9c25cc8244c26a95a650448
2016-04-01 15:04:41 +02:00
Romain Goyet
5a36ec48d9 Poincare: Make it easier to dump the AST in tests
Change-Id: I038ec19bd6f12a7efcb1840ba16217e5ee4b22be
2016-04-01 15:04:03 +02:00
Romain Goyet
de2f83e8bd Poincare: Put the AST printing in its own file
Change-Id: I1793fa2057098f31a549faf6bf39e64c333b5b06
2016-04-01 15:02:31 +02:00
Romain Goyet
a218fcfe9a Poincare: Remove a warning
Change-Id: I744af914384adc2c75f7773dd06a17e7c30d5816
2016-04-01 14:30:24 +02:00
Romain Goyet
8da423e306 Poincare: Fix the rulegen
Change-Id: Ib672071daa3b4ca4575845fd11ec455c442acd8d
2016-04-01 14:29:59 +02:00
Romain Goyet
af04b2b799 WildCard is spelled Wildcard
Change-Id: I88b3b7daac80f84548d013fbebb74f8f617833cd
2016-04-01 14:29:38 +02:00
Romain Goyet
edb6737057 Poincare: Formal ruleset
Change-Id: Id5a52345f198c6e52a7fba307b510810bba4304d
2016-04-01 14:29:08 +02:00
Romain Goyet
9993ba1d77 Poincare: Build and use the rulegen
Change-Id: I4971102cc2267b2c9c010c20f18f70be5fb85c52
2016-04-01 14:28:45 +02:00
Romain Goyet
f54403ae21 Poincare: Add a README for the simplification
Change-Id: Ife72d5914a6968bdc7c52ad93a329b37fe2c01a6
2016-04-01 14:22:39 +02:00
Romain Goyet
7f116ace21 Poincare: Build the RuleGen
Change-Id: I0a45f175fbfbd52d43e1e756b526123fe0609f06
2016-04-01 13:36:03 +02:00
Romain Goyet
c8e850ba7f Poincare: Add a sample list of rules
Change-Id: I893c2267abe082d6304f7013c0c571e35cb21427
CAUTION: They are completely idiotic!
2016-04-01 13:36:03 +02:00
Romain Goyet
9125033d90 Poincare: The rules compiler checks for wildcard consistency
Change-Id: I9de57987b10fced3f1e63358b9d0158f97c3db15
2016-04-01 13:36:03 +02:00
Felix Raimundo
ed2c4cfb59 First version of the simplifications.
Change-Id: Idbddb92b6bd098d6b862f5fc4abd741948e15194
2016-04-01 11:32:11 +02:00
Romain Goyet
6232079f02 Poincare: Add a Simplification rule generator
Change-Id: I4a0971405164c40c5ca3f7e1a0406f01d83d67d8
2016-03-31 18:47:18 +02:00
Felix Raimundo
7ddd1fc112 WIP - Remove dead code / files.
Change-Id: I13a1a871b6ab746377c6b0e79ee887fb6c0e0e6d
2016-03-30 11:26:15 +02:00
Felix Raimundo
5e01cfe421 Add baseline for pretty printing.
Change-Id: I77e76cb4b6191992137dd83f366006115ae65661
2016-03-29 13:41:37 +02:00