Created
June 18, 2012 02:11
-
-
Save ckirkendall/2946421 to your computer and use it in GitHub Desktop.
J Program for creation of AST Add(Variable 'a',Multiply(Number 2, Variable 'b'))
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
┌───┬────────────┬──────────────────────────────────┐ | |
│Add│┌────────┬─┐│┌────────┬──────────┬────────────┐│ | |
│ ││Variable│a│││Multiply│┌──────┬─┐│┌────────┬─┐││ | |
│ │└────────┴─┘││ ││Number│2│││Variable│b│││ | |
│ │ ││ │└──────┴─┘│└────────┴─┘││ | |
│ │ │└────────┴──────────┴────────────┘│ | |
└───┴────────────┴──────────────────────────────────┘ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ArrayMaker =: ". ;. _2 | |
A =: ArrayMaker 0 : 0 | |
'Number' ; 2 | |
) | |
B=: ArrayMaker 0 : 0 | |
'Variable' ; 'a' | |
) | |
C=: ArrayMaker 0 : 0 | |
'Variable' ; 'b' | |
) | |
D=: ArrayMaker 0 : 0 | |
'Multiply' ; A ; (< C) | |
) | |
E=: ArrayMaker 0 : 0 | |
'Add' ; B ; (< D) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment