# parse-to-ast.pkg
# Compiled by:
#
src/lib/c-kit/src/ast/ast.sublib### "I view the landslide of C use in
### education as something of a calamity."
###
### -- Nicklaus Wirth
stipulate
package fil = file__premicrothread; # file__premicrothread is from
src/lib/std/src/posix/file--premicrothread.pkgherein
package parse_to_raw_syntax_tree
: (weak) Parse_To_Raw_Syntax_Tree # Parse_To_Raw_Syntax_Tree is from
src/lib/c-kit/src/ast/parse-to-ast.api {
Raw_Syntax_Tree_Bundle
=
{ raw_syntax_tree: raw_syntax::Raw_Syntax_Tree,
tidtab: tidtab::Uidtab( namings::Tid_Naming ),
error_count: Int,
warning_count: Int,
auxiliary_info: { aidtab: tables::Aidtab,
implicits: tables::Aidtab,
dictionary: state::Symtab }
};
fun prog_to_state ( { tidtab, auxiliary_info=> { aidtab, implicits, dictionary }, ... } : Raw_Syntax_Tree_Bundle) =
state::STATE( { ttab=>tidtab, atab=>aidtab, implicits }, dictionary);
fun file_to_raw_syntax_tree' err_strm (sizes: sizes::Sizes, state_info: state::State_Info) in_file
: Raw_Syntax_Tree_Bundle =
{
# suppress underscores to make error message more readable
suppress_pid_underscores = *prettyprint_lib::suppress_pid_underscores;
suppress_tid_underscores = *prettyprint_lib::suppress_tid_underscores;
{ prettyprint_lib::suppress_pid_underscores := TRUE;
prettyprint_lib::suppress_tid_underscores := TRUE;};
err_state = error::make_error_state err_strm;
p = c_parser::parse_file err_state in_file;
result = build_raw_syntax_tree::make_raw_syntax_tree (sizes, state_info, err_state) p;
prettyprint_lib::suppress_pid_underscores := suppress_pid_underscores;
prettyprint_lib::suppress_tid_underscores := suppress_tid_underscores;
result;
};
fun file_to_raw_syntax_tree in_file
=
file_to_raw_syntax_tree' fil::stderr (sizes::default_sizes, state::INITIAL) in_file;
fun file_to_c x
=
{ my { raw_syntax_tree, tidtab, ... } = file_to_raw_syntax_tree x;
prettyprint_lib::prettyprint_to_strm (unparse_raw_syntax::unparse_raw_syntax () tidtab) fil::stdout raw_syntax_tree;
};
}; # package parse_to_raw_syntax_tree
end;