MCPcopy Create free account

hub / github.com/bollu/timi / functions

Functions132 in github.com/bollu/timi

↓ 39 callersMethodget
returns the heap node at address Addr ### Panics `get` panics if the address does not exist on the heap. To check if an address is on the heap, use
src/machine.rs:338
↓ 38 callersMethoditer
returns an iterator to the stack elements. NOTE:* top of the stack is returned first, bottom of the stack is returned last.
src/machine.rs:283
↓ 30 callersFunctionrun_machine
(program: &str)
tests/test_machine.rs:11
↓ 22 callersMethodexpect
Expect the given token, returning a `ParseError` if the given token was not found.
src/frontend.rs:296
↓ 20 callersMethodlen
return number of elements on the stack.
src/machine.rs:255
↓ 20 callersMethodpush
push an address on top of the stack.
src/machine.rs:260
↓ 17 callersMethodpop
pops the top of the stack. # Errors returns an error if the stack is empty
src/machine.rs:268
↓ 12 callersMethodpeek
Peek at the current token. If a token exists, then return the token & its range. If a token does not exist, return the range of the last seen token an
src/frontend.rs:270
↓ 12 callersMethodrewrite
rewrites the address `addr` with new heap node `node` ### Panics if the heap node at `addr` does not exist, this function will panic
src/machine.rs:349
↓ 10 callersFunctionrun_primitive_num_binop
extractor should return an error if a node cannot have data extracted from. It should return None 0: + 1: (+ a) 2: (+ a) b bottom-^
src/machine.rs:1195
↓ 9 callersMethodconsume
Consume a token, moving the cursor one token forward in the input stream. Returns the consumed token and its range if `consume()` succeeded. Returns
src/frontend.rs:282
↓ 9 callersMethodinto
(self)
src/frontend.rs:172
↓ 8 callersMethodalloc
Allocate the HeapNode on the heap. returns the address at which the node was allocated.
src/machine.rs:324
↓ 8 callersMethodcontains
returns whether the heap contains an element at address `addr`.
src/machine.rs:363
↓ 8 callersFunctionunwrap_heap_node_to_ap
Tries to unwrap a heap node to an application node, fails if the heap node is not application. # Use Case unwrapping application nodes is a very comm
src/machine.rs:217
↓ 6 callersFunctionbool_to_heap_node
converts a boolean into a HeapNode for True and False
src/machine.rs:397
↓ 6 callersMethodpoint
Return the Point corresponding to the current cursor location.
src/frontend.rs:349
↓ 6 callersFunctionsetup_heap_node_access
Get a heap node of the kind that handler wants to get, otherwise setup the heap so that unevaluated code is evaluated to get something of this type.
src/machine.rs:1414
↓ 5 callersFunctionparse_binop_at_precedence
General function for top-down parsing of binary operators with one lookahead. `lhs_parse_fn` is first used to parse the left hand side of the binary
src/frontend.rs:853
↓ 5 callersFunctionparse_expr
```haskell <expr> := <or_expr> | "Let" let_expr ```
src/frontend.rs:964
↓ 5 callersMethodpeek
peeks the top of the stack. NOTE:* does _not_ remove the element on the top of the stack.
src/machine.rs:275
↓ 4 callersMethodconsume_while
Consumes from the character stream as long as `pred` returns true. `pred` is given the string consumed so far and the current character. It is expect
src/frontend.rs:417
↓ 4 callersFunctionis_addr_phantom
let bindings first bind to "phantom" addresses, after which they relink addresses to their correct locations. This lets us check if an address is phan
src/machine.rs:772
↓ 4 callersMethodrange_till_cur
Return a [`Range`](struct.Range.html) starting from `start_point` till the current cursor location.
src/frontend.rs:360
↓ 3 callersMethodadd_supercombinator
Add the supercombinator to the machine. This will allocate the supercombinator on the heap and create a binding in the environment to the name of the
src/machine.rs:529
↓ 3 callersMethodas_range
convert the `Point` to a `Range` starting and ending at the same `Point`
src/frontend.rs:34
↓ 3 callersFunctionexit_with_err
(err: &str)
src/bin.rs:191
↓ 3 callersMethodis_data_node
(&self)
src/machine.rs:200
↓ 3 callersMethodis_final_state
returns whether the machine is in final state or not. ### Errors Returns `MachineError` if machine is in invalid state
src/machine.rs:557
↓ 3 callersFunctionparse_string_as_int
Try to parse the given string as an integer. ### Use Case Integers are stored as strings in the tokenizer to prevent loss of precision during error r
src/frontend.rs:639
↓ 3 callersFunctionstring_to_program
Try to convert the given string to a [CoreProgram](../ir/type.CoreProgram.html)
src/frontend.rs:1032
↓ 3 callersFunctiontokenize
Tokenize the given program string. Returns a vector of `(Range, CoreToken)` where `Range` represents the source code range of the token, and `CoreToke
src/frontend.rs:586
↓ 2 callersFunctioncollect_addrs_from_heap_node
Gives addresses pointed to in the heap node at address `addr`. This is recursive and produces a list of _all_ addresses by walking the graph of addres
src/pretty_print.rs:139
↓ 2 callersMethodinstantiate
given a supercombinator, realize it on the heap by recursively instantiating its body, with respect to the environment `env. The environment is used t
src/machine.rs:694
↓ 2 callersFunctionparse_supercombinator
```haskell supercombinator := <name: Ident> (<args : Ident>)* "=" <expr> ```
src/frontend.rs:976
↓ 2 callersFunctionprint_stack
pretty print the given stack `s`
src/pretty_print.rs:196
↓ 2 callersFunctionrun_machine
(rl: &mut Editor<C>, m: &mut Machine, pause_per_step: &mut bool)
src/bin.rs:67
↓ 2 callersMethodsetup_supercombinator_execution
setup the execution of a registered supercombinator with name sc_name.
src/machine.rs:541
↓ 2 callersMethodstep
inspect the top of the stack and take a step in interpretation if we are not in the final state
src/machine.rs:580
↓ 1 callersFunctionbuild_heap_and_env_for_program
builds the initial heap and environment corresponding to the program given. This allocates heap nodes for supercombinators in `sc_defs` and primitive
src/machine.rs:460
↓ 1 callersFunctioncan_char_belong_identifier
Return whether the character can be part of an identifier.
src/frontend.rs:541
↓ 1 callersFunctionchange_addr_in_heap_node
edits the address recursively in the given heap node to replace the `fake_addr` with `new_addr` **at** `edit_addr` node. edited_addrs is a bookkeeping
src/machine.rs:863
↓ 1 callersMethodconsume_longest_match
Consumes the longest match from the input stream from `matches` if no match is found, returns a [`ParseError`](enum.ParseError.html)
src/frontend.rs:370
↓ 1 callersFunctioncreate_machine_from_file_path
(path: &str)
src/bin.rs:197
↓ 1 callersMethoddump_stack
dump the current stack into the dump, and create a fresh stack
src/machine.rs:573
↓ 1 callersFunctioneat_comment
Eats comments till the end of the line returns whether a comment was consumed or not this is used to restart tokenization for the next line if a comme
src/frontend.rs:550
↓ 1 callersFunctioneat_whitespace
Eat whitespace from the input stream
src/frontend.rs:535
↓ 1 callersFunctionfind_root_heap_node_for_addr
this will return a node that the address is bound to on the heap. if there is no instantiation (which is possible in cases like) let y = x; x = y in 1
src/machine.rs:736
↓ 1 callersFunctionformat_heap_node
format a heap node, by pretty printing the node. If the node contains recursive structure, this will handle it and print `<<recursive_defn>>`
src/pretty_print.rs:21
↓ 1 callersFunctionget_node_neighbours
(node: &HeapNode)
src/pretty_print.rs:85
↓ 1 callersFunctionget_prelude
constructs the prelude program for the machine.
src/machine.rs:410
↓ 1 callersFunctionget_primitives
mapping between strings for primitives and the primitive operation
src/machine.rs:434
↓ 1 callersMethodheap_node_step
perform an interpretation step by case analysis of the given heap node (which is the top of the stack)
src/machine.rs:600
↓ 1 callersFunctionidentifier_str_to_token
Convert a raw identifier string to the correct token ### Use Case identifiers can also be tokens such as `let`, `pack`, `in`, etc. we use this to dis
src/frontend.rs:470
↓ 1 callersFunctioninstantiate_let_bindings
instantiate let bindings This tricky case needs to be handled: ``` let y = x; x = 10 in y + y ``` here, if we instantiate `y`, then `x`, and then con
src/machine.rs:786
↓ 1 callersFunctioninterpreter
()
src/bin.rs:92
↓ 1 callersFunctionis_char_space
Returns whether the given character is a space ### Use Case The parser eats white space between tokens. This is used to detect white space
src/frontend.rs:485
↓ 1 callersFunctionis_heap_node_cyclic
returns if the Heap node at address `addr` contains a cyclic definition or not.
src/pretty_print.rs:81
↓ 1 callersFunctionis_token_atomic_expr_start
Returns if the given token is the start of an atomic expression. ### Use Case Since our grammar is `LL(1)`, we require one lookahead to disambiguate
src/frontend.rs:654
↓ 1 callersFunctionmake_supercombinator_env
Make an environment for the execution of the Supercombinator. let f a b c = <body> if a function call of the form `(f x y z)` was made, the stack wil
src/machine.rs:1370
↓ 1 callersFunctionparse_atomic_expr
```haskell <atomic> := <num> | <ident> | "(" <expr> ")" ```
src/frontend.rs:667
↓ 1 callersFunctionparse_defn
```haskell <defn> := <ident> "=" <expr> ```
src/frontend.rs:694
↓ 1 callersFunctionparse_identifier
```haskell` <ident> := [a-z, A-Z]([a-Z, A-Z, 0-9, ?, -, _]*) ``` An identifier must start with a character, and can then contain any number of charac
src/frontend.rs:567
↓ 1 callersFunctionparse_let
```haskell <let> := "let" <bindings> "in" <expr>; <bindings> := <defn> | <defn> ";" <bindings> ```
src/frontend.rs:713
↓ 1 callersFunctionparse_or
```haskell <or_expr> := <and_expr> "|" <or_expr> | <or_expr> ```
src/frontend.rs:950
↓ 1 callersFunctionparse_pack
```haskell <pack> := "Pack" "{" <tag : Int> "," <arity : Int> "}" ```
src/frontend.rs:749
↓ 1 callersFunctionprint_machine
pretty print the machine
src/pretty_print.rs:221
↓ 1 callersFunctionraw_tag_to_data_tag
convert an integer data tag that is obtained from a [`CoreExpr::Pack.tag`](../ir/enum.CoreExpr.html) into a [`DataTag`](enum.DataTag.html)
src/machine.rs:102
↓ 1 callersFunctionrun_constructor
IV stack: <rewritten complex expr> dump: if <rewritten complex expr> 1 2
src/machine.rs:1260
↓ 1 callersFunctionrun_machine_step
Runs one step of the machine, and returns if machine has reached the final state or not.
src/bin.rs:60
↓ 1 callersFunctionrun_primitive_case_list
Rule 2. (for Nil) 0: caseList 1: caseList $ (Nil) 2: caseList Nil $ <nil-handler> 3: caseList Nil $ <nil-handler> $ <cons-handler> on rewrite 3: <nil-
src/machine.rs:1124
↓ 1 callersFunctionrun_primitive_case_pair
0: casePair 1: casePair $ (left, right) 2: casePair (left, right) $ <case_handler> on rewrite 2: (<case_handler> $ left) $ right
src/machine.rs:1048
↓ 1 callersFunctionrun_primitive_if
0: if 1: if $ <cond> <- if_ap_addr 2: if <cond> $ <then> 3: if <cond> <then> $ <else>
src/machine.rs:992
↓ 1 callersFunctionrun_primitive_negate
TODO: rewrite code to follow the new style of peeking all of them and then popping off all of them
src/machine.rs:962
↓ 1 callersFunctionrun_step_interaction
(rl: &mut Editor<C>, iter_count: usize, pause_per_step:
src/bin.rs:22
↓ 1 callersFunctionrun_supercombinator
Runs the given supercombinator by instantiating it on top of the stack.
src/machine.rs:1306
↓ 1 callersFunctionstring_to_expr
Try to convert the given string to a [CoreExpr](../ir/enum.CoreExpr.html)
src/frontend.rs:1015
↓ 1 callersFunctionstring_to_sc_defn
Try to convert the given string to a [SupercombDefn](../ir/struct.SupercombDefn.html)
src/frontend.rs:1023
↓ 1 callersFunctiontokenize_symbol
Tokenize a symbol from the input stream
src/frontend.rs:491
Methodfmt
(&self, fmt: &mut fmt::Formatter)
src/machine.rs:65
Methodfmt
(&self, fmt: &mut fmt::Formatter)
src/frontend.rs:77
Methodfmt
(&self, fmt: &mut fmt::Formatter)
src/ir.rs:44
Functionformat_addr_string
Format an address to be of the form `0xaddress_in_hex`. Used for pretty printing addresses
src/pretty_print.rs:179
Functionformat_heap_tag
makes the heap tag bold
src/machine.rs:142
Methodgeneric
Helper to construct a `Err` with a [`ParseErrorKind::Generic`](enum.ParseErrorKind.html)
src/frontend.rs:101
Methodget_line_number_pretty
pretty print the line number string
src/frontend.rs:131
Functionheap_try_bool_access
try to access the heap node as a boolean returns an error if the heap node is not data with `TagTrue` or `TagFalse`.
src/machine.rs:1465
Functionheap_try_list_access
try to access the heap node as list.
src/machine.rs:1496
Functionheap_try_num_access
try to access the heap node as a number. returns an error if the heap node is not a `Num` node
src/machine.rs:1453
Functionheap_try_pair_access
try to access the heap node as a pair
src/machine.rs:1475
Functionmachine_get_final_val_string
returns the pretty-printed version of the final heap node on top of the stack. ### Errors Returns an error if the machine is not in the final state
src/pretty_print.rs:188
Functionmain
()
src/bin.rs:226
Methodnew
()
src/machine.rs:248
Methodnew
(index: usize, line: usize, col: usize)
src/frontend.rs:25
Methodnew_from_program
Create a machine from `program`. Expects a `main` to be present in the given program. ###Errors returns an error if `main` was not found
src/machine.rs:510
Methodnew_minimal
Create a minimal machine that has the prelude and primitives instantiated, but with an empty stack.
src/machine.rs:489
Functionparse_add_sub
```haskell <add_sub_expr> := <mul_div_expr> ("+" | "-") <add_sub_expr> ```
src/frontend.rs:906
Functionparse_and
```haskell <and_expr> := <relop_expr> "&" <and_expr> | <relop_expr> ```
src/frontend.rs:938
Functionparse_application
```haskell <aexpr> := <atomic> | Pack "{" <num> "," <num> "}"; <application> := <aexpr> | <aexpr>+ ``` Note that this parses either a standalone expr
src/frontend.rs:790
Functionparse_mul_div
```haskell <mul_div_expr> := <application_expr> ("*" | "/") <mul_div_expr> ```
src/frontend.rs:893
next →1–100 of 132, ranked by callers