Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2005
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Expression Parsing

    I was wondering how I should write this expression parsing function:
    I'm trying to create a new operator (→) that outputs:
    Code:
    P   Q    P->Q
    T   T      T
    T   F      F
    F   T      T
    F   F      T 
    As you may have guessed the logic is (P==Q)||Q
    Another operator I'm trying to create is (↔) that outputs

    Code:
    P   Q    P->Q
    T   T      T
    T   F      F
    F   T      F
    F   F      T 
    As you may have guessed the logic is (P==Q)||Q
    The logic here is P==Q[/CODE]

    Additionally, I need to parse logical quantifiers so that:
    Code:
    ∃x becomes names.some(function(x){...})
    ∀x becomes names.every(function(x){...})
    For example:
    • ∃x Dodec(x) becomes names.some(function(x){return Dodec(x)})
    • ∃x ∃y Smaller(x,y) becomes names.some(function(x){names.some(function(y){return Smaller(x,y)})})
    • ∃x ∃y ∀z Between(x,y,z) becomes names.some(function(x){names.some(function(y)names.some(function(x){names.some(function(z){return Between(x,y,z)})})})
    For a well formed logical statement, a person needs to properly parenthesize the statement.
    Valid examples:
    (Dodec(a)→Dodec(b))→Dodec(c)
    ∃x(Dodec(x) && ∃y Smaller(x,y))

    Invalid Examples:
    Dodec(a)→Dodec(b)→Dodec(c)
    ∃x Dodec(x) && ∃ySmaller(x,y) [Valid: ∃x Dodec(x) && ∃x∃ySmaller(x,y), the quantifier does not carry through]

    For more information on logic:http://en.wikipedia.org/wiki/Predicate_logic

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    this looks a lot like homework, if not what's the use-case?
    Have you done anything so far?
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #3
    New Coder
    Join Date
    Aug 2005
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    It's a personal project

    I'm trying to port a software we had to use for Symbolic Logic to Javascript since I couldn't use it on Linux. Now the semester is over so I have more time to get involved. Yeah it is kinda for school, but now I'm just trying to learn Javascript and I think I'll turn this into Flash soon. Since using Flash will make a lot of the 3D stuff easier I could use SVG, but that's not supported as much as Flash.

    The software I'm trying to port is: http://www-csli.stanford.edu/LPL/

    I'll put up what I have so far here: http://dasickis.com/jstarski
    Last edited by dasickis; 05-11-2007 at 03:32 AM. Reason: My site is up

  • #4
    New Coder
    Join Date
    Aug 2005
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can someone help?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •