Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rec finder1 (work_list:string list list) (n_tab:int) (in_after_let:int) (in_list :int list) (else_list:int list) :(int*string) list=
- match work_list with
- |[]-> []
- |x::xs ->
- match x with
- |[] -> (0,"")::finder (xs) (0) (0) ([]) (else_list)
- |y::ys ->
- match y with
- |"let"->
- match last x with
- |"=" -> (n_tab, unisci_stringhe x)::finder (xs) (n_tab+1) (0) (add_element n_tab in_list) (else_list)
- |_ ->
- match next_line xs with
- |"in"->(n_tab, unisci_stringhe x)::finder (xs) (n_tab) (1) (in_list) (else_list)
- |_->(n_tab, unisci_stringhe x)::finder (xs) (n_tab) (0) (in_list) (else_list)
- |"if"->(n_tab, unisci_stringhe x)::finder (xs) (n_tab+1) (in_after_let) (in_list) (n_tab::else_list)
- |"else"->
- match last x with
- |"else"->(first_int else_list, unisci_stringhe x)::finder (xs) (first_int else_list+1) (in_after_let) (in_list) (remove_first else_list)
- |_-> (first_int else_list, unisci_stringhe x)::finder (xs) (first_int else_list) (in_after_let) (in_list) (remove_first else_list)
- |"elif"->(first_int else_list, unisci_stringhe x)::finder (xs) (first_int else_list+1) (in_after_let) (in_list) (else_list)
- |"match"->(n_tab,unisci_stringhe x)::finder (xs) (n_tab) (in_after_let) (in_list) (else_list)
- |"|"->
- match last x with
- |"->" ->(n_tab,unisci_stringhe x)::finder (xs) (n_tab+1) (in_after_let) (in_list) (else_list)
- |_->
- match next_line xs with
- |"|"-> (n_tab,unisci_stringhe x)::finder (xs) (n_tab) (in_after_let) (in_list) (else_list)
- |_ -> (n_tab,unisci_stringhe x)::finder (xs) (n_tab-1) (in_after_let) (in_list) (else_list)
- |"in"->
- match first_list xs with
- |[]->(penultimo in_list, unisci_stringhe x)::finder (xs) (n_tab) (in_after_let) (remove_first in_list) (else_list)
- |_->
- match in_after_let with
- |1->(n_tab,unisci_stringhe x)::finder (xs) (n_tab) (0) (in_list) (else_list)
- |_->(first_int in_list,unisci_stringhe x)::finder (xs) (first_int in_list) (in_after_let) (remove_first in_list) (else_list)
- |_->(n_tab,unisci_stringhe x)::finder (xs) (n_tab-1) (in_after_let) (in_list) (else_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement